add 4.96.2
[exim-website.git] / docbook / 4.96.1 / 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 02 Oct 2023
17 </date>
18 <author><firstname>Exim</firstname><surname>Maintainers</surname></author>
19 <authorinitials>EM</authorinitials>
20 <revhistory><revision>
21 <revnumber>4.96.1</revnumber>
22 <date>02 Oct 2023</date>
23   <authorinitials>EM</authorinitials>
24 </revision></revhistory>
25 <copyright><year>
26 2022
27            </year><holder>The Exim Maintainers</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 <indexterm role="concept">
153   <primary>headers</primary>
154   <see><emphasis>header lines</emphasis></see>
155 </indexterm>
156
157 <para>
158 Exim is a mail transfer agent (MTA) for hosts that are running Unix or
159 Unix-like operating systems. It was designed on the assumption that it would be
160 run on hosts that are permanently connected to the Internet. However, it can be
161 used on intermittently connected hosts with suitable configuration adjustments.
162 </para>
163 <para>
164 Configuration files currently exist for the following operating systems: AIX,
165 BSD/OS (aka BSDI), Darwin (Mac OS X), DGUX, Dragonfly, FreeBSD, GNU/Hurd,
166 GNU/Linux, HI-OSF (Hitachi), HI-UX, HP-UX, IRIX, MIPS RISCOS, NetBSD, OpenBSD,
167 OpenUNIX, QNX, SCO, SCO SVR4.2 (aka UNIX-SV), Solaris (aka SunOS5), SunOS4,
168 Tru64-Unix (formerly Digital UNIX, formerly DEC-OSF1), Ultrix, and UnixWare.
169 Some of these operating systems are no longer current and cannot easily be
170 tested, so the configuration files may no longer work in practice.
171 </para>
172 <para>
173 There are also configuration files for compiling Exim in the Cygwin environment
174 that can be installed on systems running Windows. However, this document does
175 not contain any information about running Exim in the Cygwin environment.
176 </para>
177 <para>
178 The terms and conditions for the use and distribution of Exim are contained in
179 the file <filename>NOTICE</filename>. Exim is distributed under the terms of the GNU General
180 Public Licence, a copy of which may be found in the file <filename>LICENCE</filename>.
181 </para>
182 <para>
183 The use, supply, or promotion of Exim for the purpose of sending bulk,
184 unsolicited electronic mail is incompatible with the basic aims of Exim,
185 which revolve around the free provision of a service that enhances the quality
186 of personal communications. The author of Exim regards indiscriminate
187 mass-mailing as an antisocial, irresponsible abuse of the Internet.
188 </para>
189 <para>
190 Exim owes a great deal to Smail 3 and its author, Ron Karr. Without the
191 experience of running and working on the Smail 3 code, I could never have
192 contemplated starting to write a new MTA. Many of the ideas and user interfaces
193 were originally taken from Smail 3, though the actual code of Exim is entirely
194 new, and has developed far beyond the initial concept.
195 </para>
196 <para>
197 Many people, both in Cambridge and around the world, have contributed to the
198 development and the testing of Exim, and to porting it to various operating
199 systems. I am grateful to them all. The distribution now contains a file called
200 <filename>ACKNOWLEDGMENTS</filename>, in which I have started recording the names of
201 contributors.
202 </para>
203 <section id="SECID1">
204 <title>Exim documentation</title>
205 <para revisionflag="changed">
206 <indexterm role="concept">
207 <primary>documentation</primary>
208 </indexterm>
209 This edition of the Exim specification applies to version 4.96.1 of Exim.
210 Substantive changes from the 4.95 edition are marked in some
211 renditions of this document; this paragraph is so marked if the rendition is
212 capable of showing a change indicator.
213 </para>
214 <para>
215 This document is very much a reference manual; it is not a tutorial. The reader
216 is expected to have some familiarity with the SMTP mail transfer protocol and
217 with general Unix system administration. Although there are some discussions
218 and examples in places, the information is mostly organized in a way that makes
219 it easy to look up, rather than in a natural order for sequential reading.
220 Furthermore, this manual aims to cover every aspect of Exim in detail, including
221 a number of rarely-used, special-purpose features that are unlikely to be of
222 very wide interest.
223 </para>
224 <para>
225 <indexterm role="concept">
226 <primary>books about Exim</primary>
227 </indexterm>
228 An <quote>easier</quote> discussion of Exim which provides more in-depth explanatory,
229 introductory, and tutorial material can be found in a book entitled <emphasis>The Exim
230 SMTP Mail Server</emphasis> (second edition, 2007), published by UIT Cambridge
231 (<emphasis role="bold"><ulink url="https://www.uit.co.uk/exim-book/">https://www.uit.co.uk/exim-book/</ulink></emphasis>).
232 </para>
233 <para>
234 The book also contains a chapter that gives a general introduction to SMTP and
235 Internet mail. Inevitably, however, the book is unlikely to be fully up-to-date
236 with the latest release of Exim. (Note that the earlier book about Exim,
237 published by O&#x2019;Reilly, covers Exim 3, and many things have changed in Exim 4.)
238 </para>
239 <para>
240 <indexterm role="concept">
241 <primary>Debian</primary>
242 <secondary>information sources</secondary>
243 </indexterm>
244 If you are using a Debian distribution of Exim, you will find information about
245 Debian-specific features in the file
246 <filename>/usr/share/doc/exim4-base/README.Debian</filename>.
247 The command <command>man update-exim.conf</command> is another source of Debian-specific
248 information.
249 </para>
250 <para>
251 <indexterm role="concept">
252 <primary><filename>doc/NewStuff</filename></primary>
253 </indexterm>
254 <indexterm role="concept">
255 <primary><filename>doc/ChangeLog</filename></primary>
256 </indexterm>
257 <indexterm role="concept">
258 <primary>change log</primary>
259 </indexterm>
260 As Exim develops, there may be features in newer versions that have not
261 yet made it into this document, which is updated only when the most significant
262 digit of the fractional part of the version number changes. Specifications of
263 new features that are not yet in this manual are placed in the file
264 <filename>doc/NewStuff</filename> in the Exim distribution.
265 </para>
266 <para>
267 Some features may be classified as <quote>experimental</quote>. These may change
268 incompatibly while they are developing, or even be withdrawn. For this reason,
269 they are not documented in this manual. Information about experimental features
270 can be found in the file <filename>doc/experimental.txt</filename>.
271 </para>
272 <para>
273 All changes to Exim (whether new features, bug fixes, or other kinds of
274 change) are noted briefly in the file called <filename>doc/ChangeLog</filename>.
275 </para>
276 <para>
277 <indexterm role="concept">
278 <primary><filename>doc/spec.txt</filename></primary>
279 </indexterm>
280 This specification itself is available as an ASCII file in <filename>doc/spec.txt</filename> so
281 that it can easily be searched with a text editor. Other files in the <filename>doc</filename>
282 directory are:
283 </para>
284 <informaltable frame="none">
285 <tgroup cols="2" colsep="0" rowsep="0">
286 <colspec colwidth="100pt" align="left"/>
287 <colspec colwidth="254pt" align="left"/>
288 <tbody>
289 <row>
290 <entry><filename>OptionLists.txt</filename></entry>
291 <entry>list of all options in alphabetical order</entry>
292 </row>
293 <row>
294 <entry><filename>dbm.discuss.txt</filename></entry>
295 <entry>discussion about DBM libraries</entry>
296 </row>
297 <row>
298 <entry><filename>exim.8</filename></entry>
299 <entry>a man page of Exim&#x2019;s command line options</entry>
300 </row>
301 <row>
302 <entry><filename>experimental.txt</filename></entry>
303 <entry>documentation of experimental features</entry>
304 </row>
305 <row>
306 <entry><filename>filter.txt</filename></entry>
307 <entry>specification of the filter language</entry>
308 </row>
309 <row>
310 <entry><filename>Exim3.upgrade</filename></entry>
311 <entry>upgrade notes from release 2 to release 3</entry>
312 </row>
313 <row>
314 <entry><filename>Exim4.upgrade</filename></entry>
315 <entry>upgrade notes from release 3 to release 4</entry>
316 </row>
317 <row>
318 <entry><filename>openssl.txt</filename></entry>
319 <entry>installing a current OpenSSL release</entry>
320 </row>
321 </tbody>
322 </tgroup>
323 </informaltable>
324 <para>
325 The main specification and the specification of the filtering language are also
326 available in other formats (HTML, PostScript, PDF, and Texinfo). Section
327 <xref linkend="SECTavail"/> below tells you how to get hold of these.
328 </para>
329 </section>
330 <section id="SECID2">
331 <title>FTP site and websites</title>
332 <para>
333 <indexterm role="concept">
334 <primary>website</primary>
335 </indexterm>
336 <indexterm role="concept">
337 <primary>FTP site</primary>
338 </indexterm>
339 The primary site for Exim source distributions is the <option>exim.org</option> FTP site,
340 available over HTTPS, HTTP and FTP.  These services, and the <option>exim.org</option>
341 website, are hosted at the University of Cambridge.
342 </para>
343 <para>
344 <indexterm role="concept">
345 <primary>wiki</primary>
346 </indexterm>
347 <indexterm role="concept">
348 <primary>FAQ</primary>
349 </indexterm>
350 As well as Exim distribution tar files, the Exim website contains a number of
351 differently formatted versions of the documentation. A recent addition to the
352 online information is the Exim wiki (<emphasis role="bold"><ulink url="https://wiki.exim.org">https://wiki.exim.org</ulink></emphasis>),
353 which contains what used to be a separate FAQ, as well as various other
354 examples, tips, and know-how that have been contributed by Exim users.
355 The wiki site should always redirect to the correct place, which is currently
356 provided by GitHub, and is open to editing by anyone with a GitHub account.
357 </para>
358 <para>
359 <indexterm role="concept">
360 <primary>Bugzilla</primary>
361 </indexterm>
362 An Exim Bugzilla exists at <emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>. You can use
363 this to report bugs, and also to add items to the wish list. Please search
364 first to check that you are not duplicating a previous entry.
365 Please do not ask for configuration help in the bug-tracker.
366 </para>
367 </section>
368 <section id="SECID3">
369 <title>Mailing lists</title>
370 <para>
371 <indexterm role="concept">
372 <primary>mailing lists</primary>
373 <secondary>for Exim users</secondary>
374 </indexterm>
375 The following Exim mailing lists exist:
376 </para>
377 <informaltable frame="none">
378 <tgroup cols="2" colsep="0" rowsep="0">
379 <colspec colwidth="140pt" align="left"/>
380 <colspec colwidth="254pt" align="left"/>
381 <tbody>
382 <row>
383 <entry><emphasis>exim-announce@exim.org</emphasis></entry>
384 <entry>Moderated, low volume announcements list</entry>
385 </row>
386 <row>
387 <entry><emphasis>exim-users@exim.org</emphasis></entry>
388 <entry>General discussion list</entry>
389 </row>
390 <row>
391 <entry><emphasis>exim-dev@exim.org</emphasis></entry>
392 <entry>Discussion of bugs, enhancements, etc.</entry>
393 </row>
394 <row>
395 <entry><emphasis>exim-cvs@exim.org</emphasis></entry>
396 <entry>Automated commit messages from the VCS</entry>
397 </row>
398 </tbody>
399 </tgroup>
400 </informaltable>
401 <para>
402 You can subscribe to these lists, change your existing subscriptions, and view
403 or search the archives via the mailing lists link on the Exim home page.
404 <indexterm role="concept">
405 <primary>Debian</primary>
406 <secondary>mailing list for</secondary>
407 </indexterm>
408 If you are using a Debian distribution of Exim, you may wish to subscribe to
409 the Debian-specific mailing list <emphasis>pkg-exim4-users@lists.alioth.debian.org</emphasis>
410 via this web page:
411 </para>
412 <literallayout>
413 <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>
414 </literallayout>
415 <para>
416 Please ask Debian-specific questions on that list and not on the general Exim
417 lists.
418 </para>
419 </section>
420 <section id="SECID5">
421 <title>Bug reports</title>
422 <para>
423 <indexterm role="concept">
424 <primary>bug reports</primary>
425 </indexterm>
426 <indexterm role="concept">
427 <primary>reporting bugs</primary>
428 </indexterm>
429 Reports of obvious bugs can be emailed to <emphasis>bugs@exim.org</emphasis> or reported
430 via the Bugzilla (<emphasis role="bold"><ulink url="https://bugs.exim.org">https://bugs.exim.org</ulink></emphasis>). However, if you are unsure
431 whether some behaviour is a bug or not, the best thing to do is to post a
432 message to the <emphasis>exim-dev</emphasis> mailing list and have it discussed.
433 </para>
434 </section>
435 <section id="SECTavail">
436 <title>Where to find the Exim distribution</title>
437 <para>
438 <indexterm role="concept">
439 <primary>FTP site</primary>
440 </indexterm>
441 <indexterm role="concept">
442 <primary>HTTPS download site</primary>
443 </indexterm>
444 <indexterm role="concept">
445 <primary>distribution</primary>
446 <secondary>FTP site</secondary>
447 </indexterm>
448 <indexterm role="concept">
449 <primary>distribution</primary>
450 <secondary>https site</secondary>
451 </indexterm>
452 The master distribution site for the Exim distribution is
453 </para>
454 <literallayout>
455 <emphasis role="bold"><ulink url="https://downloads.exim.org/">https://downloads.exim.org/</ulink></emphasis>
456 </literallayout>
457 <para>
458 The service is available over HTTPS, HTTP and FTP.
459 We encourage people to migrate to HTTPS.
460 </para>
461 <para>
462 The content served at <emphasis role="bold"><ulink url="https://downloads.exim.org/">https://downloads.exim.org/</ulink></emphasis> is identical to the
463 content served at <emphasis role="bold"><ulink url="https://ftp.exim.org/pub/exim">https://ftp.exim.org/pub/exim</ulink></emphasis> and
464 <emphasis role="bold"><ulink url="ftp://ftp.exim.org/pub/exim">ftp://ftp.exim.org/pub/exim</ulink></emphasis>.
465 </para>
466 <para>
467 If accessing via a hostname containing <emphasis>ftp</emphasis>, then the file references that
468 follow are relative to the <filename>exim</filename> directories at these sites.
469 If accessing via the hostname <emphasis>downloads</emphasis> then the subdirectories described
470 here are top-level directories.
471 </para>
472 <para>
473 There are now quite a number of independent mirror sites around
474 the world. Those that I know about are listed in the file called <filename>Mirrors</filename>.
475 </para>
476 <para>
477 Within the top exim directory there are subdirectories called <filename>exim3</filename> (for
478 previous Exim 3 distributions), <filename>exim4</filename> (for the latest Exim 4
479 distributions), and <filename>Testing</filename> for testing versions. In the <filename>exim4</filename>
480 subdirectory, the current release can always be found in files called
481 </para>
482 <literallayout>
483 <filename>exim-n.nn.tar.xz</filename>
484 <filename>exim-n.nn.tar.gz</filename>
485 <filename>exim-n.nn.tar.bz2</filename>
486 </literallayout>
487 <para>
488 where <emphasis>n.nn</emphasis> is the highest such version number in the directory. The three
489 files contain identical data; the only difference is the type of compression.
490 The <filename>.xz</filename> file is usually the smallest, while the <filename>.gz</filename> file is the
491 most portable to old systems.
492 </para>
493 <para>
494 <indexterm role="concept">
495 <primary>distribution</primary>
496 <secondary>signing details</secondary>
497 </indexterm>
498 <indexterm role="concept">
499 <primary>distribution</primary>
500 <secondary>public key</secondary>
501 </indexterm>
502 <indexterm role="concept">
503 <primary>public key for signed distribution</primary>
504 </indexterm>
505 The distributions will be PGP signed by an individual key of the Release
506 Coordinator.  This key will have a uid containing an email address in the
507 <emphasis>exim.org</emphasis> domain and will have signatures from other people, including
508 other Exim maintainers.  We expect that the key will be in the "strong set" of
509 PGP keys.  There should be a trust path to that key from the Exim Maintainer&#x2019;s
510 PGP keys, a version of which can be found in the release directory in the file
511 <filename>Exim-Maintainers-Keyring.asc</filename>.  All keys used will be available in public keyserver pools,
512 such as <emphasis>pool.sks-keyservers.net</emphasis>.
513 </para>
514 <para>
515 At the time of the last update, releases were being made by Jeremy Harris and signed
516 with key <emphasis>0xBCE58C8CE41F32DF</emphasis>.  Other recent keys used for signing are those
517 of Heiko Schlittermann, <emphasis>0x26101B62F69376CE</emphasis>,
518 and of Phil Pennock, <emphasis>0x4D1E900E14C1CC04</emphasis>.
519 </para>
520 <para>
521 The signatures for the tar bundles are in:
522 </para>
523 <literallayout>
524 <filename>exim-n.nn.tar.xz.asc</filename>
525 <filename>exim-n.nn.tar.gz.asc</filename>
526 <filename>exim-n.nn.tar.bz2.asc</filename>
527 </literallayout>
528 <para>
529 For each released version, the log of changes is made available in a
530 separate file in the directory <filename>ChangeLogs</filename> so that it is possible to
531 find out what has changed without having to download the entire distribution.
532 </para>
533 <para>
534 <indexterm role="concept">
535 <primary>documentation</primary>
536 <secondary>available formats</secondary>
537 </indexterm>
538 The main distribution contains ASCII versions of this specification and other
539 documentation; other formats of the documents are available in separate files
540 inside the <filename>exim4</filename> directory of the FTP site:
541 </para>
542 <literallayout>
543 <filename>exim-html-n.nn.tar.gz</filename>
544 <filename>exim-pdf-n.nn.tar.gz</filename>
545 <filename>exim-postscript-n.nn.tar.gz</filename>
546 <filename>exim-texinfo-n.nn.tar.gz</filename>
547 </literallayout>
548 <para>
549 These tar files contain only the <filename>doc</filename> directory, not the complete
550 distribution, and are also available in <filename>.bz2</filename> and <filename>.xz</filename> forms.
551 </para>
552 </section>
553 <section id="SECID6">
554 <title>Limitations</title>
555 <itemizedlist>
556 <listitem>
557 <para>
558 <indexterm role="concept">
559 <primary>limitations of Exim</primary>
560 </indexterm>
561 <indexterm role="concept">
562 <primary>bang paths</primary>
563 <secondary>not handled by Exim</secondary>
564 </indexterm>
565 Exim is designed for use as an Internet MTA, and therefore handles addresses in
566 RFC 2822 domain format only. It cannot handle UUCP <quote>bang paths</quote>, though
567 simple two-component bang paths can be converted by a straightforward rewriting
568 configuration. This restriction does not prevent Exim from being interfaced to
569 UUCP as a transport mechanism, provided that domain addresses are used.
570 </para>
571 </listitem>
572 <listitem>
573 <para>
574 <indexterm role="concept">
575 <primary>domainless addresses</primary>
576 </indexterm>
577 <indexterm role="concept">
578 <primary>address</primary>
579 <secondary>without domain</secondary>
580 </indexterm>
581 Exim insists that every address it handles has a domain attached. For incoming
582 local messages, domainless addresses are automatically qualified with a
583 configured domain value. Configuration options specify from which remote
584 systems unqualified addresses are acceptable. These are then qualified on
585 arrival.
586 </para>
587 </listitem>
588 <listitem>
589 <para>
590 <indexterm role="concept">
591 <primary>transport</primary>
592 <secondary>external</secondary>
593 </indexterm>
594 <indexterm role="concept">
595 <primary>external transports</primary>
596 </indexterm>
597 The only external transport mechanisms that are currently implemented are SMTP
598 and LMTP over a TCP/IP network (including support for IPv6). However, a pipe
599 transport is available, and there are facilities for writing messages to files
600 and pipes, optionally in <emphasis>batched SMTP</emphasis> format; these facilities can be used
601 to send messages to other transport mechanisms such as UUCP, provided they can
602 handle domain-style addresses. Batched SMTP input is also catered for.
603 </para>
604 </listitem>
605 <listitem>
606 <para>
607 Exim is not designed for storing mail for dial-in hosts. When the volumes of
608 such mail are large, it is better to get the messages <quote>delivered</quote> into files
609 (that is, off Exim&#x2019;s queue) and subsequently passed on to the dial-in hosts by
610 other means.
611 </para>
612 </listitem>
613 <listitem>
614 <para>
615 Although Exim does have basic facilities for scanning incoming messages, these
616 are not comprehensive enough to do full virus or spam scanning. Such operations
617 are best carried out using additional specialized software packages. If you
618 compile Exim with the content-scanning extension, straightforward interfaces to
619 a number of common scanners are provided.
620 </para>
621 </listitem>
622 </itemizedlist>
623 </section>
624 <section id="SECID7">
625 <title>Runtime configuration</title>
626 <para>
627 Exim&#x2019;s runtime configuration is held in a single text file that is divided
628 into a number of sections. The entries in this file consist of keywords and
629 values, in the style of Smail 3 configuration files. A default configuration
630 file which is suitable for simple online installations is provided in the
631 distribution, and is described in chapter <xref linkend="CHAPdefconfil"/> below.
632 </para>
633 </section>
634 <section id="SECID8">
635 <title>Calling interface</title>
636 <para>
637 <indexterm role="concept">
638 <primary>Sendmail compatibility</primary>
639 <secondary>command line interface</secondary>
640 </indexterm>
641 Like many MTAs, Exim has adopted the Sendmail command line interface so that it
642 can be a straight replacement for <filename>/usr/lib/sendmail</filename> or
643 <filename>/usr/sbin/sendmail</filename> when sending mail, but you do not need to know anything
644 about Sendmail in order to run Exim. For actions other than sending messages,
645 Sendmail-compatible options also exist, but those that produce output (for
646 example, <option>-bp</option>, which lists the messages in the queue) do so in Exim&#x2019;s own
647 format. There are also some additional options that are compatible with Smail
648 3, and some further options that are new to Exim. Chapter <xref linkend="CHAPcommandline"/>
649 documents all Exim&#x2019;s command line options. This information is automatically
650 made into the man page that forms part of the Exim distribution.
651 </para>
652 <para>
653 Control of messages in the queue can be done via certain privileged command
654 line options. There is also an optional monitor program called <emphasis>eximon</emphasis>,
655 which displays current information in an X window, and which contains a menu
656 interface to Exim&#x2019;s command line administration options.
657 </para>
658 </section>
659 <section id="SECID9">
660 <title>Terminology</title>
661 <para>
662 <indexterm role="concept">
663 <primary>terminology definitions</primary>
664 </indexterm>
665 <indexterm role="concept">
666 <primary>body of message</primary>
667 <secondary>definition of</secondary>
668 </indexterm>
669 The <emphasis>body</emphasis> of a message is the actual data that the sender wants to transmit.
670 It is the last part of a message and is separated from the <emphasis>header</emphasis> (see
671 below) by a blank line.
672 </para>
673 <para>
674 <indexterm role="concept">
675 <primary>bounce message</primary>
676 <secondary>definition of</secondary>
677 </indexterm>
678 When a message cannot be delivered, it is normally returned to the sender in a
679 delivery failure message or a <quote>non-delivery report</quote> (NDR). The term
680 <emphasis>bounce</emphasis> is commonly used for this action, and the error reports are often
681 called <emphasis>bounce messages</emphasis>. This is a convenient shorthand for <quote>delivery
682 failure error report</quote>. Such messages have an empty sender address in the
683 message&#x2019;s <emphasis>envelope</emphasis> (see below) to ensure that they cannot themselves give
684 rise to further bounce messages.
685 </para>
686 <para>
687 The term <emphasis>default</emphasis> appears frequently in this manual. It is used to qualify a
688 value which is used in the absence of any setting in the configuration. It may
689 also qualify an action which is taken unless a configuration setting specifies
690 otherwise.
691 </para>
692 <para>
693 The term <emphasis>defer</emphasis> is used when the delivery of a message to a specific
694 destination cannot immediately take place for some reason (a remote host may be
695 down, or a user&#x2019;s local mailbox may be full). Such deliveries are <emphasis>deferred</emphasis>
696 until a later time.
697 </para>
698 <para>
699 The word <emphasis>domain</emphasis> is sometimes used to mean all but the first component of a
700 host&#x2019;s name. It is <emphasis>not</emphasis> used in that sense here, where it normally refers to
701 the part of an email address following the @ sign.
702 </para>
703 <para>
704 <indexterm role="concept">
705 <primary>envelope, definition of</primary>
706 </indexterm>
707 <indexterm role="concept">
708 <primary>sender</primary>
709 <secondary>definition of</secondary>
710 </indexterm>
711 A message in transit has an associated <emphasis>envelope</emphasis>, as well as a header and a
712 body. The envelope contains a sender address (to which bounce messages should
713 be delivered), and any number of recipient addresses. References to the
714 sender or the recipients of a message usually mean the addresses in the
715 envelope. An MTA uses these addresses for delivery, and for returning bounce
716 messages, not the addresses that appear in the header lines.
717 </para>
718 <para>
719 <indexterm role="concept">
720 <primary>message</primary>
721 <secondary>header, definition of</secondary>
722 </indexterm>
723 <indexterm role="concept">
724 <primary>header section</primary>
725 <secondary>definition of</secondary>
726 </indexterm>
727 The <emphasis>header</emphasis> of a message is the first part of a message&#x2019;s text, consisting
728 of a number of lines, each of which has a name such as <emphasis>From:</emphasis>, <emphasis>To:</emphasis>,
729 <emphasis>Subject:</emphasis>, etc. Long header lines can be split over several text lines by
730 indenting the continuations. The header is separated from the body by a blank
731 line.
732 </para>
733 <para>
734 <indexterm role="concept">
735 <primary>local part</primary>
736 <secondary>definition of</secondary>
737 </indexterm>
738 <indexterm role="concept">
739 <primary>domain</primary>
740 <secondary>definition of</secondary>
741 </indexterm>
742 The term <emphasis>local part</emphasis>, which is taken from RFC 2822, is used to refer to the
743 part of an email address that precedes the @ sign. The part that follows the
744 @ sign is called the <emphasis>domain</emphasis> or <emphasis>mail domain</emphasis>.
745 </para>
746 <para>
747 <indexterm role="concept">
748 <primary>local delivery</primary>
749 <secondary>definition of</secondary>
750 </indexterm>
751 <indexterm role="concept">
752 <primary>remote delivery, definition of</primary>
753 </indexterm>
754 The terms <emphasis>local delivery</emphasis> and <emphasis>remote delivery</emphasis> are used to distinguish
755 delivery to a file or a pipe on the local host from delivery by SMTP over
756 TCP/IP to another host. As far as Exim is concerned, all hosts other than the
757 host it is running on are <emphasis>remote</emphasis>.
758 </para>
759 <para>
760 <indexterm role="concept">
761 <primary>return path</primary>
762 <secondary>definition of</secondary>
763 </indexterm>
764 <emphasis>Return path</emphasis> is another name that is used for the sender address in a
765 message&#x2019;s envelope.
766 </para>
767 <para>
768 <indexterm role="concept">
769 <primary>queue</primary>
770 <secondary>definition of</secondary>
771 </indexterm>
772 The term <emphasis>queue</emphasis> is used to refer to the set of messages awaiting delivery
773 because this term is in widespread use in the context of MTAs. However, in
774 Exim&#x2019;s case, the reality is more like a pool than a queue, because there is
775 normally no ordering of waiting messages.
776 </para>
777 <para>
778 <indexterm role="concept">
779 <primary>queue runner</primary>
780 <secondary>definition of</secondary>
781 </indexterm>
782 The term <emphasis>queue runner</emphasis> is used to describe a process that scans the queue
783 and attempts to deliver those messages whose retry times have come. This term
784 is used by other MTAs and also relates to the command <option>runq</option>, but in Exim
785 the waiting messages are normally processed in an unpredictable order.
786 </para>
787 <para>
788 <indexterm role="concept">
789 <primary>spool directory</primary>
790 <secondary>definition of</secondary>
791 </indexterm>
792 The term <emphasis>spool directory</emphasis> is used for a directory in which Exim keeps the
793 messages in its queue &ndash; that is, those that it is in the process of
794 delivering. This should not be confused with the directory in which local
795 mailboxes are stored, which is called a <quote>spool directory</quote> by some people. In
796 the Exim documentation, <quote>spool</quote> is always used in the first sense.
797 </para>
798 </section>
799 </chapter>
800
801 <chapter id="CHID2">
802 <title>Incorporated code</title>
803 <para>
804 <indexterm role="concept">
805 <primary>incorporated code</primary>
806 </indexterm>
807 <indexterm role="concept">
808 <primary>regular expressions</primary>
809 <secondary>library</secondary>
810 </indexterm>
811 <indexterm role="concept">
812 <primary>PCRE2</primary>
813 </indexterm>
814 <indexterm role="concept">
815 <primary>OpenDMARC</primary>
816 </indexterm>
817 A number of pieces of external code are included in the Exim distribution.
818 </para>
819 <itemizedlist>
820 <listitem>
821 <para>
822 Regular expressions are supported in the main Exim program and in the
823 Exim monitor using the freely-distributable PCRE2 library, copyright
824 &copy; University of Cambridge. The source to PCRE2 is not longer shipped with
825 Exim, so you will need to use the version of PCRE2 shipped with your system,
826 or obtain and install the full version of the library from
827 <emphasis role="bold"><ulink url="https://github.com/PhilipHazel/pcre2/releases">https://github.com/PhilipHazel/pcre2/releases</ulink></emphasis>.
828 </para>
829 </listitem>
830 <listitem>
831 <para>
832 <indexterm role="concept">
833 <primary>cdb</primary>
834 <secondary>acknowledgment</secondary>
835 </indexterm>
836 Support for the cdb (Constant DataBase) lookup method is provided by code
837 contributed by Nigel Metheringham of (at the time he contributed it) Planet
838 Online Ltd. The implementation is completely contained within the code of Exim.
839 It does not link against an external cdb library. The code contains the
840 following statements:
841 </para>
842 <blockquote>
843 <para>
844 Copyright &copy; 1998 Nigel Metheringham, Planet Online Ltd
845 </para>
846 <para>
847 This program is free software; you can redistribute it and/or modify it under
848 the terms of the GNU General Public License as published by the Free Software
849 Foundation; either version 2 of the License, or (at your option) any later
850 version.
851 This code implements Dan Bernstein&#x2019;s Constant DataBase (cdb) spec. Information,
852 the spec and sample code for cdb can be obtained from
853 <emphasis role="bold"><ulink url="https://cr.yp.to/cdb.html">https://cr.yp.to/cdb.html</ulink></emphasis>. This implementation borrows
854 some code from Dan Bernstein&#x2019;s implementation (which has no license
855 restrictions applied to it).
856 </para>
857 </blockquote>
858 </listitem>
859 <listitem>
860 <para>
861 <indexterm role="concept">
862 <primary>SPA authentication</primary>
863 </indexterm>
864 <indexterm role="concept">
865 <primary>Samba project</primary>
866 </indexterm>
867 <indexterm role="concept">
868 <primary>Microsoft Secure Password Authentication</primary>
869 </indexterm>
870 Client support for Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> is provided
871 by code contributed by Marc Prud&#x2019;hommeaux. Server support was contributed by
872 Tom Kistner. This includes code taken from the Samba project, which is released
873 under the Gnu GPL.
874 </para>
875 </listitem>
876 <listitem>
877 <para>
878 <indexterm role="concept">
879 <primary>Cyrus</primary>
880 </indexterm>
881 <indexterm role="concept">
882 <primary><emphasis>pwcheck</emphasis> daemon</primary>
883 </indexterm>
884 <indexterm role="concept">
885 <primary><emphasis>pwauthd</emphasis> daemon</primary>
886 </indexterm>
887 Support for calling the Cyrus <emphasis>pwcheck</emphasis> and <emphasis>saslauthd</emphasis> daemons is provided
888 by code taken from the Cyrus-SASL library and adapted by Alexander S.
889 Sabourenkov. The permission notice appears below, in accordance with the
890 conditions expressed therein.
891 </para>
892 <blockquote>
893 <para>
894 Copyright &copy; 2001 Carnegie Mellon University.  All rights reserved.
895 </para>
896 <para>
897 Redistribution and use in source and binary forms, with or without
898 modification, are permitted provided that the following conditions
899 are met:
900 </para>
901 <orderedlist numeration="arabic">
902 <listitem>
903 <para>
904 Redistributions of source code must retain the above copyright
905 notice, this list of conditions and the following disclaimer.
906 </para>
907 </listitem>
908 <listitem>
909 <para>
910 Redistributions in binary form must reproduce the above copyright
911 notice, this list of conditions and the following disclaimer in
912 the documentation and/or other materials provided with the
913 distribution.
914 </para>
915 </listitem>
916 <listitem>
917 <para>
918 The name <quote>Carnegie Mellon University</quote> must not be used to
919 endorse or promote products derived from this software without
920 prior written permission. For permission or any other legal
921 details, please contact
922 </para>
923 <literallayout>
924               Office of Technology Transfer
925               Carnegie Mellon University
926               5000 Forbes Avenue
927               Pittsburgh, PA  15213-3890
928               (412) 268-4387, fax: (412) 268-7395
929               tech-transfer@andrew.cmu.edu
930 </literallayout>
931 </listitem>
932 <listitem>
933 <para>
934 Redistributions of any form whatsoever must retain the following
935 acknowledgment:
936 </para>
937 <para>
938 <quote>This product includes software developed by Computing Services
939 at Carnegie Mellon University (<emphasis role="bold"><ulink url="https://www.cmu.edu/computing/">https://www.cmu.edu/computing/</ulink></emphasis>.</quote>
940 </para>
941 <para>
942 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
943 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
944 AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
945 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
946 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
947 AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
948 OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
949 </para>
950 </listitem>
951 </orderedlist>
952 </blockquote>
953 </listitem>
954 <listitem>
955 <para>
956 <indexterm role="concept">
957 <primary>Exim monitor</primary>
958 <secondary>acknowledgment</secondary>
959 </indexterm>
960 <indexterm role="concept">
961 <primary>X-windows</primary>
962 </indexterm>
963 <indexterm role="concept">
964 <primary>Athena</primary>
965 </indexterm>
966 The Exim Monitor program, which is an X-Window application, includes
967 modified versions of the Athena StripChart and TextPop widgets.
968 This code is copyright by DEC and MIT, and their permission notice appears
969 below, in accordance with the conditions expressed therein.
970 </para>
971 <blockquote>
972 <para>
973 Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
974 and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
975 </para>
976 <para>
977 All Rights Reserved
978 </para>
979 <para>
980 Permission to use, copy, modify, and distribute this software and its
981 documentation for any purpose and without fee is hereby granted,
982 provided that the above copyright notice appear in all copies and that
983 both that copyright notice and this permission notice appear in
984 supporting documentation, and that the names of Digital or MIT not be
985 used in advertising or publicity pertaining to distribution of the
986 software without specific, written prior permission.
987 </para>
988 <para>
989 DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
990 ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
991 DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
992 ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
993 WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
994 ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
995 SOFTWARE.
996 </para>
997 </blockquote>
998 </listitem>
999 <listitem>
1000 <para>
1001 <indexterm role="concept">
1002 <primary>opendmarc</primary>
1003 <secondary>acknowledgment</secondary>
1004 </indexterm>
1005 The DMARC implementation uses the OpenDMARC library which is Copyrighted by
1006 The Trusted Domain Project. Portions of Exim source which use OpenDMARC
1007 derived code are indicated in the respective source files. The full OpenDMARC
1008 license is provided in the LICENSE.opendmarc file contained in the distributed
1009 source code.
1010 </para>
1011 </listitem>
1012 <listitem>
1013 <para>
1014 Many people have contributed code fragments, some large, some small, that were
1015 not covered by any specific license requirements. It is assumed that the
1016 contributors are happy to see their code incorporated into Exim under the GPL.
1017 </para>
1018 </listitem>
1019 </itemizedlist>
1020 </chapter>
1021
1022 <chapter id="CHID11">
1023 <title>How Exim receives and delivers mail</title>
1024 <titleabbrev>Receiving and delivering mail</titleabbrev>
1025 <section id="SECID10">
1026 <title>Overall philosophy</title>
1027 <para>
1028 <indexterm role="concept">
1029 <primary>design philosophy</primary>
1030 </indexterm>
1031 Exim is designed to work efficiently on systems that are permanently connected
1032 to the Internet and are handling a general mix of mail. In such circumstances,
1033 most messages can be delivered immediately. Consequently, Exim does not
1034 maintain independent queues of messages for specific domains or hosts, though
1035 it does try to send several messages in a single SMTP connection after a host
1036 has been down, and it also maintains per-host retry information.
1037 </para>
1038 </section>
1039 <section id="SECID11">
1040 <title>Policy control</title>
1041 <para>
1042 <indexterm role="concept">
1043 <primary>policy control</primary>
1044 <secondary>overview</secondary>
1045 </indexterm>
1046 Policy controls are now an important feature of MTAs that are connected to the
1047 Internet. Perhaps their most important job is to stop MTAs from being abused as
1048 <quote>open relays</quote> by misguided individuals who send out vast amounts of
1049 unsolicited junk and want to disguise its source. Exim provides flexible
1050 facilities for specifying policy controls on incoming mail:
1051 </para>
1052 <itemizedlist>
1053 <listitem>
1054 <para>
1055 <indexterm role="concept">
1056 <primary>access control lists (ACLs)</primary>
1057 <secondary>introduction</secondary>
1058 </indexterm>
1059 Exim 4 (unlike previous versions of Exim) implements policy controls on
1060 incoming mail by means of <emphasis>Access Control Lists</emphasis> (ACLs). Each list is a
1061 series of statements that may either grant or deny access. ACLs can be used at
1062 several places in the SMTP dialogue while receiving a message from a remote
1063 host. However, the most common places are after each RCPT command, and at the
1064 very end of the message. The sysadmin can specify conditions for accepting or
1065 rejecting individual recipients or the entire message, respectively, at these
1066 two points (see chapter <xref linkend="CHAPACL"/>). Denial of access results in an SMTP
1067 error code.
1068 </para>
1069 </listitem>
1070 <listitem>
1071 <para>
1072 An ACL is also available for locally generated, non-SMTP messages. In this
1073 case, the only available actions are to accept or deny the entire message.
1074 </para>
1075 </listitem>
1076 <listitem>
1077 <para>
1078 When Exim is compiled with the content-scanning extension, facilities are
1079 provided in the ACL mechanism for passing the message to external virus and/or
1080 spam scanning software. The result of such a scan is passed back to the ACL,
1081 which can then use it to decide what to do with the message.
1082 </para>
1083 </listitem>
1084 <listitem>
1085 <para>
1086 When a message has been received, either from a remote host or from the local
1087 host, but before the final acknowledgment has been sent, a locally supplied C
1088 function called <function>local_scan()</function> can be run to inspect the message and decide
1089 whether to accept it or not (see chapter <xref linkend="CHAPlocalscan"/>). If the message
1090 is accepted, the list of recipients can be modified by the function.
1091 </para>
1092 </listitem>
1093 <listitem>
1094 <para>
1095 Using the <function>local_scan()</function> mechanism is another way of calling external scanner
1096 software. The <option>SA-Exim</option> add-on package works this way. It does not require
1097 Exim to be compiled with the content-scanning extension.
1098 </para>
1099 </listitem>
1100 <listitem>
1101 <para>
1102 After a message has been accepted, a further checking mechanism is available in
1103 the form of the <emphasis>system filter</emphasis> (see chapter <xref linkend="CHAPsystemfilter"/>). This
1104 runs at the start of every delivery process.
1105 </para>
1106 </listitem>
1107 </itemizedlist>
1108 </section>
1109 <section id="SECID12">
1110 <title>User filters</title>
1111 <para>
1112 <indexterm role="concept">
1113 <primary>filter</primary>
1114 <secondary>introduction</secondary>
1115 </indexterm>
1116 <indexterm role="concept">
1117 <primary>Sieve filter</primary>
1118 </indexterm>
1119 In a conventional Exim configuration, users are able to run private filters by
1120 setting up appropriate <filename>.forward</filename> files in their home directories. See
1121 chapter <xref linkend="CHAPredirect"/> (about the <command>redirect</command> router) for the
1122 configuration needed to support this, and the separate document entitled
1123 <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis> for user details. Two different kinds
1124 of filtering are available:
1125 </para>
1126 <itemizedlist>
1127 <listitem>
1128 <para>
1129 Sieve filters are written in the standard filtering language that is defined
1130 by RFC 3028.
1131 </para>
1132 </listitem>
1133 <listitem>
1134 <para>
1135 Exim filters are written in a syntax that is unique to Exim, but which is more
1136 powerful than Sieve, which it pre-dates.
1137 </para>
1138 </listitem>
1139 </itemizedlist>
1140 <para>
1141 User filters are run as part of the routing process, described below.
1142 </para>
1143 </section>
1144 <section id="SECTmessiden">
1145 <title>Message identification</title>
1146 <para>
1147 <indexterm role="concept">
1148 <primary>message ids</primary>
1149 <secondary>details of format</secondary>
1150 </indexterm>
1151 <indexterm role="concept">
1152 <primary>format</primary>
1153 <secondary>of message id</secondary>
1154 </indexterm>
1155 <indexterm role="concept">
1156 <primary>id of message</primary>
1157 </indexterm>
1158 <indexterm role="concept">
1159 <primary>base62</primary>
1160 </indexterm>
1161 <indexterm role="concept">
1162 <primary>base36</primary>
1163 </indexterm>
1164 <indexterm role="concept">
1165 <primary>Darwin</primary>
1166 </indexterm>
1167 <indexterm role="concept">
1168 <primary>Cygwin</primary>
1169 </indexterm>
1170 Every message handled by Exim is given a <emphasis>message id</emphasis> which is sixteen
1171 characters long. It is divided into three parts, separated by hyphens, for
1172 example <literal>16VDhn-0001bo-D3</literal>. Each part is a sequence of letters and digits,
1173 normally encoding numbers in base 62. However, in the Darwin operating
1174 system (Mac OS X) and when Exim is compiled to run under Cygwin, base 36
1175 (avoiding the use of lower case letters) is used instead, because the message
1176 id is used to construct filenames, and the names of files in those systems are
1177 not always case-sensitive.
1178 </para>
1179 <para>
1180 <indexterm role="concept">
1181 <primary>pid (process id)</primary>
1182 <secondary>re-use of</secondary>
1183 </indexterm>
1184 The detail of the contents of the message id have changed as Exim has evolved.
1185 Earlier versions relied on the operating system not re-using a process id (pid)
1186 within one second. On modern operating systems, this assumption can no longer
1187 be made, so the algorithm had to be changed. To retain backward compatibility,
1188 the format of the message id was retained, which is why the following rules are
1189 somewhat eccentric:
1190 </para>
1191 <itemizedlist>
1192 <listitem>
1193 <para>
1194 The first six characters of the message id are the time at which the message
1195 started to be received, to a granularity of one second. That is, this field
1196 contains the number of seconds since the start of the epoch (the normal Unix
1197 way of representing the date and time of day).
1198 </para>
1199 </listitem>
1200 <listitem>
1201 <para>
1202 After the first hyphen, the next six characters are the id of the process that
1203 received the message.
1204 </para>
1205 </listitem>
1206 <listitem>
1207 <para>
1208 There are two different possibilities for the final two characters:
1209 </para>
1210 <orderedlist numeration="arabic">
1211 <listitem>
1212 <para>
1213 <indexterm role="option">
1214 <primary><option>localhost_number</option></primary>
1215 </indexterm>
1216 If <option>localhost_number</option> is not set, this value is the fractional part of the
1217 time of reception, normally in units of 1/2000 of a second, but for systems
1218 that must use base 36 instead of base 62 (because of case-insensitive file
1219 systems), the units are 1/1000 of a second.
1220 </para>
1221 </listitem>
1222 <listitem>
1223 <para>
1224 If <option>localhost_number</option> is set, it is multiplied by 200 (100) and added to
1225 the fractional part of the time, which in this case is in units of 1/200
1226 (1/100) of a second.
1227 </para>
1228 </listitem>
1229 </orderedlist>
1230 </listitem>
1231 </itemizedlist>
1232 <para>
1233 After a message has been received, Exim waits for the clock to tick at the
1234 appropriate resolution before proceeding, so that if another message is
1235 received by the same process, or by another process with the same (re-used)
1236 pid, it is guaranteed that the time will be different. In most cases, the clock
1237 will already have ticked while the message was being received.
1238 </para>
1239 </section>
1240 <section id="SECID13">
1241 <title>Receiving mail</title>
1242 <para>
1243 <indexterm role="concept">
1244 <primary>receiving mail</primary>
1245 </indexterm>
1246 <indexterm role="concept">
1247 <primary>message</primary>
1248 <secondary>reception</secondary>
1249 </indexterm>
1250 The only way Exim can receive mail from another host is using SMTP over
1251 TCP/IP, in which case the sender and recipient addresses are transferred using
1252 SMTP commands. However, from a locally running process (such as a user&#x2019;s MUA),
1253 there are several possibilities:
1254 </para>
1255 <itemizedlist>
1256 <listitem>
1257 <para>
1258 If the process runs Exim with the <option>-bm</option> option, the message is read
1259 non-interactively (usually via a pipe), with the recipients taken from the
1260 command line, or from the body of the message if <option>-t</option> is also used.
1261 </para>
1262 </listitem>
1263 <listitem>
1264 <para>
1265 If the process runs Exim with the <option>-bS</option> option, the message is also read
1266 non-interactively, but in this case the recipients are listed at the start of
1267 the message in a series of SMTP RCPT commands, terminated by a DATA
1268 command. This is called <quote>batch SMTP</quote> format,
1269 but it isn&#x2019;t really SMTP. The SMTP commands are just another way of passing
1270 envelope addresses in a non-interactive submission.
1271 </para>
1272 </listitem>
1273 <listitem>
1274 <para>
1275 If the process runs Exim with the <option>-bs</option> option, the message is read
1276 interactively, using the SMTP protocol. A two-way pipe is normally used for
1277 passing data between the local process and the Exim process.
1278 This is <quote>real</quote> SMTP and is handled in the same way as SMTP over TCP/IP. For
1279 example, the ACLs for SMTP commands are used for this form of submission.
1280 </para>
1281 </listitem>
1282 <listitem>
1283 <para>
1284 A local process may also make a TCP/IP call to the host&#x2019;s loopback address
1285 (127.0.0.1) or any other of its IP addresses. When receiving messages, Exim
1286 does not treat the loopback address specially. It treats all such connections
1287 in the same way as connections from other hosts.
1288 </para>
1289 </listitem>
1290 </itemizedlist>
1291 <para>
1292 <indexterm role="concept">
1293 <primary>message sender, constructed by Exim</primary>
1294 </indexterm>
1295 <indexterm role="concept">
1296 <primary>sender</primary>
1297 <secondary>constructed by Exim</secondary>
1298 </indexterm>
1299 In the three cases that do not involve TCP/IP, the sender address is
1300 constructed from the login name of the user that called Exim and a default
1301 qualification domain (which can be set by the <option>qualify_domain</option> configuration
1302 option). For local or batch SMTP, a sender address that is passed using the
1303 SMTP MAIL command is ignored. However, the system administrator may allow
1304 certain users (<quote>trusted users</quote>) to specify a different sender addresses
1305 unconditionally, or all users to specify certain forms of different sender
1306 address. The <option>-f</option> option or the SMTP MAIL command is used to specify these
1307 different addresses. See section <xref linkend="SECTtrustedadmin"/> for details of trusted
1308 users, and the <option>untrusted_set_sender</option> option for a way of allowing untrusted
1309 users to change sender addresses.
1310 </para>
1311 <para>
1312 Messages received by either of the non-interactive mechanisms are subject to
1313 checking by the non-SMTP ACL if one is defined. Messages received using SMTP
1314 (either over TCP/IP or interacting with a local process) can be checked by a
1315 number of ACLs that operate at different times during the SMTP session. Either
1316 individual recipients or the entire message can be rejected if local policy
1317 requirements are not met. The <function>local_scan()</function> function (see chapter
1318 <xref linkend="CHAPlocalscan"/>) is run for all incoming messages.
1319 </para>
1320 <para>
1321 Exim can be configured not to start a delivery process when a message is
1322 received; this can be unconditional, or depend on the number of incoming SMTP
1323 connections or the system load. In these situations, new messages wait on the
1324 queue until a queue runner process picks them up. However, in standard
1325 configurations under normal conditions, delivery is started as soon as a
1326 message is received.
1327 </para>
1328 </section>
1329 <section id="SECID14">
1330 <title>Handling an incoming message</title>
1331 <para>
1332 <indexterm role="concept">
1333 <primary>spool directory</primary>
1334 <secondary>files that hold a message</secondary>
1335 </indexterm>
1336 <indexterm role="concept">
1337 <primary>file</primary>
1338 <secondary>how a message is held</secondary>
1339 </indexterm>
1340 When Exim accepts a message, it writes two files in its spool directory. The
1341 first contains the envelope information, the current status of the message, and
1342 the header lines, and the second contains the body of the message. The names of
1343 the two spool files consist of the message id, followed by <literal>-H</literal> for the
1344 file containing the envelope and header, and <literal>-D</literal> for the data file.
1345 </para>
1346 <para>
1347 <indexterm role="concept">
1348 <primary>spool directory</primary>
1349 <secondary><filename>input</filename> sub-directory</secondary>
1350 </indexterm>
1351 By default, all these message files are held in a single directory called
1352 <filename>input</filename> inside the general Exim spool directory. Some operating systems do
1353 not perform very well if the number of files in a directory gets large; to
1354 improve performance in such cases, the <option>split_spool_directory</option> option can be
1355 used. This causes Exim to split up the input files into 62 sub-directories
1356 whose names are single letters or digits. When this is done, the queue is
1357 processed one sub-directory at a time instead of all at once, which can improve
1358 overall performance even when there are not enough files in each directory to
1359 affect file system performance.
1360 </para>
1361 <para>
1362 The envelope information consists of the address of the message&#x2019;s sender and
1363 the addresses of the recipients. This information is entirely separate from
1364 any addresses contained in the header lines. The status of the message includes
1365 a list of recipients who have already received the message. The format of the
1366 first spool file is described in chapter <xref linkend="CHAPspool"/>.
1367 </para>
1368 <para>
1369 <indexterm role="concept">
1370 <primary>rewriting</primary>
1371 <secondary>addresses</secondary>
1372 </indexterm>
1373 Address rewriting that is specified in the rewrite section of the configuration
1374 (see chapter <xref linkend="CHAPrewrite"/>) is done once and for all on incoming addresses,
1375 both in the header lines and the envelope, at the time the message is accepted.
1376 If during the course of delivery additional addresses are generated (for
1377 example, via aliasing), these new addresses are rewritten as soon as they are
1378 generated. At the time a message is actually delivered (transported) further
1379 rewriting can take place; because this is a transport option, it can be
1380 different for different forms of delivery. It is also possible to specify the
1381 addition or removal of certain header lines at the time the message is
1382 delivered (see chapters <xref linkend="CHAProutergeneric"/> and
1383 <xref linkend="CHAPtransportgeneric"/>).
1384 </para>
1385 </section>
1386 <section id="SECID15">
1387 <title>Life of a message</title>
1388 <para>
1389 <indexterm role="concept">
1390 <primary>message</primary>
1391 <secondary>life of</secondary>
1392 </indexterm>
1393 <indexterm role="concept">
1394 <primary>message</primary>
1395 <secondary>frozen</secondary>
1396 </indexterm>
1397 A message remains in the spool directory until it is completely delivered to
1398 its recipients or to an error address, or until it is deleted by an
1399 administrator or by the user who originally created it. In cases when delivery
1400 cannot proceed &ndash; for example when a message can neither be delivered to its
1401 recipients nor returned to its sender, the message is marked <quote>frozen</quote> on the
1402 spool, and no more deliveries are attempted.
1403 </para>
1404 <para>
1405 <indexterm role="concept">
1406 <primary>frozen messages</primary>
1407 <secondary>thawing</secondary>
1408 </indexterm>
1409 <indexterm role="concept">
1410 <primary>message</primary>
1411 <secondary>thawing frozen</secondary>
1412 </indexterm>
1413 An administrator can <quote>thaw</quote> such messages when the problem has been
1414 corrected, and can also freeze individual messages by hand if necessary. In
1415 addition, an administrator can force a delivery error, causing a bounce message
1416 to be sent.
1417 </para>
1418 <para>
1419 <indexterm role="option">
1420 <primary><option>timeout_frozen_after</option></primary>
1421 </indexterm>
1422 <indexterm role="option">
1423 <primary><option>ignore_bounce_errors_after</option></primary>
1424 </indexterm>
1425 There are options called <option>ignore_bounce_errors_after</option> and
1426 <option>timeout_frozen_after</option>, which discard frozen messages after a certain time.
1427 The first applies only to frozen bounces, the second to all frozen messages.
1428 </para>
1429 <para>
1430 <indexterm role="concept">
1431 <primary>message</primary>
1432 <secondary>log file for</secondary>
1433 </indexterm>
1434 <indexterm role="concept">
1435 <primary>log</primary>
1436 <secondary>file for each message</secondary>
1437 </indexterm>
1438 While Exim is working on a message, it writes information about each delivery
1439 attempt to its main log file. This includes successful, unsuccessful, and
1440 delayed deliveries for each recipient (see chapter <xref linkend="CHAPlog"/>). The log
1441 lines are also written to a separate <emphasis>message log</emphasis> file for each message.
1442 These logs are solely for the benefit of the administrator and are normally
1443 deleted along with the spool files when processing of a message is complete.
1444 The use of individual message logs can be disabled by setting
1445 <option>no_message_logs</option>; this might give an improvement in performance on very busy
1446 systems.
1447 </para>
1448 <para>
1449 <indexterm role="concept">
1450 <primary>journal file</primary>
1451 </indexterm>
1452 <indexterm role="concept">
1453 <primary>file</primary>
1454 <secondary>journal</secondary>
1455 </indexterm>
1456 All the information Exim itself needs to set up a delivery is kept in the first
1457 spool file, along with the header lines. When a successful delivery occurs, the
1458 address is immediately written at the end of a journal file, whose name is the
1459 message id followed by <literal>-J</literal>. At the end of a delivery run, if there are some
1460 addresses left to be tried again later, the first spool file (the <literal>-H</literal> file)
1461 is updated to indicate which these are, and the journal file is then deleted.
1462 Updating the spool file is done by writing a new file and renaming it, to
1463 minimize the possibility of data loss.
1464 </para>
1465 <para>
1466 Should the system or Exim crash after a successful delivery but before
1467 the spool file has been updated, the journal is left lying around. The next
1468 time Exim attempts to deliver the message, it reads the journal file and
1469 updates the spool file before proceeding. This minimizes the chances of double
1470 deliveries caused by crashes.
1471 </para>
1472 </section>
1473 <section id="SECTprocaddress">
1474 <title>Processing an address for delivery</title>
1475 <para>
1476 <indexterm role="concept">
1477 <primary>drivers</primary>
1478 <secondary>definition of</secondary>
1479 </indexterm>
1480 <indexterm role="concept">
1481 <primary>router</primary>
1482 <secondary>definition of</secondary>
1483 </indexterm>
1484 <indexterm role="concept">
1485 <primary>transport</primary>
1486 <secondary>definition of</secondary>
1487 </indexterm>
1488 The main delivery processing elements of Exim are called <emphasis>routers</emphasis> and
1489 <emphasis>transports</emphasis>, and collectively these are known as <emphasis>drivers</emphasis>. Code for a
1490 number of them is provided in the source distribution, and compile-time options
1491 specify which ones are included in the binary. Runtime options specify which
1492 ones are actually used for delivering messages.
1493 </para>
1494 <para>
1495 <indexterm role="concept">
1496 <primary>drivers</primary>
1497 <secondary>instance definition</secondary>
1498 </indexterm>
1499 Each driver that is specified in the runtime configuration is an <emphasis>instance</emphasis>
1500 of that particular driver type. Multiple instances are allowed; for example,
1501 you can set up several different <command>smtp</command> transports, each with different
1502 option values that might specify different ports or different timeouts. Each
1503 instance has its own identifying name. In what follows we will normally use the
1504 instance name when discussing one particular instance (that is, one specific
1505 configuration of the driver), and the generic driver name when discussing
1506 the driver&#x2019;s features in general.
1507 </para>
1508 <para>
1509 A <emphasis>router</emphasis> is a driver that operates on an address, either determining how
1510 its delivery should happen, by assigning it to a specific transport, or
1511 converting the address into one or more new addresses (for example, via an
1512 alias file). A router may also explicitly choose to fail an address, causing it
1513 to be bounced.
1514 </para>
1515 <para>
1516 A <emphasis>transport</emphasis> is a driver that transmits a copy of the message from Exim&#x2019;s
1517 spool to some destination. There are two kinds of transport: for a <emphasis>local</emphasis>
1518 transport, the destination is a file or a pipe on the local host, whereas for a
1519 <emphasis>remote</emphasis> transport the destination is some other host. A message is passed
1520 to a specific transport as a result of successful routing. If a message has
1521 several recipients, it may be passed to a number of different transports.
1522 </para>
1523 <para>
1524 <indexterm role="concept">
1525 <primary>preconditions</primary>
1526 <secondary>definition of</secondary>
1527 </indexterm>
1528 An address is processed by passing it to each configured router instance in
1529 turn, subject to certain preconditions, until a router accepts the address or
1530 specifies that it should be bounced. We will describe this process in more
1531 detail shortly. First, as a simple example, we consider how each recipient
1532 address in a message is processed in a small configuration of three routers.
1533 </para>
1534 <para>
1535 To make this a more concrete example, it is described in terms of some actual
1536 routers, but remember, this is only an example. You can configure Exim&#x2019;s
1537 routers in many different ways, and there may be any number of routers in a
1538 configuration.
1539 </para>
1540 <para>
1541 The first router that is specified in a configuration is often one that handles
1542 addresses in domains that are not recognized specifically by the local host.
1543 Typically these are addresses for arbitrary domains on the Internet. A precondition
1544 is set up which looks for the special domains known to the host (for example,
1545 its own domain name), and the router is run for addresses that do <emphasis>not</emphasis>
1546 match. Typically, this is a router that looks up domains in the DNS in order to
1547 find the hosts to which this address routes. If it succeeds, the address is
1548 assigned to a suitable SMTP transport; if it does not succeed, the router is
1549 configured to fail the address.
1550 </para>
1551 <para>
1552 The second router is reached only when the domain is recognized as one that
1553 <quote>belongs</quote> to the local host. This router does redirection &ndash; also known as
1554 aliasing and forwarding. When it generates one or more new addresses from the
1555 original, each of them is routed independently from the start. Otherwise, the
1556 router may cause an address to fail, or it may simply decline to handle the
1557 address, in which case the address is passed to the next router.
1558 </para>
1559 <para>
1560 The final router in many configurations is one that checks to see if the
1561 address belongs to a local mailbox. The precondition may involve a check to
1562 see if the local part is the name of a login account, or it may look up the
1563 local part in a file or a database. If its preconditions are not met, or if
1564 the router declines, we have reached the end of the routers. When this happens,
1565 the address is bounced.
1566 </para>
1567 </section>
1568 <section id="SECID16">
1569 <title>Processing an address for verification</title>
1570 <para>
1571 <indexterm role="concept">
1572 <primary>router</primary>
1573 <secondary>for verification</secondary>
1574 </indexterm>
1575 <indexterm role="concept">
1576 <primary>verifying address</primary>
1577 <secondary>overview</secondary>
1578 </indexterm>
1579 As well as being used to decide how to deliver to an address, Exim&#x2019;s routers
1580 are also used for <emphasis>address verification</emphasis>. Verification can be requested as
1581 one of the checks to be performed in an ACL for incoming messages, on both
1582 sender and recipient addresses, and it can be tested using the <option>-bv</option> and
1583 <option>-bvs</option> command line options.
1584 </para>
1585 <para>
1586 When an address is being verified, the routers are run in <quote>verify mode</quote>. This
1587 does not affect the way the routers work, but it is a state that can be
1588 detected. By this means, a router can be skipped or made to behave differently
1589 when verifying. A common example is a configuration in which the first router
1590 sends all messages to a message-scanning program unless they have been
1591 previously scanned. Thus, the first router accepts all addresses without any
1592 checking, making it useless for verifying. Normally, the <option>no_verify</option> option
1593 would be set for such a router, causing it to be skipped in verify mode.
1594 </para>
1595 </section>
1596 <section id="SECTrunindrou">
1597 <title>Running an individual router</title>
1598 <para>
1599 <indexterm role="concept">
1600 <primary>router</primary>
1601 <secondary>running details</secondary>
1602 </indexterm>
1603 <indexterm role="concept">
1604 <primary>preconditions</primary>
1605 <secondary>checking</secondary>
1606 </indexterm>
1607 <indexterm role="concept">
1608 <primary>router</primary>
1609 <secondary>result of running</secondary>
1610 </indexterm>
1611 As explained in the example above, a number of preconditions are checked before
1612 running a router. If any are not met, the router is skipped, and the address is
1613 passed to the next router. When all the preconditions on a router <emphasis>are</emphasis> met,
1614 the router is run. What happens next depends on the outcome, which is one of
1615 the following:
1616 </para>
1617 <itemizedlist>
1618 <listitem>
1619 <para>
1620 <emphasis>accept</emphasis>: The router accepts the address, and either assigns it to a
1621 transport or generates one or more <quote>child</quote> addresses. Processing the
1622 original address ceases
1623 <indexterm role="option">
1624 <primary><option>unseen</option></primary>
1625 </indexterm>
1626 unless the <option>unseen</option> option is set on the router. This option
1627 can be used to set up multiple deliveries with different routing (for example,
1628 for keeping archive copies of messages). When <option>unseen</option> is set, the address is
1629 passed to the next router. Normally, however, an <emphasis>accept</emphasis> return marks the
1630 end of routing.
1631 </para>
1632 <para>
1633 Any child addresses generated by the router are processed independently,
1634 starting with the first router by default. It is possible to change this by
1635 setting the <option>redirect_router</option> option to specify which router to start at for
1636 child addresses. Unlike <option>pass_router</option> (see below) the router specified by
1637 <option>redirect_router</option> may be anywhere in the router configuration.
1638 </para>
1639 </listitem>
1640 <listitem>
1641 <para>
1642 <emphasis>pass</emphasis>: The router recognizes the address, but cannot handle it itself. It
1643 requests that the address be passed to another router. By default, the address
1644 is passed to the next router, but this can be changed by setting the
1645 <option>pass_router</option> option. However, (unlike <option>redirect_router</option>) the named router
1646 must be below the current router (to avoid loops).
1647 </para>
1648 </listitem>
1649 <listitem>
1650 <para>
1651 <emphasis>decline</emphasis>: The router declines to accept the address because it does not
1652 recognize it at all. By default, the address is passed to the next router, but
1653 this can be prevented by setting the <option>no_more</option> option. When <option>no_more</option> is
1654 set, all the remaining routers are skipped. In effect, <option>no_more</option> converts
1655 <emphasis>decline</emphasis> into <emphasis>fail</emphasis>.
1656 </para>
1657 </listitem>
1658 <listitem>
1659 <para>
1660 <emphasis>fail</emphasis>: The router determines that the address should fail, and queues it for
1661 the generation of a bounce message. There is no further processing of the
1662 original address unless <option>unseen</option> is set on the router.
1663 </para>
1664 </listitem>
1665 <listitem>
1666 <para>
1667 <emphasis>defer</emphasis>: The router cannot handle the address at the present time. (A
1668 database may be offline, or a DNS lookup may have timed out.) No further
1669 processing of the address happens in this delivery attempt. It is tried again
1670 next time the message is considered for delivery.
1671 </para>
1672 </listitem>
1673 <listitem>
1674 <para>
1675 <emphasis>error</emphasis>: There is some error in the router (for example, a syntax error in
1676 its configuration). The action is as for defer.
1677 </para>
1678 </listitem>
1679 </itemizedlist>
1680 <para>
1681 If an address reaches the end of the routers without having been accepted by
1682 any of them, it is bounced as unrouteable. The default error message in this
1683 situation is <quote>unrouteable address</quote>, but you can set your own message by
1684 making use of the <option>cannot_route_message</option> option. This can be set for any
1685 router; the value from the last router that <quote>saw</quote> the address is used.
1686 </para>
1687 <para>
1688 Sometimes while routing you want to fail a delivery when some conditions are
1689 met but others are not, instead of passing the address on for further routing.
1690 You can do this by having a second router that explicitly fails the delivery
1691 when the relevant conditions are met. The <command>redirect</command> router has a <quote>fail</quote>
1692 facility for this purpose.
1693 </para>
1694 </section>
1695 <section id="SECID17">
1696 <title>Duplicate addresses</title>
1697 <para>
1698 <indexterm role="concept">
1699 <primary>case of local parts</primary>
1700 </indexterm>
1701 <indexterm role="concept">
1702 <primary>address duplicate, discarding</primary>
1703 </indexterm>
1704 <indexterm role="concept">
1705 <primary>duplicate addresses</primary>
1706 </indexterm>
1707 Once routing is complete, Exim scans the addresses that are assigned to local
1708 and remote transports and discards any duplicates that it finds. During this
1709 check, local parts are treated case-sensitively. This happens only when
1710 actually delivering a message; when testing routers with <option>-bt</option>, all the
1711 routed addresses are shown.
1712 </para>
1713 </section>
1714 <section id="SECTrouprecon">
1715 <title>Router preconditions</title>
1716 <para>
1717 <indexterm role="concept">
1718 <primary>router</primary>
1719 <secondary>preconditions, order of processing</secondary>
1720 </indexterm>
1721 <indexterm role="concept">
1722 <primary>preconditions</primary>
1723 <secondary>order of processing</secondary>
1724 </indexterm>
1725 The preconditions that are tested for each router are listed below, in the
1726 order in which they are tested. The individual configuration options are
1727 described in more detail in chapter <xref linkend="CHAProutergeneric"/>.
1728 </para>
1729 <itemizedlist>
1730 <listitem>
1731 <para>
1732 <indexterm role="concept">
1733 <primary>affix</primary>
1734 <secondary>router precondition</secondary>
1735 </indexterm>
1736 The <option>local_part_prefix</option> and <option>local_part_suffix</option> options can specify that
1737 the local parts handled by the router may or must have certain prefixes and/or
1738 suffixes. If a mandatory affix (prefix or suffix) is not present, the router is
1739 skipped. These conditions are tested first. When an affix is present, it is
1740 removed from the local part before further processing, including the evaluation
1741 of any other conditions.
1742 </para>
1743 </listitem>
1744 <listitem>
1745 <para>
1746 Routers can be designated for use only when not verifying an address, that is,
1747 only when routing it for delivery (or testing its delivery routing). If the
1748 <option>verify</option> option is set false, the router is skipped when Exim is verifying an
1749 address.
1750 Setting the <option>verify</option> option actually sets two options, <option>verify_sender</option> and
1751 <option>verify_recipient</option>, which independently control the use of the router for
1752 sender and recipient verification. You can set these options directly if
1753 you want a router to be used for only one type of verification.
1754 Note that cutthrough delivery is classed as a recipient verification for this purpose.
1755 </para>
1756 </listitem>
1757 <listitem>
1758 <para>
1759 If the <option>address_test</option> option is set false, the router is skipped when Exim is
1760 run with the <option>-bt</option> option to test an address routing. This can be helpful
1761 when the first router sends all new messages to a scanner of some sort; it
1762 makes it possible to use <option>-bt</option> to test subsequent delivery routing without
1763 having to simulate the effect of the scanner.
1764 </para>
1765 </listitem>
1766 <listitem>
1767 <para>
1768 Routers can be designated for use only when verifying an address, as
1769 opposed to routing it for delivery. The <option>verify_only</option> option controls this.
1770 Again, cutthrough delivery counts as a verification.
1771 </para>
1772 </listitem>
1773 <listitem>
1774 <para>
1775 Individual routers can be explicitly skipped when running the routers to
1776 check an address given in the SMTP EXPN command (see the <option>expn</option> option).
1777 </para>
1778 </listitem>
1779 <listitem>
1780 <para>
1781 If the <option>domains</option> option is set, the domain of the address must be in the set
1782 of domains that it defines.
1783 <indexterm role="concept">
1784 <primary>tainted data</primary>
1785 <secondary>de-tainting</secondary>
1786 </indexterm>
1787 <indexterm role="concept">
1788 <primary>de-tainting</primary>
1789 <secondary>using router domains option</secondary>
1790 </indexterm>
1791 A match verifies the variable <varname>$domain</varname> (which carries tainted data)
1792 and assigns an untainted value to the <varname>$domain_data</varname> variable.
1793 Such an untainted value is often needed in the transport.
1794 For specifics of the matching operation and the resulting untainted value,
1795 refer to section <xref linkend="SECTdomainlist"/>.
1796 </para>
1797 <para>
1798 When an untainted value is wanted, use this option
1799 rather than the generic <option>condition</option> option.
1800 </para>
1801 </listitem>
1802 <listitem>
1803 <para>
1804 <indexterm role="variable">
1805 <primary><varname>$local_part_prefix</varname></primary>
1806 </indexterm>
1807 <indexterm role="variable">
1808 <primary><varname>$local_part_prefix_v</varname></primary>
1809 </indexterm>
1810 <indexterm role="variable">
1811 <primary><varname>$local_part</varname></primary>
1812 </indexterm>
1813 <indexterm role="variable">
1814 <primary><varname>$local_part_suffix</varname></primary>
1815 </indexterm>
1816 <indexterm role="variable">
1817 <primary><varname>$local_part_suffix_v</varname></primary>
1818 </indexterm>
1819 <indexterm role="concept">
1820 <primary>affix</primary>
1821 <secondary>router precondition</secondary>
1822 </indexterm>
1823 If the <option>local_parts</option> option is set, the local part of the address must be in
1824 the set of local parts that it defines.
1825 A match verifies the variable <varname>$local_part</varname> (which carries tainted data)
1826 and assigns an untainted value to the <varname>$local_part_data</varname> variable.
1827 Such an untainted value is often needed in the transport.
1828 For specifics of the matching operation and the resulting untainted value,
1829 refer to section <xref linkend="SECTlocparlis"/>.
1830 </para>
1831 <para>
1832 When an untainted value is wanted, use this option
1833 rather than the generic <option>condition</option> option.
1834 </para>
1835 <para>
1836 If <option>local_part_prefix</option> or
1837 <option>local_part_suffix</option> is in use, the prefix or suffix is removed from the local
1838 part before this check. If you want to do precondition tests on local parts
1839 that include affixes, you can do so by using a <option>condition</option> option (see below)
1840 that uses the variables <varname>$local_part</varname>, <varname>$local_part_prefix</varname>,
1841 <varname>$local_part_prefix_v</varname>, <varname>$local_part_suffix</varname>
1842 and <varname>$local_part_suffix_v</varname> as necessary.
1843 </para>
1844 </listitem>
1845 <listitem>
1846 <para>
1847 <indexterm role="variable">
1848 <primary><varname>$local_user_uid</varname></primary>
1849 </indexterm>
1850 <indexterm role="variable">
1851 <primary><varname>$local_user_gid</varname></primary>
1852 </indexterm>
1853 <indexterm role="variable">
1854 <primary><varname>$home</varname></primary>
1855 </indexterm>
1856 If the <option>check_local_user</option> option is set, the local part must be the name of
1857 an account on the local host. If this check succeeds, the uid and gid of the
1858 local user are placed in <varname>$local_user_uid</varname> and <varname>$local_user_gid</varname> and the
1859 user&#x2019;s home directory is placed in <varname>$home</varname>; these values can be used in the
1860 remaining preconditions.
1861 </para>
1862 </listitem>
1863 <listitem>
1864 <para>
1865 If the <option>router_home_directory</option> option is set, it is expanded at this point,
1866 because it overrides the value of <varname>$home</varname>. If this expansion were left till
1867 later, the value of <varname>$home</varname> as set by <option>check_local_user</option> would be used in
1868 subsequent tests. Having two different values of <varname>$home</varname> in the same router
1869 could lead to confusion.
1870 </para>
1871 </listitem>
1872 <listitem>
1873 <para>
1874 If the <option>senders</option> option is set, the envelope sender address must be in the
1875 set of addresses that it defines.
1876 </para>
1877 </listitem>
1878 <listitem>
1879 <para>
1880 If the <option>require_files</option> option is set, the existence or non-existence of
1881 specified files is tested.
1882 </para>
1883 </listitem>
1884 <listitem>
1885 <para>
1886 <indexterm role="concept">
1887 <primary>customizing</primary>
1888 <secondary>precondition</secondary>
1889 </indexterm>
1890 If the <option>condition</option> option is set, it is evaluated and tested. This option
1891 uses an expanded string to allow you to set up your own custom preconditions.
1892 Expanded strings are described in chapter <xref linkend="CHAPexpand"/>.
1893 </para>
1894 <para>
1895 Note that while using
1896 this option for address matching technically works,
1897 it does not set any de-tainted values.
1898 Such values are often needed, either for router-specific options or
1899 for transport options.
1900 Using the <option>domains</option> and <option>local_parts</option> options is usually the most
1901 convenient way to obtain them.
1902 </para>
1903 </listitem>
1904 </itemizedlist>
1905 <para>
1906 Note that <option>require_files</option> comes near the end of the list, so you cannot use
1907 it to check for the existence of a file in which to lookup up a domain, local
1908 part, or sender. However, as these options are all expanded, you can use the
1909 <option>exists</option> expansion condition to make such tests within each condition. The
1910 <option>require_files</option> option is intended for checking files that the router may be
1911 going to use internally, or which are needed by a specific transport (for
1912 example, <filename>.procmailrc</filename>).
1913 </para>
1914 </section>
1915 <section id="SECID18">
1916 <title>Delivery in detail</title>
1917 <para>
1918 <indexterm role="concept">
1919 <primary>delivery</primary>
1920 <secondary>in detail</secondary>
1921 </indexterm>
1922 When a message is to be delivered, the sequence of events is as follows:
1923 </para>
1924 <itemizedlist>
1925 <listitem>
1926 <para>
1927 If a system-wide filter file is specified, the message is passed to it. The
1928 filter may add recipients to the message, replace the recipients, discard the
1929 message, cause a new message to be generated, or cause the message delivery to
1930 fail. The format of the system filter file is the same as for Exim user filter
1931 files, described in the separate document entitled <emphasis>Exim&#x2019;s interfaces to mail
1932 filtering</emphasis>.
1933 <indexterm role="concept">
1934 <primary>Sieve filter</primary>
1935 <secondary>not available for system filter</secondary>
1936 </indexterm>
1937 (<emphasis role="bold">Note</emphasis>: Sieve cannot be used for system filter files.)
1938 </para>
1939 <para>
1940 Some additional features are available in system filters &ndash; see chapter
1941 <xref linkend="CHAPsystemfilter"/> for details. Note that a message is passed to the system
1942 filter only once per delivery attempt, however many recipients it has. However,
1943 if there are several delivery attempts because one or more addresses could not
1944 be immediately delivered, the system filter is run each time. The filter
1945 condition <option>first_delivery</option> can be used to detect the first run of the system
1946 filter.
1947 </para>
1948 </listitem>
1949 <listitem>
1950 <para>
1951 Each recipient address is offered to each configured router, in turn, subject to
1952 its preconditions, until one is able to handle it. If no router can handle the
1953 address, that is, if they all decline, the address is failed. Because routers
1954 can be targeted at particular domains, several locally handled domains can be
1955 processed entirely independently of each other.
1956 </para>
1957 </listitem>
1958 <listitem>
1959 <para>
1960 <indexterm role="concept">
1961 <primary>routing</primary>
1962 <secondary>loops in</secondary>
1963 </indexterm>
1964 <indexterm role="concept">
1965 <primary>loop</primary>
1966 <secondary>while routing</secondary>
1967 </indexterm>
1968 A router that accepts an address may assign it to a local or a remote
1969 transport. However, the transport is not run at this time. Instead, the address
1970 is placed on a list for the particular transport, which will be run later.
1971 Alternatively, the router may generate one or more new addresses (typically
1972 from alias, forward, or filter files). New addresses are fed back into this
1973 process from the top, but in order to avoid loops, a router ignores any address
1974 which has an identically-named ancestor that was processed by itself.
1975 </para>
1976 </listitem>
1977 <listitem>
1978 <para>
1979 When all the routing has been done, addresses that have been successfully
1980 handled are passed to their assigned transports. When local transports are
1981 doing real local deliveries, they handle only one address at a time, but if a
1982 local transport is being used as a pseudo-remote transport (for example, to
1983 collect batched SMTP messages for transmission by some other means) multiple
1984 addresses can be handled. Remote transports can always handle more than one
1985 address at a time, but can be configured not to do so, or to restrict multiple
1986 addresses to the same domain.
1987 </para>
1988 </listitem>
1989 <listitem>
1990 <para>
1991 Each local delivery to a file or a pipe runs in a separate process under a
1992 non-privileged uid, and these deliveries are run one at a time. Remote
1993 deliveries also run in separate processes, normally under a uid that is private
1994 to Exim (<quote>the Exim user</quote>), but in this case, several remote deliveries can be
1995 run in parallel. The maximum number of simultaneous remote deliveries for any
1996 one message is set by the <option>remote_max_parallel</option> option.
1997 The order in which deliveries are done is not defined, except that all local
1998 deliveries happen before any remote deliveries.
1999 </para>
2000 </listitem>
2001 <listitem>
2002 <para>
2003 <indexterm role="concept">
2004 <primary>queue runner</primary>
2005 </indexterm>
2006 When it encounters a local delivery during a queue run, Exim checks its retry
2007 database to see if there has been a previous temporary delivery failure for the
2008 address before running the local transport. If there was a previous failure,
2009 Exim does not attempt a new delivery until the retry time for the address is
2010 reached. However, this happens only for delivery attempts that are part of a
2011 queue run. Local deliveries are always attempted when delivery immediately
2012 follows message reception, even if retry times are set for them. This makes for
2013 better behaviour if one particular message is causing problems (for example,
2014 causing quota overflow, or provoking an error in a filter file).
2015 </para>
2016 </listitem>
2017 <listitem>
2018 <para>
2019 <indexterm role="concept">
2020 <primary>delivery</primary>
2021 <secondary>retry in remote transports</secondary>
2022 </indexterm>
2023 Remote transports do their own retry handling, since an address may be
2024 deliverable to one of a number of hosts, each of which may have a different
2025 retry time. If there have been previous temporary failures and no host has
2026 reached its retry time, no delivery is attempted, whether in a queue run or
2027 not. See chapter <xref linkend="CHAPretry"/> for details of retry strategies.
2028 </para>
2029 </listitem>
2030 <listitem>
2031 <para>
2032 If there were any permanent errors, a bounce message is returned to an
2033 appropriate address (the sender in the common case), with details of the error
2034 for each failing address. Exim can be configured to send copies of bounce
2035 messages to other addresses.
2036 </para>
2037 </listitem>
2038 <listitem>
2039 <para>
2040 <indexterm role="concept">
2041 <primary>delivery</primary>
2042 <secondary>deferral</secondary>
2043 </indexterm>
2044 If one or more addresses suffered a temporary failure, the message is left on
2045 the queue, to be tried again later. Delivery of these addresses is said to be
2046 <emphasis>deferred</emphasis>.
2047 </para>
2048 </listitem>
2049 <listitem>
2050 <para>
2051 When all the recipient addresses have either been delivered or bounced,
2052 handling of the message is complete. The spool files and message log are
2053 deleted, though the message log can optionally be preserved if required.
2054 </para>
2055 </listitem>
2056 </itemizedlist>
2057 </section>
2058 <section id="SECID19">
2059 <title>Retry mechanism</title>
2060 <para>
2061 <indexterm role="concept">
2062 <primary>delivery</primary>
2063 <secondary>retry mechanism</secondary>
2064 </indexterm>
2065 <indexterm role="concept">
2066 <primary>retry</primary>
2067 <secondary>description of mechanism</secondary>
2068 </indexterm>
2069 <indexterm role="concept">
2070 <primary>queue runner</primary>
2071 </indexterm>
2072 Exim&#x2019;s mechanism for retrying messages that fail to get delivered at the first
2073 attempt is the queue runner process. You must either run an Exim daemon that
2074 uses the <option>-q</option> option with a time interval to start queue runners at regular
2075 intervals or use some other means (such as <emphasis>cron</emphasis>) to start them. If you do
2076 not arrange for queue runners to be run, messages that fail temporarily at the
2077 first attempt will remain in your queue forever. A queue runner process works
2078 its way through the queue, one message at a time, trying each delivery that has
2079 passed its retry time.
2080 You can run several queue runners at once.
2081 </para>
2082 <para>
2083 Exim uses a set of configured rules to determine when next to retry the failing
2084 address (see chapter <xref linkend="CHAPretry"/>). These rules also specify when Exim
2085 should give up trying to deliver to the address, at which point it generates a
2086 bounce message. If no retry rules are set for a particular host, address, and
2087 error combination, no retries are attempted, and temporary errors are treated
2088 as permanent.
2089 </para>
2090 </section>
2091 <section id="SECID20">
2092 <title>Temporary delivery failure</title>
2093 <para>
2094 <indexterm role="concept">
2095 <primary>delivery</primary>
2096 <secondary>temporary failure</secondary>
2097 </indexterm>
2098 There are many reasons why a message may not be immediately deliverable to a
2099 particular address. Failure to connect to a remote machine (because it, or the
2100 connection to it, is down) is one of the most common. Temporary failures may be
2101 detected during routing as well as during the transport stage of delivery.
2102 Local deliveries may be delayed if NFS files are unavailable, or if a mailbox
2103 is on a file system where the user is over quota. Exim can be configured to
2104 impose its own quotas on local mailboxes; where system quotas are set they will
2105 also apply.
2106 </para>
2107 <para>
2108 If a host is unreachable for a period of time, a number of messages may be
2109 waiting for it by the time it recovers, and sending them in a single SMTP
2110 connection is clearly beneficial. Whenever a delivery to a remote host is
2111 deferred,
2112 <indexterm role="concept">
2113 <primary>hints database</primary>
2114 <secondary>deferred deliveries</secondary>
2115 </indexterm>
2116 Exim makes a note in its hints database, and whenever a successful
2117 SMTP delivery has happened, it looks to see if any other messages are waiting
2118 for the same host. If any are found, they are sent over the same SMTP
2119 connection, subject to a configuration limit as to the maximum number in any
2120 one connection.
2121 </para>
2122 </section>
2123 <section id="SECID21">
2124 <title>Permanent delivery failure</title>
2125 <para>
2126 <indexterm role="concept">
2127 <primary>delivery</primary>
2128 <secondary>permanent failure</secondary>
2129 </indexterm>
2130 <indexterm role="concept">
2131 <primary>bounce message</primary>
2132 <secondary>when generated</secondary>
2133 </indexterm>
2134 When a message cannot be delivered to some or all of its intended recipients, a
2135 bounce message is generated. Temporary delivery failures turn into permanent
2136 errors when their timeout expires. All the addresses that fail in a given
2137 delivery attempt are listed in a single message. If the original message has
2138 many recipients, it is possible for some addresses to fail in one delivery
2139 attempt and others to fail subsequently, giving rise to more than one bounce
2140 message. The wording of bounce messages can be customized by the administrator.
2141 See chapter <xref linkend="CHAPemsgcust"/> for details.
2142 </para>
2143 <para>
2144 <indexterm role="concept">
2145 <primary><emphasis>X-Failed-Recipients:</emphasis> header line</primary>
2146 </indexterm>
2147 Bounce messages contain an <emphasis>X-Failed-Recipients:</emphasis> header line that lists the
2148 failed addresses, for the benefit of programs that try to analyse such messages
2149 automatically.
2150 </para>
2151 <para>
2152 <indexterm role="concept">
2153 <primary>bounce message</primary>
2154 <secondary>recipient of</secondary>
2155 </indexterm>
2156 A bounce message is normally sent to the sender of the original message, as
2157 obtained from the message&#x2019;s envelope. For incoming SMTP messages, this is the
2158 address given in the MAIL command. However, when an address is expanded via a
2159 forward or alias file, an alternative address can be specified for delivery
2160 failures of the generated addresses. For a mailing list expansion (see section
2161 <xref linkend="SECTmailinglists"/>) it is common to direct bounce messages to the manager
2162 of the list.
2163 </para>
2164 </section>
2165 <section id="SECID22">
2166 <title>Failures to deliver bounce messages</title>
2167 <para>
2168 <indexterm role="concept">
2169 <primary>bounce message</primary>
2170 <secondary>failure to deliver</secondary>
2171 </indexterm>
2172 If a bounce message (either locally generated or received from a remote host)
2173 itself suffers a permanent delivery failure, the message is left in the queue,
2174 but it is frozen, awaiting the attention of an administrator. There are options
2175 that can be used to make Exim discard such failed messages, or to keep them
2176 for only a short time (see <option>timeout_frozen_after</option> and
2177 <option>ignore_bounce_errors_after</option>).
2178 </para>
2179 </section>
2180 </chapter>
2181
2182 <chapter id="CHID3">
2183 <title>Building and installing Exim</title>
2184 <para>
2185 <indexterm role="concept" id="IIDbuex" class="startofrange">
2186 <primary>building Exim</primary>
2187 </indexterm>
2188 </para>
2189 <section id="SECID23">
2190 <title>Unpacking</title>
2191 <para>
2192 Exim is distributed as a gzipped or bzipped tar file which, when unpacked,
2193 creates a directory with the name of the current release (for example,
2194 <filename>exim-4.96.1</filename>) into which the following files are placed:
2195 </para>
2196 <informaltable frame="none">
2197 <tgroup cols="2" colsep="0" rowsep="0">
2198 <colspec colwidth="140pt" align="left"/>
2199 <colspec colwidth="254pt" align="left"/>
2200 <tbody>
2201 <row>
2202 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>ACKNOWLEDGMENTS</filename></entry>
2203 <entry>contains some acknowledgments</entry>
2204 </row>
2205 <row>
2206 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>CHANGES</filename></entry>
2207 <entry>contains a reference to where changes are documented</entry>
2208 </row>
2209 <row>
2210 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>LICENCE</filename></entry>
2211 <entry>the GNU General Public Licence</entry>
2212 </row>
2213 <row>
2214 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Makefile</filename></entry>
2215 <entry>top-level make file</entry>
2216 </row>
2217 <row>
2218 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>NOTICE</filename></entry>
2219 <entry>conditions for the use of Exim</entry>
2220 </row>
2221 <row>
2222 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>README</filename></entry>
2223 <entry>list of files, directories and simple build instructions</entry>
2224 </row>
2225 </tbody>
2226 </tgroup>
2227 </informaltable>
2228 <para>
2229 Other files whose names begin with <filename>README</filename> may also be present. The
2230 following subdirectories are created:
2231 </para>
2232 <informaltable frame="none">
2233 <tgroup cols="2" colsep="0" rowsep="0">
2234 <colspec colwidth="140pt" align="left"/>
2235 <colspec colwidth="254pt" align="left"/>
2236 <tbody>
2237 <row>
2238 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>Local</filename></entry>
2239 <entry>an empty directory for local configuration files</entry>
2240 </row>
2241 <row>
2242 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>OS</filename></entry>
2243 <entry>OS-specific files</entry>
2244 </row>
2245 <row>
2246 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>doc</filename></entry>
2247 <entry>documentation files</entry>
2248 </row>
2249 <row>
2250 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>exim_monitor</filename></entry>
2251 <entry>source files for the Exim monitor</entry>
2252 </row>
2253 <row>
2254 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>scripts</filename></entry>
2255 <entry>scripts used in the build process</entry>
2256 </row>
2257 <row>
2258 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>src</filename></entry>
2259 <entry>remaining source files</entry>
2260 </row>
2261 <row>
2262 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<filename>util</filename></entry>
2263 <entry>independent utilities</entry>
2264 </row>
2265 </tbody>
2266 </tgroup>
2267 </informaltable>
2268 <para>
2269 The main utility programs are contained in the <filename>src</filename> directory and are built
2270 with the Exim binary. The <filename>util</filename> directory contains a few optional scripts
2271 that may be useful to some sites.
2272 </para>
2273 </section>
2274 <section id="SECID24">
2275 <title>Multiple machine architectures and operating systems</title>
2276 <para>
2277 <indexterm role="concept">
2278 <primary>building Exim</primary>
2279 <secondary>multiple OS/architectures</secondary>
2280 </indexterm>
2281 The building process for Exim is arranged to make it easy to build binaries for
2282 a number of different architectures and operating systems from the same set of
2283 source files. Compilation does not take place in the <filename>src</filename> directory.
2284 Instead, a <emphasis>build directory</emphasis> is created for each architecture and operating
2285 system.
2286 <indexterm role="concept">
2287 <primary>symbolic link</primary>
2288 <secondary>to build directory</secondary>
2289 </indexterm>
2290 Symbolic links to the sources are installed in this directory, which is where
2291 the actual building takes place. In most cases, Exim can discover the machine
2292 architecture and operating system for itself, but the defaults can be
2293 overridden if necessary.
2294 <indexterm role="concept">
2295 <primary>compiler</primary>
2296 <secondary>requirements</secondary>
2297 </indexterm>
2298 <indexterm role="concept">
2299 <primary>compiler</primary>
2300 <secondary>version</secondary>
2301 </indexterm>
2302 A C99-capable compiler will be required for the build.
2303 </para>
2304 </section>
2305 <section id="SECTpcre">
2306 <title>PCRE2 library</title>
2307 <para>
2308 <indexterm role="concept">
2309 <primary>PCRE2 library</primary>
2310 </indexterm>
2311 Exim no longer has an embedded regular-expression library as the vast majority of
2312 modern systems include PCRE2 as a system library, although you may need to
2313 install the PCRE2 package or the PCRE2 development package for your operating
2314 system. If your system has a normal PCRE2 installation the Exim build
2315 process will need no further configuration. If the library or the
2316 headers are in an unusual location you will need to either set the PCRE2_LIBS
2317 and INCLUDE directives appropriately,
2318 or set PCRE2_CONFIG=yes to use the installed <command>pcre-config</command> command.
2319 If your operating system has no
2320 PCRE2 support then you will need to obtain and build the current PCRE2
2321 from <emphasis role="bold"><ulink url="https://github.com/PhilipHazel/pcre2/releases">https://github.com/PhilipHazel/pcre2/releases</ulink></emphasis>.
2322 More information on PCRE2 is available at <emphasis role="bold"><ulink url="https://www.pcre.org/">https://www.pcre.org/</ulink></emphasis>.
2323 </para>
2324 </section>
2325 <section id="SECTdb">
2326 <title>DBM libraries</title>
2327 <para>
2328 <indexterm role="concept">
2329 <primary>DBM libraries</primary>
2330 <secondary>discussion of</secondary>
2331 </indexterm>
2332 <indexterm role="concept">
2333 <primary>hints database</primary>
2334 <secondary>DBM files used for</secondary>
2335 </indexterm>
2336 Even if you do not use any DBM files in your configuration, Exim still needs a
2337 DBM library in order to operate, because it uses indexed files for its hints
2338 databases. Unfortunately, there are a number of DBM libraries in existence, and
2339 different operating systems often have different ones installed.
2340 </para>
2341 <para>
2342 <indexterm role="concept">
2343 <primary>Solaris</primary>
2344 <secondary>DBM library for</secondary>
2345 </indexterm>
2346 <indexterm role="concept">
2347 <primary>IRIX, DBM library for</primary>
2348 </indexterm>
2349 <indexterm role="concept">
2350 <primary>BSD, DBM library for</primary>
2351 </indexterm>
2352 <indexterm role="concept">
2353 <primary>Linux, DBM library for</primary>
2354 </indexterm>
2355 If you are using Solaris, IRIX, one of the modern BSD systems, or a modern
2356 Linux distribution, the DBM configuration should happen automatically, and you
2357 may be able to ignore this section. Otherwise, you may have to learn more than
2358 you would like about DBM libraries from what follows.
2359 </para>
2360 <para>
2361 <indexterm role="concept">
2362 <primary><emphasis>ndbm</emphasis> DBM library</primary>
2363 </indexterm>
2364 Licensed versions of Unix normally contain a library of DBM functions operating
2365 via the <emphasis>ndbm</emphasis> interface, and this is what Exim expects by default. Free
2366 versions of Unix seem to vary in what they contain as standard. In particular,
2367 some early versions of Linux have no default DBM library, and different
2368 distributors have chosen to bundle different libraries with their packaged
2369 versions. However, the more recent releases seem to have standardized on the
2370 Berkeley DB library.
2371 </para>
2372 <para>
2373 Different DBM libraries have different conventions for naming the files they
2374 use. When a program opens a file called <filename>dbmfile</filename>, there are several
2375 possibilities:
2376 </para>
2377 <orderedlist numeration="arabic">
2378 <listitem>
2379 <para>
2380 A traditional <emphasis>ndbm</emphasis> implementation, such as that supplied as part of
2381 Solaris, operates on two files called <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>.
2382 </para>
2383 </listitem>
2384 <listitem>
2385 <para>
2386 <indexterm role="concept">
2387 <primary><emphasis>gdbm</emphasis> DBM library</primary>
2388 </indexterm>
2389 The GNU library, <emphasis>gdbm</emphasis>, operates on a single file. If used via its <emphasis>ndbm</emphasis>
2390 compatibility interface it makes two different hard links to it with names
2391 <filename>dbmfile.dir</filename> and <filename>dbmfile.pag</filename>, but if used via its native interface, the
2392 filename is used unmodified.
2393 </para>
2394 </listitem>
2395 <listitem>
2396 <para>
2397 <indexterm role="concept">
2398 <primary>Berkeley DB library</primary>
2399 </indexterm>
2400 The Berkeley DB package, if called via its <emphasis>ndbm</emphasis> compatibility interface,
2401 operates on a single file called <filename>dbmfile.db</filename>, but otherwise looks to the
2402 programmer exactly the same as the traditional <emphasis>ndbm</emphasis> implementation.
2403 </para>
2404 </listitem>
2405 <listitem>
2406 <para>
2407 If the Berkeley package is used in its native mode, it operates on a single
2408 file called <filename>dbmfile</filename>; the programmer&#x2019;s interface is somewhat different to
2409 the traditional <emphasis>ndbm</emphasis> interface.
2410 </para>
2411 </listitem>
2412 <listitem>
2413 <para>
2414 To complicate things further, there are several very different versions of the
2415 Berkeley DB package. Version 1.85 was stable for a very long time, releases
2416 2.<emphasis>x</emphasis> and 3.<emphasis>x</emphasis> were current for a while,
2417 </para>
2418 <para revisionflag="changed">
2419 but the latest versions when Exim last revamped support were numbered 5.<emphasis>x</emphasis>.
2420 Maintenance of some of the earlier releases has ceased,
2421 and Exim no longer supports versions before 3.<emphasis>x</emphasis>.
2422 </para>
2423 <para>
2424 All versions of Berkeley DB could be obtained from
2425 <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
2426 page with far newer versions listed.
2427 It is probably wise to plan to move your storage configurations away from
2428 Berkeley DB format, as today there are smaller and simpler alternatives more
2429 suited to Exim&#x2019;s usage model.
2430 </para>
2431 </listitem>
2432 <listitem>
2433 <para>
2434 <indexterm role="concept">
2435 <primary><emphasis>tdb</emphasis> DBM library</primary>
2436 </indexterm>
2437 Yet another DBM library, called <emphasis>tdb</emphasis>, is available from
2438 <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
2439 operates on a single file.
2440 </para>
2441 </listitem>
2442 </orderedlist>
2443 <para>
2444 <indexterm role="concept">
2445 <primary>USE_DB</primary>
2446 </indexterm>
2447 <indexterm role="concept">
2448 <primary>DBM libraries</primary>
2449 <secondary>configuration for building</secondary>
2450 </indexterm>
2451 Exim and its utilities can be compiled to use any of these interfaces. In order
2452 to use any version of the Berkeley DB package in native mode, you must set
2453 USE_DB in an appropriate configuration file (typically
2454 <filename>Local/Makefile</filename>). For example:
2455 </para>
2456 <literallayout class="monospaced">
2457 USE_DB=yes
2458 </literallayout>
2459 <para>
2460 Similarly, for gdbm you set USE_GDBM, and for tdb you set USE_TDB. An
2461 error is diagnosed if you set more than one of these.
2462 </para>
2463 <para revisionflag="changed">
2464 You can set USE_NDBM if needed to override an operating system default.
2465 </para>
2466 <para>
2467 At the lowest level, the build-time configuration sets none of these options,
2468 thereby assuming an interface of type (1). However, some operating system
2469 configuration files (for example, those for the BSD operating systems and
2470 Linux) assume type (4) by setting USE_DB as their default, and the
2471 configuration files for Cygwin set USE_GDBM. Anything you set in
2472 <filename>Local/Makefile</filename>, however, overrides these system defaults.
2473 </para>
2474 <para>
2475 As well as setting USE_DB, USE_GDBM, or USE_TDB, it may also be
2476 necessary to set DBMLIB, to cause inclusion of the appropriate library, as
2477 in one of these lines:
2478 </para>
2479 <literallayout class="monospaced">
2480 DBMLIB = -ldb
2481 DBMLIB = -ltdb
2482 DBMLIB = -lgdbm -lgdbm_compat
2483 </literallayout>
2484 <para revisionflag="changed">
2485 The last of those was for a Linux having GDBM provide emulated NDBM facilities.
2486 </para>
2487 <para>
2488 Settings like that will work if the DBM library is installed in the standard
2489 place. Sometimes it is not, and the library&#x2019;s header file may also not be in
2490 the default path. You may need to set INCLUDE to specify where the header
2491 file is, and to specify the path to the library more fully in DBMLIB, as in
2492 this example:
2493 </para>
2494 <literallayout class="monospaced">
2495 INCLUDE=-I/usr/local/include/db-4.1
2496 DBMLIB=/usr/local/lib/db-4.1/libdb.a
2497 </literallayout>
2498 <para>
2499 There is further detailed discussion about the various DBM libraries in the
2500 file <filename>doc/dbm.discuss.txt</filename> in the Exim distribution.
2501 </para>
2502 </section>
2503 <section id="SECID25">
2504 <title>Pre-building configuration</title>
2505 <para>
2506 <indexterm role="concept">
2507 <primary>building Exim</primary>
2508 <secondary>pre-building configuration</secondary>
2509 </indexterm>
2510 <indexterm role="concept">
2511 <primary>configuration for building Exim</primary>
2512 </indexterm>
2513 <indexterm role="concept">
2514 <primary><filename>Local/Makefile</filename></primary>
2515 </indexterm>
2516 <indexterm role="concept">
2517 <primary><filename>src/EDITME</filename></primary>
2518 </indexterm>
2519 Before building Exim, a local configuration file that specifies options
2520 independent of any operating system has to be created with the name
2521 <filename>Local/Makefile</filename>. A template for this file is supplied as the file
2522 <filename>src/EDITME</filename>, and it contains full descriptions of all the option settings
2523 therein. These descriptions are therefore not repeated here. If you are
2524 building Exim for the first time, the simplest thing to do is to copy
2525 <filename>src/EDITME</filename> to <filename>Local/Makefile</filename>, then read it and edit it appropriately.
2526 </para>
2527 <para>
2528 There are three settings that you must supply, because Exim will not build
2529 without them. They are the location of the runtime configuration file
2530 (CONFIGURE_FILE), the directory in which Exim binaries will be installed
2531 (BIN_DIRECTORY), and the identity of the Exim user (EXIM_USER and
2532 maybe EXIM_GROUP as well). The value of CONFIGURE_FILE can in fact be
2533 a colon-separated list of filenames; Exim uses the first of them that exists.
2534 </para>
2535 <para>
2536 There are a few other parameters that can be specified either at build time or
2537 at runtime, to enable the same binary to be used on a number of different
2538 machines. However, if the locations of Exim&#x2019;s spool directory and log file
2539 directory (if not within the spool directory) are fixed, it is recommended that
2540 you specify them in <filename>Local/Makefile</filename> instead of at runtime, so that errors
2541 detected early in Exim&#x2019;s execution (such as a malformed configuration file) can
2542 be logged.
2543 </para>
2544 <para>
2545 <indexterm role="concept">
2546 <primary>content scanning</primary>
2547 <secondary>specifying at build time</secondary>
2548 </indexterm>
2549 Exim&#x2019;s interfaces for calling virus and spam scanning software directly from
2550 access control lists are not compiled by default. If you want to include these
2551 facilities, you need to set
2552 </para>
2553 <literallayout class="monospaced">
2554 WITH_CONTENT_SCAN=yes
2555 </literallayout>
2556 <para>
2557 in your <filename>Local/Makefile</filename>. For details of the facilities themselves, see
2558 chapter <xref linkend="CHAPexiscan"/>.
2559 </para>
2560 <para>
2561 <indexterm role="concept">
2562 <primary><filename>Local/eximon.conf</filename></primary>
2563 </indexterm>
2564 <indexterm role="concept">
2565 <primary><filename>exim_monitor/EDITME</filename></primary>
2566 </indexterm>
2567 If you are going to build the Exim monitor, a similar configuration process is
2568 required. The file <filename>exim_monitor/EDITME</filename> must be edited appropriately for
2569 your installation and saved under the name <filename>Local/eximon.conf</filename>. If you are
2570 happy with the default settings described in <filename>exim_monitor/EDITME</filename>,
2571 <filename>Local/eximon.conf</filename> can be empty, but it must exist.
2572 </para>
2573 <para>
2574 This is all the configuration that is needed in straightforward cases for known
2575 operating systems. However, the building process is set up so that it is easy
2576 to override options that are set by default or by operating-system-specific
2577 configuration files, for example, to change the C compiler, which
2578 defaults to <option>gcc</option>. See section <xref linkend="SECToverride"/> below for details of how to
2579 do this.
2580 </para>
2581 </section>
2582 <section id="SECID26">
2583 <title>Support for iconv()</title>
2584 <para>
2585 <indexterm role="concept">
2586 <primary><function>iconv()</function> support</primary>
2587 </indexterm>
2588 <indexterm role="concept">
2589 <primary>RFC 2047</primary>
2590 </indexterm>
2591 The contents of header lines in messages may be encoded according to the rules
2592 described RFC 2047. This makes it possible to transmit characters that are not
2593 in the ASCII character set, and to label them as being in a particular
2594 character set. When Exim is inspecting header lines by means of the <option>$h_</option>
2595 mechanism, it decodes them, and translates them into a specified character set
2596 (default is set at build time). The translation is possible only if the operating system
2597 supports the <function>iconv()</function> function.
2598 </para>
2599 <para>
2600 However, some of the operating systems that supply <function>iconv()</function> do not support
2601 very many conversions. The GNU <option>libiconv</option> library (available from
2602 <emphasis role="bold"><ulink url="https://www.gnu.org/software/libiconv/">https://www.gnu.org/software/libiconv/</ulink></emphasis>) can be installed on such
2603 systems to remedy this deficiency, as well as on systems that do not supply
2604 <function>iconv()</function> at all. After installing <option>libiconv</option>, you should add
2605 </para>
2606 <literallayout class="monospaced">
2607 HAVE_ICONV=yes
2608 </literallayout>
2609 <para>
2610 to your <filename>Local/Makefile</filename> and rebuild Exim.
2611 </para>
2612 </section>
2613 <section id="SECTinctlsssl">
2614 <title>Including TLS/SSL encryption support</title>
2615 <para>
2616 <indexterm role="concept">
2617 <primary>TLS</primary>
2618 <secondary>including support for TLS</secondary>
2619 </indexterm>
2620 <indexterm role="concept">
2621 <primary>encryption</primary>
2622 <secondary>including support for</secondary>
2623 </indexterm>
2624 <indexterm role="concept">
2625 <primary>OpenSSL</primary>
2626 <secondary>building Exim with</secondary>
2627 </indexterm>
2628 <indexterm role="concept">
2629 <primary>GnuTLS</primary>
2630 <secondary>building Exim with</secondary>
2631 </indexterm>
2632 Exim is usually built to support encrypted SMTP connections, using the STARTTLS
2633 command as per RFC 2487. It can also support clients that expect to
2634 start a TLS session immediately on connection to a non-standard port (see the
2635 <option>tls_on_connect_ports</option> runtime option and the <option>-tls-on-connect</option> command
2636 line option).
2637 </para>
2638 <para>
2639 If you want to build Exim with TLS support, you must first install either the
2640 OpenSSL or GnuTLS library. There is no cryptographic code in Exim itself for
2641 implementing SSL.
2642 </para>
2643 <para>
2644 If you do not want TLS support you should set
2645 </para>
2646 <literallayout class="monospaced">
2647 DISABLE_TLS=yes
2648 </literallayout>
2649 <para>
2650 in <filename>Local/Makefile</filename>.
2651 </para>
2652 <para>
2653 If OpenSSL is installed, you should set
2654 </para>
2655 <literallayout class="monospaced">
2656 USE_OPENSL=yes
2657 TLS_LIBS=-lssl -lcrypto
2658 </literallayout>
2659 <para>
2660 in <filename>Local/Makefile</filename>. You may also need to specify the locations of the
2661 OpenSSL library and include files. For example:
2662 </para>
2663 <literallayout class="monospaced">
2664 USE_OPENSSL=yes
2665 TLS_LIBS=-L/usr/local/openssl/lib -lssl -lcrypto
2666 TLS_INCLUDE=-I/usr/local/openssl/include/
2667 </literallayout>
2668 <para>
2669 <indexterm role="concept">
2670 <primary>pkg-config</primary>
2671 <secondary>OpenSSL</secondary>
2672 </indexterm>
2673 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2674 </para>
2675 <literallayout class="monospaced">
2676 USE_OPENSSL=yes
2677 USE_OPENSSL_PC=openssl
2678 </literallayout>
2679 <para>
2680 <indexterm role="concept">
2681 <primary>USE_GNUTLS</primary>
2682 </indexterm>
2683 If GnuTLS is installed, you should set
2684 </para>
2685 <literallayout class="monospaced">
2686 USE_GNUTLS=yes
2687 TLS_LIBS=-lgnutls -ltasn1 -lgcrypt
2688 </literallayout>
2689 <para>
2690 in <filename>Local/Makefile</filename>, and again you may need to specify the locations of the
2691 library and include files. For example:
2692 </para>
2693 <literallayout class="monospaced">
2694 USE_GNUTLS=yes
2695 TLS_LIBS=-L/usr/gnu/lib -lgnutls -ltasn1 -lgcrypt
2696 TLS_INCLUDE=-I/usr/gnu/include
2697 </literallayout>
2698 <para>
2699 <indexterm role="concept">
2700 <primary>pkg-config</primary>
2701 <secondary>GnuTLS</secondary>
2702 </indexterm>
2703 If you have <emphasis>pkg-config</emphasis> available, then instead you can just use:
2704 </para>
2705 <literallayout class="monospaced">
2706 USE_GNUTLS=yes
2707 USE_GNUTLS_PC=gnutls
2708 </literallayout>
2709 <para>
2710 You do not need to set TLS_INCLUDE if the relevant directory is already
2711 specified in INCLUDE. Details of how to configure Exim to make use of TLS are
2712 given in chapter <xref linkend="CHAPTLS"/>.
2713 </para>
2714 </section>
2715 <section id="SECID27">
2716 <title>Use of tcpwrappers</title>
2717 <para>
2718 <indexterm role="concept">
2719 <primary>tcpwrappers, building Exim to support</primary>
2720 </indexterm>
2721 <indexterm role="concept">
2722 <primary>USE_TCP_WRAPPERS</primary>
2723 </indexterm>
2724 <indexterm role="concept">
2725 <primary>TCP_WRAPPERS_DAEMON_NAME</primary>
2726 </indexterm>
2727 <indexterm role="concept">
2728 <primary>tcp_wrappers_daemon_name</primary>
2729 </indexterm>
2730 Exim can be linked with the <emphasis>tcpwrappers</emphasis> library in order to check incoming
2731 SMTP calls using the <emphasis>tcpwrappers</emphasis> control files. This may be a convenient
2732 alternative to Exim&#x2019;s own checking facilities for installations that are
2733 already making use of <emphasis>tcpwrappers</emphasis> for other purposes. To do this, you
2734 should set USE_TCP_WRAPPERS in <filename>Local/Makefile</filename>, arrange for the file
2735 <filename>tcpd.h</filename> to be available at compile time, and also ensure that the library
2736 <filename>libwrap.a</filename> is available at link time, typically by including <option>-lwrap</option> in
2737 EXTRALIBS_EXIM. For example, if <emphasis>tcpwrappers</emphasis> is installed in <filename>/usr/local</filename>,
2738 you might have
2739 </para>
2740 <literallayout class="monospaced">
2741 USE_TCP_WRAPPERS=yes
2742 CFLAGS=-O -I/usr/local/include
2743 EXTRALIBS_EXIM=-L/usr/local/lib -lwrap
2744 </literallayout>
2745 <para>
2746 in <filename>Local/Makefile</filename>. The daemon name to use in the <emphasis>tcpwrappers</emphasis> control
2747 files is <quote>exim</quote>. For example, the line
2748 </para>
2749 <literallayout class="monospaced">
2750 exim : LOCAL  192.168.1.  .friendly.domain.example
2751 </literallayout>
2752 <para>
2753 in your <filename>/etc/hosts.allow</filename> file allows connections from the local host, from
2754 the subnet 192.168.1.0/24, and from all hosts in <emphasis>friendly.domain.example</emphasis>.
2755 All other connections are denied. The daemon name used by <emphasis>tcpwrappers</emphasis>
2756 can be changed at build time by setting TCP_WRAPPERS_DAEMON_NAME in
2757 <filename>Local/Makefile</filename>, or by setting tcp_wrappers_daemon_name in the
2758 configure file. Consult the <emphasis>tcpwrappers</emphasis> documentation for
2759 further details.
2760 </para>
2761 </section>
2762 <section id="SECID28">
2763 <title>Including support for IPv6</title>
2764 <para>
2765 <indexterm role="concept">
2766 <primary>IPv6</primary>
2767 <secondary>including support for</secondary>
2768 </indexterm>
2769 Exim contains code for use on systems that have IPv6 support. Setting
2770 <literal>HAVE_IPV6=YES</literal> in <filename>Local/Makefile</filename> causes the IPv6 code to be included;
2771 it may also be necessary to set IPV6_INCLUDE and IPV6_LIBS on systems
2772 where the IPv6 support is not fully integrated into the normal include and
2773 library files.
2774 </para>
2775 <para>
2776 Two different types of DNS record for handling IPv6 addresses have been
2777 defined. AAAA records (analogous to A records for IPv4) are in use, and are
2778 currently seen as the mainstream. Another record type called A6 was proposed
2779 as better than AAAA because it had more flexibility. However, it was felt to be
2780 over-complex, and its status was reduced to <quote>experimental</quote>.
2781 Exim used to
2782 have a compile option for including A6 record support but this has now been
2783 withdrawn.
2784 </para>
2785 </section>
2786 <section id="SECTdynamicmodules">
2787 <title>Dynamically loaded lookup module support</title>
2788 <para>
2789 <indexterm role="concept">
2790 <primary>lookup modules</primary>
2791 </indexterm>
2792 <indexterm role="concept">
2793 <primary>dynamic modules</primary>
2794 </indexterm>
2795 <indexterm role="concept">
2796 <primary>.so building</primary>
2797 </indexterm>
2798 On some platforms, Exim supports not compiling all lookup types directly into
2799 the main binary, instead putting some into external modules which can be loaded
2800 on demand.
2801 This permits packagers to build Exim with support for lookups with extensive
2802 library dependencies without requiring all users to install all of those
2803 dependencies.
2804 Most, but not all, lookup types can be built this way.
2805 </para>
2806 <para>
2807 Set <literal>LOOKUP_MODULE_DIR</literal> to the directory into which the modules will be
2808 installed; Exim will only load modules from that directory, as a security
2809 measure.  You will need to set <literal>CFLAGS_DYNAMIC</literal> if not already defined
2810 for your OS; see <filename>OS/Makefile-Linux</filename> for an example.
2811 Some other requirements for adjusting <literal>EXTRALIBS</literal> may also be necessary,
2812 see <filename>src/EDITME</filename> for details.
2813 </para>
2814 <para>
2815 Then, for each module to be loaded dynamically, define the relevant
2816 <literal>LOOKUP_</literal>&lt;<emphasis>lookup_type</emphasis>&gt; flags to have the value "2" instead of "yes".
2817 For example, this will build in lsearch but load sqlite and mysql support
2818 on demand:
2819 </para>
2820 <literallayout class="monospaced">
2821 LOOKUP_LSEARCH=yes
2822 LOOKUP_SQLITE=2
2823 LOOKUP_MYSQL=2
2824 </literallayout>
2825 </section>
2826 <section id="SECID29">
2827 <title>The building process</title>
2828 <para>
2829 <indexterm role="concept">
2830 <primary>build directory</primary>
2831 </indexterm>
2832 Once <filename>Local/Makefile</filename> (and <filename>Local/eximon.conf</filename>, if required) have been
2833 created, run <emphasis>make</emphasis> at the top level. It determines the architecture and
2834 operating system types, and creates a build directory if one does not exist.
2835 For example, on a Sun system running Solaris 8, the directory
2836 <filename>build-SunOS5-5.8-sparc</filename> is created.
2837 <indexterm role="concept">
2838 <primary>symbolic link</primary>
2839 <secondary>to source files</secondary>
2840 </indexterm>
2841 Symbolic links to relevant source files are installed in the build directory.
2842 </para>
2843 <para>
2844 If this is the first time <emphasis>make</emphasis> has been run, it calls a script that builds
2845 a make file inside the build directory, using the configuration files from the
2846 <filename>Local</filename> directory. The new make file is then passed to another instance of
2847 <emphasis>make</emphasis>. This does the real work, building a number of utility scripts, and
2848 then compiling and linking the binaries for the Exim monitor (if configured), a
2849 number of utility programs, and finally Exim itself. The command <literal>make
2850 makefile</literal> can be used to force a rebuild of the make file in the build
2851 directory, should this ever be necessary.
2852 </para>
2853 <para>
2854 If you have problems building Exim, check for any comments there may be in the
2855 <filename>README</filename> file concerning your operating system, and also take a look at the
2856 FAQ, where some common problems are covered.
2857 </para>
2858 </section>
2859 <section id="SECID283">
2860 <title>Output from <quote>make</quote></title>
2861 <para>
2862 The output produced by the <emphasis>make</emphasis> process for compile lines is often very
2863 unreadable, because these lines can be very long. For this reason, the normal
2864 output is suppressed by default, and instead output similar to that which
2865 appears when compiling the 2.6 Linux kernel is generated: just a short line for
2866 each module that is being compiled or linked. However, it is still possible to
2867 get the full output, by calling <emphasis>make</emphasis> like this:
2868 </para>
2869 <literallayout class="monospaced">
2870 FULLECHO='' make -e
2871 </literallayout>
2872 <para>
2873 The value of FULLECHO defaults to <quote>@</quote>, the flag character that suppresses
2874 command reflection in <emphasis>make</emphasis>. When you ask for the full output, it is
2875 given in addition to the short output.
2876 </para>
2877 </section>
2878 <section id="SECToverride">
2879 <title>Overriding build-time options for Exim</title>
2880 <para>
2881 <indexterm role="concept">
2882 <primary>build-time options, overriding</primary>
2883 </indexterm>
2884 The main make file that is created at the beginning of the building process
2885 consists of the concatenation of a number of files which set configuration
2886 values, followed by a fixed set of <emphasis>make</emphasis> instructions. If a value is set
2887 more than once, the last setting overrides any previous ones. This provides a
2888 convenient way of overriding defaults. The files that are concatenated are, in
2889 order:
2890 </para>
2891 <literallayout>
2892 <filename>OS/Makefile-Default</filename>
2893 <filename>OS/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2894 <filename>Local/Makefile</filename>
2895 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;
2896 <filename>Local/Makefile-</filename>&lt;<emphasis>archtype</emphasis>&gt;
2897 <filename>Local/Makefile-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
2898 <filename>OS/Makefile-Base</filename>
2899 </literallayout>
2900 <para>
2901 <indexterm role="concept">
2902 <primary><filename>Local/Makefile</filename></primary>
2903 </indexterm>
2904 <indexterm role="concept">
2905 <primary>building Exim</primary>
2906 <secondary>operating system type</secondary>
2907 </indexterm>
2908 <indexterm role="concept">
2909 <primary>building Exim</primary>
2910 <secondary>architecture type</secondary>
2911 </indexterm>
2912 where &lt;<emphasis>ostype</emphasis>&gt; is the operating system type and &lt;<emphasis>archtype</emphasis>&gt; is the
2913 architecture type. <filename>Local/Makefile</filename> is required to exist, and the building
2914 process fails if it is absent. The other three <filename>Local</filename> files are optional,
2915 and are often not needed.
2916 </para>
2917 <para>
2918 The values used for &lt;<emphasis>ostype</emphasis>&gt; and &lt;<emphasis>archtype</emphasis>&gt; are obtained from scripts
2919 called <filename>scripts/os-type</filename> and <filename>scripts/arch-type</filename> respectively. If either of
2920 the environment variables EXIM_OSTYPE or EXIM_ARCHTYPE is set, their
2921 values are used, thereby providing a means of forcing particular settings.
2922 Otherwise, the scripts try to get values from the <option>uname</option> command. If this
2923 fails, the shell variables OSTYPE and ARCHTYPE are inspected. A number
2924 of <emphasis>ad hoc</emphasis> transformations are then applied, to produce the standard names
2925 that Exim expects. You can run these scripts directly from the shell in order
2926 to find out what values are being used on your system.
2927 </para>
2928 <para>
2929 <filename>OS/Makefile-Default</filename> contains comments about the variables that are set
2930 therein. Some (but not all) are mentioned below. If there is something that
2931 needs changing, review the contents of this file and the contents of the make
2932 file for your operating system (<filename>OS/Makefile-&lt;ostype&gt;</filename>) to see what the
2933 default values are.
2934 </para>
2935 <para>
2936 <indexterm role="concept">
2937 <primary>building Exim</primary>
2938 <secondary>overriding default settings</secondary>
2939 </indexterm>
2940 If you need to change any of the values that are set in <filename>OS/Makefile-Default</filename>
2941 or in <filename>OS/Makefile-&lt;ostype&gt;</filename>, or to add any new definitions, you do not
2942 need to change the original files. Instead, you should make the changes by
2943 putting the new values in an appropriate <filename>Local</filename> file. For example,
2944 <indexterm role="concept">
2945 <primary>Tru64-Unix build-time settings</primary>
2946 </indexterm>
2947 when building Exim in many releases of the Tru64-Unix (formerly Digital UNIX,
2948 formerly DEC-OSF1) operating system, it is necessary to specify that the C
2949 compiler is called <emphasis>cc</emphasis> rather than <emphasis>gcc</emphasis>. Also, the compiler must be
2950 called with the option <option>-std1</option>, to make it recognize some of the features of
2951 Standard C that Exim uses. (Most other compilers recognize Standard C by
2952 default.) To do this, you should create a file called <filename>Local/Makefile-OSF1</filename>
2953 containing the lines
2954 </para>
2955 <literallayout class="monospaced">
2956 CC=cc
2957 CFLAGS=-std1
2958 </literallayout>
2959 <para>
2960 If you are compiling for just one operating system, it may be easier to put
2961 these lines directly into <filename>Local/Makefile</filename>.
2962 </para>
2963 <para>
2964 Keeping all your local configuration settings separate from the distributed
2965 files makes it easy to transfer them to new versions of Exim simply by copying
2966 the contents of the <filename>Local</filename> directory.
2967 </para>
2968 <para>
2969 <indexterm role="concept">
2970 <primary>NIS lookup type</primary>
2971 <secondary>including support for</secondary>
2972 </indexterm>
2973 <indexterm role="concept">
2974 <primary>NIS+ lookup type</primary>
2975 <secondary>including support for</secondary>
2976 </indexterm>
2977 <indexterm role="concept">
2978 <primary>LDAP</primary>
2979 <secondary>including support for</secondary>
2980 </indexterm>
2981 <indexterm role="concept">
2982 <primary>lookup</primary>
2983 <secondary>inclusion in binary</secondary>
2984 </indexterm>
2985 Exim contains support for doing LDAP, NIS, NIS+, and other kinds of file
2986 lookup, but not all systems have these components installed, so the default is
2987 not to include the relevant code in the binary. All the different kinds of file
2988 and database lookup that Exim supports are implemented as separate code modules
2989 which are included only if the relevant compile-time options are set. In the
2990 case of LDAP, NIS, and NIS+, the settings for <filename>Local/Makefile</filename> are:
2991 </para>
2992 <literallayout class="monospaced">
2993 LOOKUP_LDAP=yes
2994 LOOKUP_NIS=yes
2995 LOOKUP_NISPLUS=yes
2996 </literallayout>
2997 <para>
2998 and similar settings apply to the other lookup types. They are all listed in
2999 <filename>src/EDITME</filename>. In many cases the relevant include files and interface
3000 libraries need to be installed before compiling Exim.
3001 <indexterm role="concept">
3002 <primary>cdb</primary>
3003 <secondary>including support for</secondary>
3004 </indexterm>
3005 However, there are some optional lookup types (such as cdb) for which
3006 the code is entirely contained within Exim, and no external include
3007 files or libraries are required. When a lookup type is not included in the
3008 binary, attempts to configure Exim to use it cause runtime configuration
3009 errors.
3010 </para>
3011 <para>
3012 <indexterm role="concept">
3013 <primary>pkg-config</primary>
3014 <secondary>lookups</secondary>
3015 </indexterm>
3016 <indexterm role="concept">
3017 <primary>pkg-config</primary>
3018 <secondary>authenticators</secondary>
3019 </indexterm>
3020 Many systems now use a tool called <emphasis>pkg-config</emphasis> to encapsulate information
3021 about how to compile against a library; Exim has some initial support for
3022 being able to use pkg-config for lookups and authenticators.  For any given
3023 makefile variable which starts <literal>LOOKUP_</literal> or <literal>AUTH_</literal>, you can add a new
3024 variable with the <literal>_PC</literal> suffix in the name and assign as the value the
3025 name of the package to be queried.  The results of querying via the
3026 <emphasis>pkg-config</emphasis> command will be added to the appropriate Makefile variables
3027 with <literal>+=</literal> directives, so your version of <emphasis>make</emphasis> will need to support that
3028 syntax.  For instance:
3029 </para>
3030 <literallayout class="monospaced">
3031 LOOKUP_SQLITE=yes
3032 LOOKUP_SQLITE_PC=sqlite3
3033 AUTH_GSASL=yes
3034 AUTH_GSASL_PC=libgsasl
3035 AUTH_HEIMDAL_GSSAPI=yes
3036 AUTH_HEIMDAL_GSSAPI_PC=heimdal-gssapi
3037 </literallayout>
3038 <para>
3039 <indexterm role="concept">
3040 <primary>Perl</primary>
3041 <secondary>including support for</secondary>
3042 </indexterm>
3043 Exim can be linked with an embedded Perl interpreter, allowing Perl
3044 subroutines to be called during string expansion. To enable this facility,
3045 </para>
3046 <literallayout class="monospaced">
3047 EXIM_PERL=perl.o
3048 </literallayout>
3049 <para>
3050 must be defined in <filename>Local/Makefile</filename>. Details of this facility are given in
3051 chapter <xref linkend="CHAPperl"/>.
3052 </para>
3053 <para>
3054 <indexterm role="concept">
3055 <primary>X11 libraries, location of</primary>
3056 </indexterm>
3057 The location of the X11 libraries is something that varies a lot between
3058 operating systems, and there may be different versions of X11 to cope
3059 with. Exim itself makes no use of X11, but if you are compiling the Exim
3060 monitor, the X11 libraries must be available.
3061 The following three variables are set in <filename>OS/Makefile-Default</filename>:
3062 </para>
3063 <literallayout class="monospaced">
3064 X11=/usr/X11R6
3065 XINCLUDE=-I$(X11)/include
3066 XLFLAGS=-L$(X11)/lib
3067 </literallayout>
3068 <para>
3069 These are overridden in some of the operating-system configuration files. For
3070 example, in <filename>OS/Makefile-SunOS5</filename> there is
3071 </para>
3072 <literallayout class="monospaced">
3073 X11=/usr/openwin
3074 XINCLUDE=-I$(X11)/include
3075 XLFLAGS=-L$(X11)/lib -R$(X11)/lib
3076 </literallayout>
3077 <para>
3078 If you need to override the default setting for your operating system, place a
3079 definition of all three of these variables into your
3080 <filename>Local/Makefile-&lt;ostype&gt;</filename> file.
3081 </para>
3082 <para>
3083 <indexterm role="concept">
3084 <primary>EXTRALIBS</primary>
3085 </indexterm>
3086 If you need to add any extra libraries to the link steps, these can be put in a
3087 variable called EXTRALIBS, which appears in all the link commands, but by
3088 default is not defined. In contrast, EXTRALIBS_EXIM is used only on the
3089 command for linking the main Exim binary, and not for any associated utilities.
3090 </para>
3091 <para>
3092 <indexterm role="concept">
3093 <primary>DBM libraries</primary>
3094 <secondary>configuration for building</secondary>
3095 </indexterm>
3096 There is also DBMLIB, which appears in the link commands for binaries that
3097 use DBM functions (see also section <xref linkend="SECTdb"/>). Finally, there is
3098 EXTRALIBS_EXIMON, which appears only in the link step for the Exim monitor
3099 binary, and which can be used, for example, to include additional X11
3100 libraries.
3101 </para>
3102 <para>
3103 <indexterm role="concept">
3104 <primary>configuration file</primary>
3105 <secondary>editing</secondary>
3106 </indexterm>
3107 The make file copes with rebuilding Exim correctly if any of the configuration
3108 files are edited. However, if an optional configuration file is deleted, it is
3109 necessary to touch the associated non-optional file (that is,
3110 <filename>Local/Makefile</filename> or <filename>Local/eximon.conf</filename>) before rebuilding.
3111 </para>
3112 </section>
3113 <section id="SECID30">
3114 <title>OS-specific header files</title>
3115 <para>
3116 <indexterm role="concept">
3117 <primary><filename>os.h</filename></primary>
3118 </indexterm>
3119 <indexterm role="concept">
3120 <primary>building Exim</primary>
3121 <secondary>OS-specific C header files</secondary>
3122 </indexterm>
3123 The <filename>OS</filename> directory contains a number of files with names of the form
3124 <filename>os.h-&lt;ostype&gt;</filename>. These are system-specific C header files that should not
3125 normally need to be changed. There is a list of macro settings that are
3126 recognized in the file <filename>OS/os.configuring</filename>, which should be consulted if you
3127 are porting Exim to a new operating system.
3128 </para>
3129 </section>
3130 <section id="SECID31">
3131 <title>Overriding build-time options for the monitor</title>
3132 <para>
3133 <indexterm role="concept">
3134 <primary>building Eximon</primary>
3135 </indexterm>
3136 A similar process is used for overriding things when building the Exim monitor,
3137 where the files that are involved are
3138 </para>
3139 <literallayout>
3140 <filename>OS/eximon.conf-Default</filename>
3141 <filename>OS/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3142 <filename>Local/eximon.conf</filename>
3143 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;
3144 <filename>Local/eximon.conf-</filename>&lt;<emphasis>archtype</emphasis>&gt;
3145 <filename>Local/eximon.conf-</filename>&lt;<emphasis>ostype</emphasis>&gt;-&lt;<emphasis>archtype</emphasis>&gt;
3146 </literallayout>
3147 <para>
3148 <indexterm role="concept">
3149 <primary><filename>Local/eximon.conf</filename></primary>
3150 </indexterm>
3151 As with Exim itself, the final three files need not exist, and in this case the
3152 <filename>OS/eximon.conf-&lt;ostype&gt;</filename> file is also optional. The default values in
3153 <filename>OS/eximon.conf-Default</filename> can be overridden dynamically by setting environment
3154 variables of the same name, preceded by EXIMON_. For example, setting
3155 EXIMON_LOG_DEPTH in the environment overrides the value of
3156 LOG_DEPTH at runtime.
3157 <indexterm role="concept" startref="IIDbuex" class="endofrange"/>
3158 </para>
3159 </section>
3160 <section id="SECID32">
3161 <title>Installing Exim binaries and scripts</title>
3162 <para>
3163 <indexterm role="concept">
3164 <primary>installing Exim</primary>
3165 </indexterm>
3166 <indexterm role="concept">
3167 <primary>BIN_DIRECTORY</primary>
3168 </indexterm>
3169 The command <literal>make install</literal> runs the <command>exim_install</command> script with no
3170 arguments. The script copies binaries and utility scripts into the directory
3171 whose name is specified by the BIN_DIRECTORY setting in <filename>Local/Makefile</filename>.
3172 <indexterm role="concept">
3173 <primary>setuid</primary>
3174 <secondary>installing Exim with</secondary>
3175 </indexterm>
3176 The install script copies files only if they are newer than the files they are
3177 going to replace. The Exim binary is required to be owned by root and have the
3178 <emphasis>setuid</emphasis> bit set, for normal configurations. Therefore, you must run <literal>make
3179 install</literal> as root so that it can set up the Exim binary in this way. However, in
3180 some special situations (for example, if a host is doing no local deliveries)
3181 it may be possible to run Exim without making the binary setuid root (see
3182 chapter <xref linkend="CHAPsecurity"/> for details).
3183 </para>
3184 <para>
3185 <indexterm role="concept">
3186 <primary>CONFIGURE_FILE</primary>
3187 </indexterm>
3188 Exim&#x2019;s runtime configuration file is named by the CONFIGURE_FILE setting
3189 in <filename>Local/Makefile</filename>. If this names a single file, and the file does not
3190 exist, the default configuration file <filename>src/configure.default</filename> is copied there
3191 by the installation script. If a runtime configuration file already exists, it
3192 is left alone. If CONFIGURE_FILE is a colon-separated list, naming several
3193 alternative files, no default is installed.
3194 </para>
3195 <para>
3196 <indexterm role="concept">
3197 <primary>system aliases file</primary>
3198 </indexterm>
3199 <indexterm role="concept">
3200 <primary><filename>/etc/aliases</filename></primary>
3201 </indexterm>
3202 One change is made to the default configuration file when it is installed: the
3203 default configuration contains a router that references a system aliases file.
3204 The path to this file is set to the value specified by
3205 SYSTEM_ALIASES_FILE in <filename>Local/Makefile</filename> (<filename>/etc/aliases</filename> by default).
3206 If the system aliases file does not exist, the installation script creates it,
3207 and outputs a comment to the user.
3208 </para>
3209 <para>
3210 The created file contains no aliases, but it does contain comments about the
3211 aliases a site should normally have. Mail aliases have traditionally been
3212 kept in <filename>/etc/aliases</filename>. However, some operating systems are now using
3213 <filename>/etc/mail/aliases</filename>. You should check if yours is one of these, and change
3214 Exim&#x2019;s configuration if necessary.
3215 </para>
3216 <para>
3217 The default configuration uses the local host&#x2019;s name as the only local domain,
3218 and is set up to do local deliveries into the shared directory <filename>/var/mail</filename>,
3219 running as the local user. System aliases and <filename>.forward</filename> files in users&#x2019; home
3220 directories are supported, but no NIS or NIS+ support is configured. Domains
3221 other than the name of the local host are routed using the DNS, with delivery
3222 over SMTP.
3223 </para>
3224 <para>
3225 It is possible to install Exim for special purposes (such as building a binary
3226 distribution) in a private part of the file system. You can do this by a
3227 command such as
3228 </para>
3229 <literallayout class="monospaced">
3230 make DESTDIR=/some/directory/ install
3231 </literallayout>
3232 <para>
3233 This has the effect of pre-pending the specified directory to all the file
3234 paths, except the name of the system aliases file that appears in the default
3235 configuration. (If a default alias file is created, its name <emphasis>is</emphasis> modified.)
3236 For backwards compatibility, ROOT is used if DESTDIR is not set,
3237 but this usage is deprecated.
3238 </para>
3239 <para>
3240 <indexterm role="concept">
3241 <primary>installing Exim</primary>
3242 <secondary>what is not installed</secondary>
3243 </indexterm>
3244 Running <emphasis>make install</emphasis> does not copy the Exim 4 conversion script
3245 <emphasis>convert4r4</emphasis>. You will probably run this only once if you are
3246 upgrading from Exim 3. None of the documentation files in the <filename>doc</filename>
3247 directory are copied, except for the info files when you have set
3248 INFO_DIRECTORY, as described in section <xref linkend="SECTinsinfdoc"/> below.
3249 </para>
3250 <para>
3251 For the utility programs, old versions are renamed by adding the suffix <filename>.O</filename>
3252 to their names. The Exim binary itself, however, is handled differently. It is
3253 installed under a name that includes the version number and the compile number,
3254 for example, <filename>exim-4.96.1-1</filename>. The script then arranges for a symbolic link
3255 called <filename>exim</filename> to point to the binary. If you are updating a previous version
3256 of Exim, the script takes care to ensure that the name <filename>exim</filename> is never absent
3257 from the directory (as seen by other processes).
3258 </para>
3259 <para>
3260 <indexterm role="concept">
3261 <primary>installing Exim</primary>
3262 <secondary>testing the script</secondary>
3263 </indexterm>
3264 If you want to see what the <emphasis>make install</emphasis> will do before running it for
3265 real, you can pass the <option>-n</option> option to the installation script by this
3266 command:
3267 </para>
3268 <literallayout class="monospaced">
3269 make INSTALL_ARG=-n install
3270 </literallayout>
3271 <para>
3272 The contents of the variable INSTALL_ARG are passed to the installation
3273 script. You do not need to be root to run this test. Alternatively, you can run
3274 the installation script directly, but this must be from within the build
3275 directory. For example, from the top-level Exim directory you could use this
3276 command:
3277 </para>
3278 <literallayout class="monospaced">
3279 (cd build-SunOS5-5.5.1-sparc; ../scripts/exim_install -n)
3280 </literallayout>
3281 <para>
3282 <indexterm role="concept">
3283 <primary>installing Exim</primary>
3284 <secondary>install script options</secondary>
3285 </indexterm>
3286 There are two other options that can be supplied to the installation script.
3287 </para>
3288 <itemizedlist>
3289 <listitem>
3290 <para>
3291 <option>-no_chown</option> bypasses the call to change the owner of the installed binary
3292 to root, and the call to make it a setuid binary.
3293 </para>
3294 </listitem>
3295 <listitem>
3296 <para>
3297 <option>-no_symlink</option> bypasses the setting up of the symbolic link <filename>exim</filename> to the
3298 installed binary.
3299 </para>
3300 </listitem>
3301 </itemizedlist>
3302 <para>
3303 INSTALL_ARG can be used to pass these options to the script. For example:
3304 </para>
3305 <literallayout class="monospaced">
3306 make INSTALL_ARG=-no_symlink install
3307 </literallayout>
3308 <para>
3309 The installation script can also be given arguments specifying which files are
3310 to be copied. For example, to install just the Exim binary, and nothing else,
3311 without creating the symbolic link, you could use:
3312 </para>
3313 <literallayout class="monospaced">
3314 make INSTALL_ARG='-no_symlink exim' install
3315 </literallayout>
3316 </section>
3317 <section id="SECTinsinfdoc">
3318 <title>Installing info documentation</title>
3319 <para>
3320 <indexterm role="concept">
3321 <primary>installing Exim</primary>
3322 <secondary><emphasis>info</emphasis> documentation</secondary>
3323 </indexterm>
3324 Not all systems use the GNU <emphasis>info</emphasis> system for documentation, and for this
3325 reason, the Texinfo source of Exim&#x2019;s documentation is not included in the main
3326 distribution. Instead it is available separately from the FTP site (see section
3327 <xref linkend="SECTavail"/>).
3328 </para>
3329 <para>
3330 If you have defined INFO_DIRECTORY in <filename>Local/Makefile</filename> and the Texinfo
3331 source of the documentation is found in the source tree, running <literal>make
3332 install</literal> automatically builds the info files and installs them.
3333 </para>
3334 </section>
3335 <section id="SECID33">
3336 <title>Setting up the spool directory</title>
3337 <para>
3338 <indexterm role="concept">
3339 <primary>spool directory</primary>
3340 <secondary>creating</secondary>
3341 </indexterm>
3342 When it starts up, Exim tries to create its spool directory if it does not
3343 exist. The Exim uid and gid are used for the owner and group of the spool
3344 directory. Sub-directories are automatically created in the spool directory as
3345 necessary.
3346 </para>
3347 </section>
3348 <section id="SECID34">
3349 <title>Testing</title>
3350 <para>
3351 <indexterm role="concept">
3352 <primary>testing</primary>
3353 <secondary>installation</secondary>
3354 </indexterm>
3355 Having installed Exim, you can check that the runtime configuration file is
3356 syntactically valid by running the following command, which assumes that the
3357 Exim binary directory is within your PATH environment variable:
3358 </para>
3359 <literallayout class="monospaced">
3360 exim -bV
3361 </literallayout>
3362 <para>
3363 If there are any errors in the configuration file, Exim outputs error messages.
3364 Otherwise it outputs the version number and build date,
3365 the DBM library that is being used, and information about which drivers and
3366 other optional code modules are included in the binary.
3367 Some simple routing tests can be done by using the address testing option. For
3368 example,
3369 </para>
3370 <literallayout>
3371 <literal>exim -bt</literal> &lt;<emphasis>local username</emphasis>&gt;
3372 </literallayout>
3373 <para>
3374 should verify that it recognizes a local mailbox, and
3375 </para>
3376 <literallayout>
3377 <literal>exim -bt</literal> &lt;<emphasis>remote address</emphasis>&gt;
3378 </literallayout>
3379 <para>
3380 a remote one. Then try getting it to deliver mail, both locally and remotely.
3381 This can be done by passing messages directly to Exim, without going through a
3382 user agent. For example:
3383 </para>
3384 <literallayout class="monospaced">
3385 exim -v postmaster@your.domain.example
3386 From: user@your.domain.example
3387 To: postmaster@your.domain.example
3388 Subject: Testing Exim
3389
3390 This is a test message.
3391 ^D
3392 </literallayout>
3393 <para>
3394 The <option>-v</option> option causes Exim to output some verification of what it is doing.
3395 In this case you should see copies of three log lines, one for the message&#x2019;s
3396 arrival, one for its delivery, and one containing <quote>Completed</quote>.
3397 </para>
3398 <para>
3399 <indexterm role="concept">
3400 <primary>delivery</primary>
3401 <secondary>problems with</secondary>
3402 </indexterm>
3403 If you encounter problems, look at Exim&#x2019;s log files (<emphasis>mainlog</emphasis> and
3404 <emphasis>paniclog</emphasis>) to see if there is any relevant information there. Another source
3405 of information is running Exim with debugging turned on, by specifying the
3406 <option>-d</option> option. If a message is stuck on Exim&#x2019;s spool, you can force a delivery
3407 with debugging turned on by a command of the form
3408 </para>
3409 <literallayout>
3410 <literal>exim -d -M</literal> &lt;<emphasis>exim-message-id</emphasis>&gt;
3411 </literallayout>
3412 <para>
3413 You must be root or an <quote>admin user</quote> in order to do this. The <option>-d</option> option
3414 produces rather a lot of output, but you can cut this down to specific areas.
3415 For example, if you use <option>-d-all+route</option> only the debugging information
3416 relevant to routing is included. (See the <option>-d</option> option in chapter
3417 <xref linkend="CHAPcommandline"/> for more details.)
3418 </para>
3419 <para>
3420 <indexterm role="concept">
3421 <primary><quote>sticky</quote> bit</primary>
3422 </indexterm>
3423 <indexterm role="concept">
3424 <primary>lock files</primary>
3425 </indexterm>
3426 One specific problem that has shown up on some sites is the inability to do
3427 local deliveries into a shared mailbox directory, because it does not have the
3428 <quote>sticky bit</quote> set on it. By default, Exim tries to create a lock file before
3429 writing to a mailbox file, and if it cannot create the lock file, the delivery
3430 is deferred. You can get round this either by setting the <quote>sticky bit</quote> on the
3431 directory, or by setting a specific group for local deliveries and allowing
3432 that group to create files in the directory (see the comments above the
3433 <command>local_delivery</command> transport in the default configuration file). Another
3434 approach is to configure Exim not to use lock files, but just to rely on
3435 <function>fcntl()</function> locking instead. However, you should do this only if all user
3436 agents also use <function>fcntl()</function> locking. For further discussion of locking issues,
3437 see chapter <xref linkend="CHAPappendfile"/>.
3438 </para>
3439 <para>
3440 One thing that cannot be tested on a system that is already running an MTA is
3441 the receipt of incoming SMTP mail on the standard SMTP port. However, the
3442 <option>-oX</option> option can be used to run an Exim daemon that listens on some other
3443 port, or <emphasis>inetd</emphasis> can be used to do this. The <option>-bh</option> option and the
3444 <emphasis>exim_checkaccess</emphasis> utility can be used to check out policy controls on
3445 incoming SMTP mail.
3446 </para>
3447 <para>
3448 Testing a new version on a system that is already running Exim can most easily
3449 be done by building a binary with a different CONFIGURE_FILE setting. From
3450 within the runtime configuration, all other file and directory names
3451 that Exim uses can be altered, in order to keep it entirely clear of the
3452 production version.
3453 </para>
3454 </section>
3455 <section id="SECID35">
3456 <title>Replacing another MTA with Exim</title>
3457 <para>
3458 <indexterm role="concept">
3459 <primary>replacing another MTA</primary>
3460 </indexterm>
3461 Building and installing Exim for the first time does not of itself put it in
3462 general use. The name by which the system&#x2019;s MTA is called by mail user agents
3463 is either <filename>/usr/sbin/sendmail</filename>, or <filename>/usr/lib/sendmail</filename> (depending on the
3464 operating system), and it is necessary to make this name point to the <emphasis>exim</emphasis>
3465 binary in order to get the user agents to pass messages to Exim. This is
3466 normally done by renaming any existing file and making <filename>/usr/sbin/sendmail</filename>
3467 or <filename>/usr/lib/sendmail</filename>
3468 <indexterm role="concept">
3469 <primary>symbolic link</primary>
3470 <secondary>to <emphasis>exim</emphasis> binary</secondary>
3471 </indexterm>
3472 a symbolic link to the <emphasis>exim</emphasis> binary. It is a good idea to remove any setuid
3473 privilege and executable status from the old MTA. It is then necessary to stop
3474 and restart the mailer daemon, if one is running.
3475 </para>
3476 <para>
3477 <indexterm role="concept">
3478 <primary>FreeBSD, MTA indirection</primary>
3479 </indexterm>
3480 <indexterm role="concept">
3481 <primary><filename>/etc/mail/mailer.conf</filename></primary>
3482 </indexterm>
3483 Some operating systems have introduced alternative ways of switching MTAs. For
3484 example, if you are running FreeBSD, you need to edit the file
3485 <filename>/etc/mail/mailer.conf</filename> instead of setting up a symbolic link as just
3486 described. A typical example of the contents of this file for running Exim is
3487 as follows:
3488 </para>
3489 <literallayout class="monospaced">
3490 sendmail            /usr/exim/bin/exim
3491 send-mail           /usr/exim/bin/exim
3492 mailq               /usr/exim/bin/exim -bp
3493 newaliases          /usr/bin/true
3494 </literallayout>
3495 <para>
3496 Once you have set up the symbolic link, or edited <filename>/etc/mail/mailer.conf</filename>,
3497 your Exim installation is <quote>live</quote>. Check it by sending a message from your
3498 favourite user agent.
3499 </para>
3500 <para>
3501 You should consider what to tell your users about the change of MTA. Exim may
3502 have different capabilities to what was previously running, and there are
3503 various operational differences such as the text of messages produced by
3504 command line options and in bounce messages. If you allow your users to make
3505 use of Exim&#x2019;s filtering capabilities, you should make the document entitled
3506 <emphasis>Exim&#x2019;s interface to mail filtering</emphasis> available to them.
3507 </para>
3508 </section>
3509 <section id="SECTdaemonLaunch">
3510 <title>Running the daemon</title>
3511 <para>
3512 The most common command line for launching the Exim daemon looks like
3513 </para>
3514 <literallayout class="monospaced">
3515 exim -bd -q5m
3516 </literallayout>
3517 <para>
3518 This starts a daemon which
3519 </para>
3520 <itemizedlist>
3521 <listitem>
3522 <para>
3523 listens for incoming smtp connections, launching handler processes for
3524 each new one
3525 </para>
3526 </listitem>
3527 <listitem>
3528 <para>
3529 starts a queue-runner process every five minutes, to inspect queued messages
3530 and run delivery attempts on any that have arrived at their retry time
3531 </para>
3532 </listitem>
3533 </itemizedlist>
3534 <para>
3535 Should a queue run take longer than the time between queue-runner starts,
3536 they will run in parallel.
3537 Numbers of jobs of the various types are subject to policy controls
3538 defined in the configuration.
3539 </para>
3540 </section>
3541 <section id="SECID36">
3542 <title>Upgrading Exim</title>
3543 <para>
3544 <indexterm role="concept">
3545 <primary>upgrading Exim</primary>
3546 </indexterm>
3547 If you are already running Exim on your host, building and installing a new
3548 version automatically makes it available to MUAs, or any other programs that
3549 call the MTA directly. However, if you are running an Exim daemon, you do need
3550 <indexterm role="concept">
3551 <primary>restart</primary>
3552 <secondary>on HUP signal</secondary>
3553 </indexterm>
3554 <indexterm role="concept">
3555 <primary>signal</primary>
3556 <secondary>HUP, to restart</secondary>
3557 </indexterm>
3558 to send it a HUP signal, to make it re-execute itself, and thereby pick up the
3559 new binary. You do not need to stop processing mail in order to install a new
3560 version of Exim. The install script does not modify an existing runtime
3561 configuration file.
3562 </para>
3563 </section>
3564 <section id="SECID37">
3565 <title>Stopping the Exim daemon on Solaris</title>
3566 <para>
3567 <indexterm role="concept">
3568 <primary>Solaris</primary>
3569 <secondary>stopping Exim on</secondary>
3570 </indexterm>
3571 The standard command for stopping the mailer daemon on Solaris is
3572 </para>
3573 <literallayout class="monospaced">
3574 /etc/init.d/sendmail stop
3575 </literallayout>
3576 <para>
3577 If <filename>/usr/lib/sendmail</filename> has been turned into a symbolic link, this script
3578 fails to stop Exim because it uses the command <emphasis>ps -e</emphasis> and greps the output
3579 for the text <quote>sendmail</quote>; this is not present because the actual program name
3580 (that is, <quote>exim</quote>) is given by the <emphasis>ps</emphasis> command with these options. A
3581 solution is to replace the line that finds the process id with something like
3582 </para>
3583 <literallayout class="monospaced">
3584 pid=`cat /var/spool/exim/exim-daemon.pid`
3585 </literallayout>
3586 <para>
3587 to obtain the daemon&#x2019;s pid directly from the file that Exim saves it in.
3588 </para>
3589 <para>
3590 Note, however, that stopping the daemon does not <quote>stop Exim</quote>. Messages can
3591 still be received from local processes, and if automatic delivery is configured
3592 (the normal case), deliveries will still occur.
3593 </para>
3594 </section>
3595 </chapter>
3596
3597 <chapter id="CHAPcommandline">
3598 <title>The Exim command line</title>
3599 <para>
3600 <indexterm role="concept" id="IIDclo1" class="startofrange">
3601 <primary>command line</primary>
3602 <secondary>options</secondary>
3603 </indexterm>
3604 <indexterm role="concept" id="IIDclo2" class="startofrange">
3605 <primary>options</primary>
3606 <secondary>command line</secondary>
3607 </indexterm>
3608 Exim&#x2019;s command line takes the standard Unix form of a sequence of options,
3609 each starting with a hyphen character, followed by a number of arguments. The
3610 options are compatible with the main options of Sendmail, and there are also
3611 some additional options, some of which are compatible with Smail 3. Certain
3612 combinations of options do not make sense, and provoke an error if used.
3613 The form of the arguments depends on which options are set.
3614 </para>
3615 <section id="SECID38">
3616 <title>Setting options by program name</title>
3617 <para>
3618 <indexterm role="concept">
3619 <primary><emphasis>mailq</emphasis></primary>
3620 </indexterm>
3621 If Exim is called under the name <emphasis>mailq</emphasis>, it behaves as if the option <option>-bp</option>
3622 were present before any other options.
3623 The <option>-bp</option> option requests a listing of the contents of the mail queue on the
3624 standard output.
3625 This feature is for compatibility with some systems that contain a command of
3626 that name in one of the standard libraries, symbolically linked to
3627 <filename>/usr/sbin/sendmail</filename> or <filename>/usr/lib/sendmail</filename>.
3628 </para>
3629 <para>
3630 <indexterm role="concept">
3631 <primary><emphasis>rsmtp</emphasis></primary>
3632 </indexterm>
3633 If Exim is called under the name <emphasis>rsmtp</emphasis> it behaves as if the option <option>-bS</option>
3634 were present before any other options, for compatibility with Smail. The
3635 <option>-bS</option> option is used for reading in a number of messages in batched SMTP
3636 format.
3637 </para>
3638 <para>
3639 <indexterm role="concept">
3640 <primary><emphasis>rmail</emphasis></primary>
3641 </indexterm>
3642 If Exim is called under the name <emphasis>rmail</emphasis> it behaves as if the <option>-i</option> and
3643 <option>-oee</option> options were present before any other options, for compatibility with
3644 Smail. The name <emphasis>rmail</emphasis> is used as an interface by some UUCP systems.
3645 </para>
3646 <para>
3647 <indexterm role="concept">
3648 <primary><emphasis>runq</emphasis></primary>
3649 </indexterm>
3650 <indexterm role="concept">
3651 <primary>queue runner</primary>
3652 </indexterm>
3653 If Exim is called under the name <emphasis>runq</emphasis> it behaves as if the option <option>-q</option>
3654 were present before any other options, for compatibility with Smail. The <option>-q</option>
3655 option causes a single queue runner process to be started.
3656 </para>
3657 <para>
3658 <indexterm role="concept">
3659 <primary><emphasis>newaliases</emphasis></primary>
3660 </indexterm>
3661 <indexterm role="concept">
3662 <primary>alias file</primary>
3663 <secondary>building</secondary>
3664 </indexterm>
3665 <indexterm role="concept">
3666 <primary>Sendmail compatibility</primary>
3667 <secondary>calling Exim as <emphasis>newaliases</emphasis></secondary>
3668 </indexterm>
3669 If Exim is called under the name <emphasis>newaliases</emphasis> it behaves as if the option
3670 <option>-bi</option> were present before any other options, for compatibility with Sendmail.
3671 This option is used for rebuilding Sendmail&#x2019;s alias file. Exim does not have
3672 the concept of a single alias file, but can be configured to run a given
3673 command if called with the <option>-bi</option> option.
3674 </para>
3675 </section>
3676 <section id="SECTtrustedadmin">
3677 <title>Trusted and admin users</title>
3678 <para>
3679 Some Exim options are available only to <emphasis>trusted users</emphasis> and others are
3680 available only to <emphasis>admin users</emphasis>. In the description below, the phrases <quote>Exim
3681 user</quote> and <quote>Exim group</quote> mean the user and group defined by EXIM_USER and
3682 EXIM_GROUP in <filename>Local/Makefile</filename> or set by the <option>exim_user</option> and
3683 <option>exim_group</option> options. These do not necessarily have to use the name <quote>exim</quote>.
3684 </para>
3685 <itemizedlist>
3686 <listitem>
3687 <para>
3688 <indexterm role="concept">
3689 <primary>trusted users</primary>
3690 <secondary>definition of</secondary>
3691 </indexterm>
3692 <indexterm role="concept">
3693 <primary>user</primary>
3694 <secondary>trusted definition of</secondary>
3695 </indexterm>
3696 The trusted users are root, the Exim user, any user listed in the
3697 <option>trusted_users</option> configuration option, and any user whose current group or any
3698 supplementary group is one of those listed in the <option>trusted_groups</option>
3699 configuration option. Note that the Exim group is not automatically trusted.
3700 </para>
3701 <para>
3702 <indexterm role="concept">
3703 <primary><quote>From</quote> line</primary>
3704 </indexterm>
3705 <indexterm role="concept">
3706 <primary>envelope from</primary>
3707 </indexterm>
3708 <indexterm role="concept">
3709 <primary>envelope sender</primary>
3710 </indexterm>
3711 Trusted users are always permitted to use the <option>-f</option> option or a leading
3712 <quote>From&nbsp;</quote> line to specify the envelope sender of a message that is passed to
3713 Exim through the local interface (see the <option>-bm</option> and <option>-f</option> options below).
3714 See the <option>untrusted_set_sender</option> option for a way of permitting non-trusted
3715 users to set envelope senders.
3716 </para>
3717 <para>
3718 <indexterm role="concept">
3719 <primary><emphasis>From:</emphasis> header line</primary>
3720 </indexterm>
3721 <indexterm role="concept">
3722 <primary>header lines</primary>
3723 <secondary>From:</secondary>
3724 </indexterm>
3725 <indexterm role="concept">
3726 <primary><emphasis>Sender:</emphasis> header line</primary>
3727 </indexterm>
3728 <indexterm role="concept">
3729 <primary>header lines</primary>
3730 <secondary>Sender:</secondary>
3731 </indexterm>
3732 For a trusted user, there is never any check on the contents of the <emphasis>From:</emphasis>
3733 header line, and a <emphasis>Sender:</emphasis> line is never added. Furthermore, any existing
3734 <emphasis>Sender:</emphasis> line in incoming local (non-TCP/IP) messages is not removed.
3735 </para>
3736 <para>
3737 Trusted users may also specify a host name, host address, interface address,
3738 protocol name, ident value, and authentication data when submitting a message
3739 locally. Thus, they are able to insert messages into Exim&#x2019;s queue locally that
3740 have the characteristics of messages received from a remote host. Untrusted
3741 users may in some circumstances use <option>-f</option>, but can never set the other values
3742 that are available to trusted users.
3743 </para>
3744 </listitem>
3745 <listitem>
3746 <para>
3747 <indexterm role="concept">
3748 <primary>user</primary>
3749 <secondary>admin definition of</secondary>
3750 </indexterm>
3751 <indexterm role="concept">
3752 <primary>admin user</primary>
3753 <secondary>definition of</secondary>
3754 </indexterm>
3755 The admin users are root, the Exim user, and any user that is a member of the
3756 Exim group or of any group listed in the <option>admin_groups</option> configuration option.
3757 The current group does not have to be one of these groups.
3758 </para>
3759 <para>
3760 Admin users are permitted to list the queue, and to carry out certain
3761 operations on messages, for example, to force delivery failures. It is also
3762 necessary to be an admin user in order to see the full information provided by
3763 the Exim monitor, and full debugging output.
3764 </para>
3765 <para>
3766 By default, the use of the <option>-M</option>, <option>-q</option>, <option>-R</option>, and <option>-S</option> options to cause
3767 Exim to attempt delivery of messages on its queue is restricted to admin users.
3768 However, this restriction can be relaxed by setting the <option>prod_requires_admin</option>
3769 option false (that is, specifying <option>no_prod_requires_admin</option>).
3770 </para>
3771 <para>
3772 Similarly, the use of the <option>-bp</option> option to list all the messages in the queue
3773 is restricted to admin users unless <option>queue_list_requires_admin</option> is set
3774 false.
3775 </para>
3776 </listitem>
3777 </itemizedlist>
3778 <para>
3779 <emphasis role="bold">Warning</emphasis>: If you configure your system so that admin users are able to
3780 edit Exim&#x2019;s configuration file, you are giving those users an easy way of
3781 getting root. There is further discussion of this issue at the start of chapter
3782 <xref linkend="CHAPconf"/>.
3783 </para>
3784 </section>
3785 <section id="SECID39">
3786 <title>Command line options</title>
3787 <para>
3788 Exim&#x2019;s command line options are described in alphabetical order below. If none
3789 of the options that specifies a specific action (such as starting the daemon or
3790 a queue runner, or testing an address, or receiving a message in a specific
3791 format, or listing the queue) are present, and there is at least one argument
3792 on the command line, <option>-bm</option> (accept a local message on the standard input,
3793 with the arguments specifying the recipients) is assumed. Otherwise, Exim
3794 outputs a brief message about itself and exits.
3795 </para>
3796 <!-- === Start of command line options === -->
3797 <variablelist>
3798 <varlistentry>
3799 <term><option>--</option></term>
3800 <listitem>
3801 <para>
3802 <indexterm role="option">
3803 <primary>--</primary>
3804 </indexterm>
3805 <indexterm role="concept">
3806 <primary>options</primary>
3807 <secondary>command line; terminating</secondary>
3808 </indexterm>
3809 This is a pseudo-option whose only purpose is to terminate the options and
3810 therefore to cause subsequent command line items to be treated as arguments
3811 rather than options, even if they begin with hyphens.
3812 </para>
3813 </listitem></varlistentry>
3814 <varlistentry>
3815 <term><option>--help</option></term>
3816 <listitem>
3817 <para>
3818 <indexterm role="option">
3819 <primary><option>--help</option></primary>
3820 </indexterm>
3821 This option causes Exim to output a few sentences stating what it is.
3822 The same output is generated if the Exim binary is called with no options and
3823 no arguments.
3824 </para>
3825 </listitem></varlistentry>
3826 <varlistentry>
3827 <term><option>--version</option></term>
3828 <listitem>
3829 <para>
3830 <indexterm role="option">
3831 <primary><option>--version</option></primary>
3832 </indexterm>
3833 This option is an alias for <option>-bV</option> and causes version information to be
3834 displayed.
3835 </para>
3836 </listitem></varlistentry>
3837 <varlistentry>
3838 <term><option>-Ac</option></term>
3839 <term><option>-Am</option></term>
3840 <listitem>
3841 <para>
3842 <indexterm role="option">
3843 <primary><option>-Ac</option></primary>
3844 </indexterm>
3845 <indexterm role="option">
3846 <primary><option>-Am</option></primary>
3847 </indexterm>
3848 These options are used by Sendmail for selecting configuration files and are
3849 ignored by Exim.
3850 </para>
3851 </listitem></varlistentry>
3852 <varlistentry>
3853 <term><option>-B</option>&lt;<emphasis>type</emphasis>&gt;</term>
3854 <listitem>
3855 <para>
3856 <indexterm role="option">
3857 <primary><option>-B</option></primary>
3858 </indexterm>
3859 <indexterm role="concept">
3860 <primary>8-bit characters</primary>
3861 </indexterm>
3862 <indexterm role="concept">
3863 <primary>Sendmail compatibility</primary>
3864 <secondary>8-bit characters</secondary>
3865 </indexterm>
3866 This is a Sendmail option for selecting 7 or 8 bit processing. Exim is 8-bit
3867 clean; it ignores this option.
3868 </para>
3869 </listitem></varlistentry>
3870 <varlistentry>
3871 <term><option>-bd</option></term>
3872 <listitem>
3873 <para>
3874 <indexterm role="option">
3875 <primary><option>-bd</option></primary>
3876 </indexterm>
3877 <indexterm role="concept">
3878 <primary>daemon</primary>
3879 </indexterm>
3880 <indexterm role="concept">
3881 <primary>SMTP</primary>
3882 <secondary>listener</secondary>
3883 </indexterm>
3884 <indexterm role="concept">
3885 <primary>queue runner</primary>
3886 </indexterm>
3887 This option runs Exim as a daemon, awaiting incoming SMTP connections. Usually
3888 the <option>-bd</option> option is combined with the <option>-q</option>&lt;<emphasis>time</emphasis>&gt; option, to specify
3889 that the daemon should also initiate periodic queue runs.
3890 </para>
3891 <para>
3892 The <option>-bd</option> option can be used only by an admin user. If either of the <option>-d</option>
3893 (debugging) or <option>-v</option> (verifying) options are set, the daemon does not
3894 disconnect from the controlling terminal. When running this way, it can be
3895 stopped by pressing ctrl-C.
3896 </para>
3897 <para>
3898 By default, Exim listens for incoming connections to the standard SMTP port on
3899 all the host&#x2019;s running interfaces. However, it is possible to listen on other
3900 ports, on multiple ports, and only on specific interfaces. Chapter
3901 <xref linkend="CHAPinterfaces"/> contains a description of the options that control this.
3902 </para>
3903 <para>
3904 When a listening daemon
3905 <indexterm role="concept">
3906 <primary>daemon</primary>
3907 <secondary>process id (pid)</secondary>
3908 </indexterm>
3909 <indexterm role="concept">
3910 <primary>pid (process id)</primary>
3911 <secondary>of daemon</secondary>
3912 </indexterm>
3913 is started without the use of <option>-oX</option> (that is, without overriding the normal
3914 configuration), it writes its process id to a file called <filename>exim-daemon.pid</filename>
3915 in Exim&#x2019;s spool directory. This location can be overridden by setting
3916 PID_FILE_PATH in <filename>Local/Makefile</filename>. The file is written while Exim is still
3917 running as root.
3918 </para>
3919 <para>
3920 When <option>-oX</option> is used on the command line to start a listening daemon, the
3921 process id is not written to the normal pid file path. However, <option>-oP</option> can be
3922 used to specify a path on the command line if a pid file is required.
3923 </para>
3924 <para>
3925 The SIGHUP signal
3926 <indexterm role="concept">
3927 <primary>SIGHUP</primary>
3928 </indexterm>
3929 <indexterm role="concept">
3930 <primary>restart</primary>
3931 <secondary>on HUP signal</secondary>
3932 </indexterm>
3933 <indexterm role="concept">
3934 <primary>signal</primary>
3935 <secondary>HUP, to restart</secondary>
3936 </indexterm>
3937 <indexterm role="concept">
3938 <primary>daemon</primary>
3939 <secondary>restarting</secondary>
3940 </indexterm>
3941 <indexterm role="concept">
3942 <primary>signal</primary>
3943 <secondary>to reload configuration</secondary>
3944 </indexterm>
3945 <indexterm role="concept">
3946 <primary>daemon</primary>
3947 <secondary>reload configuration</secondary>
3948 </indexterm>
3949 <indexterm role="concept">
3950 <primary>reload</primary>
3951 <secondary>configuration</secondary>
3952 </indexterm>
3953 can be used to cause the daemon to re-execute itself. This should be done
3954 whenever Exim&#x2019;s configuration file, or any file that is incorporated into it by
3955 means of the <option>.include</option> facility, is changed, and also whenever a new version
3956 of Exim is installed. It is not necessary to do this when other files that are
3957 referenced from the configuration (for example, alias files) are changed,
3958 because these are reread each time they are used.
3959 </para>
3960 </listitem></varlistentry>
3961 <varlistentry>
3962 <term><option>-bdf</option></term>
3963 <listitem>
3964 <para>
3965 <indexterm role="option">
3966 <primary><option>-bdf</option></primary>
3967 </indexterm>
3968 This option has the same effect as <option>-bd</option> except that it never disconnects
3969 from the controlling terminal, even when no debugging is specified.
3970 </para>
3971 </listitem></varlistentry>
3972 <varlistentry>
3973 <term><option>-be</option></term>
3974 <listitem>
3975 <para>
3976 <indexterm role="option">
3977 <primary><option>-be</option></primary>
3978 </indexterm>
3979 <indexterm role="concept">
3980 <primary>testing</primary>
3981 <secondary>string expansion</secondary>
3982 </indexterm>
3983 <indexterm role="concept">
3984 <primary>expansion</primary>
3985 <secondary>testing</secondary>
3986 </indexterm>
3987 Run Exim in expansion testing mode. Exim discards its root privilege, to
3988 prevent ordinary users from using this mode to read otherwise inaccessible
3989 files. If no arguments are given, Exim runs interactively, prompting for lines
3990 of data. Otherwise, it processes each argument in turn.
3991 </para>
3992 <para>
3993 If Exim was built with USE_READLINE=yes in <filename>Local/Makefile</filename>, it tries
3994 to load the <option>libreadline</option> library dynamically whenever the <option>-be</option> option is
3995 used without command line arguments. If successful, it uses the <function>readline()</function>
3996 function, which provides extensive line-editing facilities, for reading the
3997 test data. A line history is supported.
3998 </para>
3999 <para>
4000 Long expansion expressions can be split over several lines by using backslash
4001 continuations. As in Exim&#x2019;s runtime configuration, white space at the start of
4002 continuation lines is ignored. Each argument or data line is passed through the
4003 string expansion mechanism, and the result is output. Variable values from the
4004 configuration file (for example, <varname>$qualify_domain</varname>) are available, but no
4005 message-specific values (such as <varname>$message_exim_id</varname>) are set, because no message
4006 is being processed (but see <option>-bem</option> and <option>-Mset</option>).
4007 </para>
4008 <para>
4009 <emphasis role="bold">Note</emphasis>: If you use this mechanism to test lookups, and you change the data
4010 files or databases you are using, you must exit and restart Exim before trying
4011 the same lookup again. Otherwise, because each Exim process caches the results
4012 of lookups, you will just get the same result as before.
4013 </para>
4014 <para>
4015 Macro processing is done on lines before string-expansion: new macros can be
4016 defined and macros will be expanded.
4017 Because macros in the config file are often used for secrets, those are only
4018 available to admin users.
4019 </para>
4020 </listitem></varlistentry>
4021 <varlistentry>
4022 <term><option>-bem</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4023 <listitem>
4024 <para>
4025 <indexterm role="option">
4026 <primary><option>-bem</option></primary>
4027 </indexterm>
4028 <indexterm role="concept">
4029 <primary>testing</primary>
4030 <secondary>string expansion</secondary>
4031 </indexterm>
4032 <indexterm role="concept">
4033 <primary>expansion</primary>
4034 <secondary>testing</secondary>
4035 </indexterm>
4036 This option operates like <option>-be</option> except that it must be followed by the name
4037 of a file. For example:
4038 </para>
4039 <literallayout class="monospaced">
4040 exim -bem /tmp/testmessage
4041 </literallayout>
4042 <para>
4043 The file is read as a message (as if receiving a locally-submitted non-SMTP
4044 message) before any of the test expansions are done. Thus, message-specific
4045 variables such as <varname>$message_size</varname> and <varname>$header_from:</varname> are available. However,
4046 no <emphasis>Received:</emphasis> header is added to the message. If the <option>-t</option> option is set,
4047 recipients are read from the headers in the normal way, and are shown in the
4048 <varname>$recipients</varname> variable. Note that recipients cannot be given on the command
4049 line, because further arguments are taken as strings to expand (just like
4050 <option>-be</option>).
4051 </para>
4052 </listitem></varlistentry>
4053 <varlistentry>
4054 <term><option>-bF</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4055 <listitem>
4056 <para>
4057 <indexterm role="option">
4058 <primary><option>-bF</option></primary>
4059 </indexterm>
4060 <indexterm role="concept">
4061 <primary>system filter</primary>
4062 <secondary>testing</secondary>
4063 </indexterm>
4064 <indexterm role="concept">
4065 <primary>testing</primary>
4066 <secondary>system filter</secondary>
4067 </indexterm>
4068 This option is the same as <option>-bf</option> except that it assumes that the filter being
4069 tested is a system filter. The additional commands that are available only in
4070 system filters are recognized.
4071 </para>
4072 </listitem></varlistentry>
4073 <varlistentry>
4074 <term><option>-bf</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4075 <listitem>
4076 <para>
4077 <indexterm role="option">
4078 <primary><option>-bf</option></primary>
4079 </indexterm>
4080 <indexterm role="concept">
4081 <primary>filter</primary>
4082 <secondary>testing</secondary>
4083 </indexterm>
4084 <indexterm role="concept">
4085 <primary>testing</primary>
4086 <secondary>filter file</secondary>
4087 </indexterm>
4088 <indexterm role="concept">
4089 <primary>forward file</primary>
4090 <secondary>testing</secondary>
4091 </indexterm>
4092 <indexterm role="concept">
4093 <primary>testing</primary>
4094 <secondary>forward file</secondary>
4095 </indexterm>
4096 <indexterm role="concept">
4097 <primary>Sieve filter</primary>
4098 <secondary>testing</secondary>
4099 </indexterm>
4100 This option runs Exim in user filter testing mode; the file is the filter file
4101 to be tested, and a test message must be supplied on the standard input. If
4102 there are no message-dependent tests in the filter, an empty file can be
4103 supplied.
4104 </para>
4105 <para>
4106 If you want to test a system filter file, use <option>-bF</option> instead of <option>-bf</option>. You
4107 can use both <option>-bF</option> and <option>-bf</option> on the same command, in order to test a system
4108 filter and a user filter in the same run. For example:
4109 </para>
4110 <literallayout class="monospaced">
4111 exim -bF /system/filter -bf /user/filter &lt;/test/message
4112 </literallayout>
4113 <para>
4114 This is helpful when the system filter adds header lines or sets filter
4115 variables that are used by the user filter.
4116 </para>
4117 <para>
4118 If the test filter file does not begin with one of the special lines
4119 </para>
4120 <literallayout class="monospaced">
4121 # Exim filter
4122 # Sieve filter
4123 </literallayout>
4124 <para>
4125 it is taken to be a normal <filename>.forward</filename> file, and is tested for validity under
4126 that interpretation. See sections <xref linkend="SECTitenonfilred"/> to
4127 <xref linkend="SECTspecitredli"/> for a description of the possible contents of non-filter
4128 redirection lists.
4129 </para>
4130 <para>
4131 The result of an Exim command that uses <option>-bf</option>, provided no errors are
4132 detected, is a list of the actions that Exim would try to take if presented
4133 with the message for real. More details of filter testing are given in the
4134 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
4135 </para>
4136 <para>
4137 When testing a filter file,
4138 <indexterm role="concept">
4139 <primary><quote>From</quote> line</primary>
4140 </indexterm>
4141 <indexterm role="concept">
4142 <primary>envelope from</primary>
4143 </indexterm>
4144 <indexterm role="concept">
4145 <primary>envelope sender</primary>
4146 </indexterm>
4147 <indexterm role="option">
4148 <primary><option>-f</option></primary>
4149 <secondary>for filter testing</secondary>
4150 </indexterm>
4151 the envelope sender can be set by the <option>-f</option> option,
4152 or by a <quote>From&nbsp;</quote> line at the start of the test message. Various parameters
4153 that would normally be taken from the envelope recipient address of the message
4154 can be set by means of additional command line options (see the next four
4155 options).
4156 </para>
4157 </listitem></varlistentry>
4158 <varlistentry>
4159 <term><option>-bfd</option>&nbsp;&lt;<emphasis>domain</emphasis>&gt;</term>
4160 <listitem>
4161 <para>
4162 <indexterm role="option">
4163 <primary><option>-bfd</option></primary>
4164 </indexterm>
4165 <indexterm role="variable">
4166 <primary><varname>$qualify_domain</varname></primary>
4167 </indexterm>
4168 This sets the domain of the recipient address when a filter file is being
4169 tested by means of the <option>-bf</option> option. The default is the value of
4170 <varname>$qualify_domain</varname>.
4171 </para>
4172 </listitem></varlistentry>
4173 <varlistentry>
4174 <term><option>-bfl</option>&nbsp;&lt;<emphasis>local&nbsp;part</emphasis>&gt;</term>
4175 <listitem>
4176 <para>
4177 <indexterm role="option">
4178 <primary><option>-bfl</option></primary>
4179 </indexterm>
4180 This sets the local part of the recipient address when a filter file is being
4181 tested by means of the <option>-bf</option> option. The default is the username of the
4182 process that calls Exim. A local part should be specified with any prefix or
4183 suffix stripped, because that is how it appears to the filter when a message is
4184 actually being delivered.
4185 </para>
4186 </listitem></varlistentry>
4187 <varlistentry>
4188 <term><option>-bfp</option>&nbsp;&lt;<emphasis>prefix</emphasis>&gt;</term>
4189 <listitem>
4190 <para>
4191 <indexterm role="option">
4192 <primary><option>-bfp</option></primary>
4193 </indexterm>
4194 <indexterm role="concept">
4195 <primary>affix</primary>
4196 <secondary>filter testing</secondary>
4197 </indexterm>
4198 This sets the prefix of the local part of the recipient address when a filter
4199 file is being tested by means of the <option>-bf</option> option. The default is an empty
4200 prefix.
4201 </para>
4202 </listitem></varlistentry>
4203 <varlistentry>
4204 <term><option>-bfs</option>&nbsp;&lt;<emphasis>suffix</emphasis>&gt;</term>
4205 <listitem>
4206 <para>
4207 <indexterm role="option">
4208 <primary><option>-bfs</option></primary>
4209 </indexterm>
4210 <indexterm role="concept">
4211 <primary>affix</primary>
4212 <secondary>filter testing</secondary>
4213 </indexterm>
4214 This sets the suffix of the local part of the recipient address when a filter
4215 file is being tested by means of the <option>-bf</option> option. The default is an empty
4216 suffix.
4217 </para>
4218 </listitem></varlistentry>
4219 <varlistentry>
4220 <term><option>-bh</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4221 <listitem>
4222 <para>
4223 <indexterm role="option">
4224 <primary><option>-bh</option></primary>
4225 </indexterm>
4226 <indexterm role="concept">
4227 <primary>testing</primary>
4228 <secondary>incoming SMTP</secondary>
4229 </indexterm>
4230 <indexterm role="concept">
4231 <primary>SMTP</primary>
4232 <secondary>testing incoming</secondary>
4233 </indexterm>
4234 <indexterm role="concept">
4235 <primary>testing</primary>
4236 <secondary>relay control</secondary>
4237 </indexterm>
4238 <indexterm role="concept">
4239 <primary>relaying</primary>
4240 <secondary>testing configuration</secondary>
4241 </indexterm>
4242 <indexterm role="concept">
4243 <primary>policy control</primary>
4244 <secondary>testing</secondary>
4245 </indexterm>
4246 <indexterm role="concept">
4247 <primary>debugging</primary>
4248 <secondary><option>-bh</option> option</secondary>
4249 </indexterm>
4250 This option runs a fake SMTP session as if from the given IP address, using the
4251 standard input and output. The IP address may include a port number at the end,
4252 after a full stop. For example:
4253 </para>
4254 <literallayout class="monospaced">
4255 exim -bh 10.9.8.7.1234
4256 exim -bh fe80::a00:20ff:fe86:a061.5678
4257 </literallayout>
4258 <para>
4259 When an IPv6 address is given, it is converted into canonical form. In the case
4260 of the second example above, the value of <varname>$sender_host_address</varname> after
4261 conversion to the canonical form is
4262 <literal>fe80:0000:0000:0a00:20ff:fe86:a061.5678</literal>.
4263 </para>
4264 <para>
4265 Comments as to what is going on are written to the standard error file. These
4266 include lines beginning with <quote>LOG</quote> for anything that would have been logged.
4267 This facility is provided for testing configuration options for incoming
4268 messages, to make sure they implement the required policy. For example, you can
4269 test your relay controls using <option>-bh</option>.
4270 </para>
4271 <para>
4272 <emphasis role="bold">Warning 1</emphasis>:
4273 <indexterm role="concept">
4274 <primary>RFC 1413</primary>
4275 </indexterm>
4276 You can test features of the configuration that rely on ident (RFC 1413)
4277 information by using the <option>-oMt</option> option. However, Exim cannot actually perform
4278 an ident callout when testing using <option>-bh</option> because there is no incoming SMTP
4279 connection.
4280 </para>
4281 <para>
4282 <emphasis role="bold">Warning 2</emphasis>: Address verification callouts (see section <xref linkend="SECTcallver"/>)
4283 are also skipped when testing using <option>-bh</option>. If you want these callouts to
4284 occur, use <option>-bhc</option> instead.
4285 </para>
4286 <para>
4287 Messages supplied during the testing session are discarded, and nothing is
4288 written to any of the real log files. There may be pauses when DNS (and other)
4289 lookups are taking place, and of course these may time out. The <option>-oMi</option> option
4290 can be used to specify a specific IP interface and port if this is important,
4291 and <option>-oMaa</option> and <option>-oMai</option> can be used to set parameters as if the SMTP
4292 session were authenticated.
4293 </para>
4294 <para>
4295 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option> whose
4296 output just states whether a given recipient address from a given host is
4297 acceptable or not. See section <xref linkend="SECTcheckaccess"/>.
4298 </para>
4299 <para>
4300 Features such as authentication and encryption, where the client input is not
4301 plain text, cannot easily be tested with <option>-bh</option>. Instead, you should use a
4302 specialized SMTP test program such as
4303 <emphasis role="bold"><ulink url="https://www.jetmore.org/john/code/swaks/">swaks</ulink></emphasis>.
4304 </para>
4305 </listitem></varlistentry>
4306 <varlistentry>
4307 <term><option>-bhc</option>&nbsp;&lt;<emphasis>IP&nbsp;address</emphasis>&gt;</term>
4308 <listitem>
4309 <para>
4310 <indexterm role="option">
4311 <primary><option>-bhc</option></primary>
4312 </indexterm>
4313 This option operates in the same way as <option>-bh</option>, except that address
4314 verification callouts are performed if required. This includes consulting and
4315 updating the callout cache database.
4316 </para>
4317 </listitem></varlistentry>
4318 <varlistentry>
4319 <term><option>-bi</option></term>
4320 <listitem>
4321 <para>
4322 <indexterm role="option">
4323 <primary><option>-bi</option></primary>
4324 </indexterm>
4325 <indexterm role="concept">
4326 <primary>alias file</primary>
4327 <secondary>building</secondary>
4328 </indexterm>
4329 <indexterm role="concept">
4330 <primary>building alias file</primary>
4331 </indexterm>
4332 <indexterm role="concept">
4333 <primary>Sendmail compatibility</primary>
4334 <secondary><option>-bi</option> option</secondary>
4335 </indexterm>
4336 Sendmail interprets the <option>-bi</option> option as a request to rebuild its alias file.
4337 Exim does not have the concept of a single alias file, and so it cannot mimic
4338 this behaviour. However, calls to <filename>/usr/lib/sendmail</filename> with the <option>-bi</option> option
4339 tend to appear in various scripts such as NIS make files, so the option must be
4340 recognized.
4341 </para>
4342 <para>
4343 If <option>-bi</option> is encountered, the command specified by the <option>bi_command</option>
4344 configuration option is run, under the uid and gid of the caller of Exim. If
4345 the <option>-oA</option> option is used, its value is passed to the command as an argument.
4346 The command set by <option>bi_command</option> may not contain arguments. The command can
4347 use the <emphasis>exim_dbmbuild</emphasis> utility, or some other means, to rebuild alias files
4348 if this is required. If the <option>bi_command</option> option is not set, calling Exim with
4349 <option>-bi</option> is a no-op.
4350 </para>
4351 </listitem></varlistentry>
4352 <varlistentry>
4353 <term><option>-bI:help</option></term>
4354 <listitem>
4355 <para>
4356 <indexterm role="option">
4357 <primary><option>-bI:help</option></primary>
4358 </indexterm>
4359 <indexterm role="concept">
4360 <primary>querying exim information</primary>
4361 </indexterm>
4362 We shall provide various options starting <literal>-bI:</literal> for querying Exim for
4363 information.  The output of many of these will be intended for machine
4364 consumption.  This one is not.  The <option>-bI:help</option> option asks Exim for a
4365 synopsis of supported options beginning <literal>-bI:</literal>.  Use of any of these
4366 options shall cause Exim to exit after producing the requested output.
4367 </para>
4368 </listitem></varlistentry>
4369 <varlistentry>
4370 <term><option>-bI:dscp</option></term>
4371 <listitem>
4372 <para>
4373 <indexterm role="option">
4374 <primary><option>-bI:dscp</option></primary>
4375 </indexterm>
4376 <indexterm role="concept">
4377 <primary>DSCP</primary>
4378 <secondary>values</secondary>
4379 </indexterm>
4380 This option causes Exim to emit an alphabetically sorted list of all
4381 recognised DSCP names.
4382 </para>
4383 </listitem></varlistentry>
4384 <varlistentry>
4385 <term><option>-bI:sieve</option></term>
4386 <listitem>
4387 <para>
4388 <indexterm role="option">
4389 <primary><option>-bI:sieve</option></primary>
4390 </indexterm>
4391 <indexterm role="concept">
4392 <primary>Sieve filter</primary>
4393 <secondary>capabilities</secondary>
4394 </indexterm>
4395 This option causes Exim to emit an alphabetically sorted list of all supported
4396 Sieve protocol extensions on stdout, one per line.  This is anticipated to be
4397 useful for ManageSieve (RFC 5804) implementations, in providing that protocol&#x2019;s
4398 <literal>SIEVE</literal> capability response line.  As the precise list may depend upon
4399 compile-time build options, which this option will adapt to, this is the only
4400 way to guarantee a correct response.
4401 </para>
4402 </listitem></varlistentry>
4403 <varlistentry>
4404 <term><option>-bm</option></term>
4405 <listitem>
4406 <para>
4407 <indexterm role="option">
4408 <primary><option>-bm</option></primary>
4409 </indexterm>
4410 <indexterm role="concept">
4411 <primary>local message reception</primary>
4412 </indexterm>
4413 This option runs an Exim receiving process that accepts an incoming,
4414 locally-generated message on the standard input. The recipients are given as the
4415 command arguments (except when <option>-t</option> is also present &ndash; see below). Each
4416 argument can be a comma-separated list of RFC 2822 addresses. This is the
4417 default option for selecting the overall action of an Exim call; it is assumed
4418 if no other conflicting option is present.
4419 </para>
4420 <para>
4421 If any addresses in the message are unqualified (have no domain), they are
4422 qualified by the values of the <option>qualify_domain</option> or <option>qualify_recipient</option>
4423 options, as appropriate. The <option>-bnq</option> option (see below) provides a way of
4424 suppressing this for special cases.
4425 </para>
4426 <para>
4427 Policy checks on the contents of local messages can be enforced by means of
4428 the non-SMTP ACL. See chapter <xref linkend="CHAPACL"/> for details.
4429 </para>
4430 <para>
4431 <indexterm role="concept">
4432 <primary>return code</primary>
4433 <secondary>for <option>-bm</option></secondary>
4434 </indexterm>
4435 The return code is zero if the message is successfully accepted. Otherwise, the
4436 action is controlled by the <option>-oe</option><emphasis>x</emphasis> option setting &ndash; see below.
4437 </para>
4438 <para>
4439 The format
4440 <indexterm role="concept">
4441 <primary>message</primary>
4442 <secondary>format</secondary>
4443 </indexterm>
4444 <indexterm role="concept">
4445 <primary>format</primary>
4446 <secondary>message</secondary>
4447 </indexterm>
4448 <indexterm role="concept">
4449 <primary><quote>From</quote> line</primary>
4450 </indexterm>
4451 <indexterm role="concept">
4452 <primary>UUCP</primary>
4453 <secondary><quote>From</quote> line</secondary>
4454 </indexterm>
4455 <indexterm role="concept">
4456 <primary>Sendmail compatibility</primary>
4457 <secondary><quote>From</quote> line</secondary>
4458 </indexterm>
4459 of the message must be as defined in RFC 2822, except that, for
4460 compatibility with Sendmail and Smail, a line in one of the forms
4461 </para>
4462 <literallayout class="monospaced">
4463 From sender Fri Jan  5 12:55 GMT 1997
4464 From sender Fri, 5 Jan 97 12:55:01
4465 </literallayout>
4466 <para>
4467 (with the weekday optional, and possibly with additional text after the date)
4468 is permitted to appear at the start of the message. There appears to be no
4469 authoritative specification of the format of this line. Exim recognizes it by
4470 matching against the regular expression defined by the <option>uucp_from_pattern</option>
4471 option, which can be changed if necessary.
4472 </para>
4473 <para>
4474 <indexterm role="option">
4475 <primary><option>-f</option></primary>
4476 <secondary>overriding <quote>From</quote> line</secondary>
4477 </indexterm>
4478 The specified sender is treated as if it were given as the argument to the
4479 <option>-f</option> option, but if a <option>-f</option> option is also present, its argument is used in
4480 preference to the address taken from the message. The caller of Exim must be a
4481 trusted user for the sender of a message to be set in this way.
4482 </para>
4483 </listitem></varlistentry>
4484 <varlistentry>
4485 <term><option>-bmalware</option>&nbsp;&lt;<emphasis>filename</emphasis>&gt;</term>
4486 <listitem>
4487 <para>
4488 <indexterm role="option">
4489 <primary><option>-bmalware</option></primary>
4490 </indexterm>
4491 <indexterm role="concept">
4492 <primary>testing</primary>
4493 <secondary>,</secondary>
4494 </indexterm>
4495 <indexterm role="concept">
4496 <primary>malware scan test</primary>
4497 </indexterm>
4498 This debugging option causes Exim to scan the given file or directory
4499 (depending on the used scanner interface),
4500 using the malware scanning framework.  The option of <option>av_scanner</option> influences
4501 this option, so if <option>av_scanner</option>&#x2019;s value is dependent upon an expansion then
4502 the expansion should have defaults which apply to this invocation.  ACLs are
4503 not invoked, so if <option>av_scanner</option> references an ACL variable then that variable
4504 will never be populated and <option>-bmalware</option> will fail.
4505 </para>
4506 <para>
4507 Exim will have changed working directory before resolving the filename, so
4508 using fully qualified pathnames is advisable.  Exim will be running as the Exim
4509 user when it tries to open the file, rather than as the invoking user.
4510 This option requires admin privileges.
4511 </para>
4512 <para>
4513 The <option>-bmalware</option> option will not be extended to be more generally useful,
4514 there are better tools for file-scanning.  This option exists to help
4515 administrators verify their Exim and AV scanner configuration.
4516 </para>
4517 </listitem></varlistentry>
4518 <varlistentry>
4519 <term><option>-bnq</option></term>
4520 <listitem>
4521 <para>
4522 <indexterm role="option">
4523 <primary><option>-bnq</option></primary>
4524 </indexterm>
4525 <indexterm role="concept">
4526 <primary>address qualification, suppressing</primary>
4527 </indexterm>
4528 By default, Exim automatically qualifies unqualified addresses (those
4529 without domains) that appear in messages that are submitted locally (that
4530 is, not over TCP/IP). This qualification applies both to addresses in
4531 envelopes, and addresses in header lines. Sender addresses are qualified using
4532 <option>qualify_domain</option>, and recipient addresses using <option>qualify_recipient</option> (which
4533 defaults to the value of <option>qualify_domain</option>).
4534 </para>
4535 <para>
4536 Sometimes, qualification is not wanted. For example, if <option>-bS</option> (batch SMTP) is
4537 being used to re-submit messages that originally came from remote hosts after
4538 content scanning, you probably do not want to qualify unqualified addresses in
4539 header lines. (Such lines will be present only if you have not enabled a header
4540 syntax check in the appropriate ACL.)
4541 </para>
4542 <para>
4543 The <option>-bnq</option> option suppresses all qualification of unqualified addresses in
4544 messages that originate on the local host. When this is used, unqualified
4545 addresses in the envelope provoke errors (causing message rejection) and
4546 unqualified addresses in header lines are left alone.
4547 </para>
4548 </listitem></varlistentry>
4549 <varlistentry>
4550 <term><option>-bP</option></term>
4551 <listitem>
4552 <para>
4553 <indexterm role="option">
4554 <primary><option>-bP</option></primary>
4555 </indexterm>
4556 <indexterm role="concept">
4557 <primary>configuration options</primary>
4558 <secondary>extracting</secondary>
4559 </indexterm>
4560 <indexterm role="concept">
4561 <primary>options</primary>
4562 <secondary>configuration &ndash; extracting</secondary>
4563 </indexterm>
4564 If this option is given with no arguments, it causes the values of all Exim&#x2019;s
4565 main configuration options to be written to the standard output. The values
4566 of one or more specific options can be requested by giving their names as
4567 arguments, for example:
4568 </para>
4569 <literallayout class="monospaced">
4570 exim -bP qualify_domain hold_domains
4571 </literallayout>
4572 <para>
4573 <indexterm role="concept">
4574 <primary>hiding configuration option values</primary>
4575 </indexterm>
4576 <indexterm role="concept">
4577 <primary>configuration options</primary>
4578 <secondary>hiding value of</secondary>
4579 </indexterm>
4580 <indexterm role="concept">
4581 <primary>options</primary>
4582 <secondary>hiding value of</secondary>
4583 </indexterm>
4584 However, any option setting that is preceded by the word <quote>hide</quote> in the
4585 configuration file is not shown in full, except to an admin user. For other
4586 users, the output is as in this example:
4587 </para>
4588 <literallayout class="monospaced">
4589 mysql_servers = &lt;value not displayable&gt;
4590 </literallayout>
4591 <para>
4592 If <option>config</option> is given as an argument, the config is
4593 output, as it was parsed, any include file resolved, any comment removed.
4594 </para>
4595 <para>
4596 If <option>config_file</option> is given as an argument, the name of the runtime
4597 configuration file is output. (<option>configure_file</option> works too, for
4598 backward compatibility.)
4599 If a list of configuration files was supplied, the value that is output here
4600 is the name of the file that was actually used.
4601 </para>
4602 <para>
4603 <indexterm role="concept">
4604 <primary>options</primary>
4605 <secondary>hiding name of</secondary>
4606 </indexterm>
4607 If the <option>-n</option> flag is given, then for most modes of <option>-bP</option> operation the
4608 name will not be output.
4609 </para>
4610 <para>
4611 <indexterm role="concept">
4612 <primary>daemon</primary>
4613 <secondary>process id (pid)</secondary>
4614 </indexterm>
4615 <indexterm role="concept">
4616 <primary>pid (process id)</primary>
4617 <secondary>of daemon</secondary>
4618 </indexterm>
4619 If <option>log_file_path</option> or <option>pid_file_path</option> are given, the names of the
4620 directories where log files and daemon pid files are written are output,
4621 respectively. If these values are unset, log files are written in a
4622 sub-directory of the spool directory called <option>log</option>, and the pid file is
4623 written directly into the spool directory.
4624 </para>
4625 <para>
4626 If <option>-bP</option> is followed by a name preceded by <literal>+</literal>, for example,
4627 </para>
4628 <literallayout class="monospaced">
4629 exim -bP +local_domains
4630 </literallayout>
4631 <para>
4632 it searches for a matching named list of any type (domain, host, address, or
4633 local part) and outputs what it finds.
4634 </para>
4635 <para>
4636 <indexterm role="concept">
4637 <primary>options</primary>
4638 <secondary>router &ndash; extracting</secondary>
4639 </indexterm>
4640 <indexterm role="concept">
4641 <primary>options</primary>
4642 <secondary>transport &ndash; extracting</secondary>
4643 </indexterm>
4644 <indexterm role="concept">
4645 <primary>options</primary>
4646 <secondary>authenticator &ndash; extracting</secondary>
4647 </indexterm>
4648 If one of the words <option>router</option>, <option>transport</option>, or <option>authenticator</option> is given,
4649 followed by the name of an appropriate driver instance, the option settings for
4650 that driver are output. For example:
4651 </para>
4652 <literallayout class="monospaced">
4653 exim -bP transport local_delivery
4654 </literallayout>
4655 <para>
4656 The generic driver options are output first, followed by the driver&#x2019;s private
4657 options. A list of the names of drivers of a particular type can be obtained by
4658 using one of the words <option>router_list</option>, <option>transport_list</option>, or
4659 <option>authenticator_list</option>, and a complete list of all drivers with their option
4660 settings can be obtained by using <option>routers</option>, <option>transports</option>, or
4661 <option>authenticators</option>.
4662 </para>
4663 <para>
4664 <indexterm role="concept">
4665 <primary>environment</primary>
4666 </indexterm>
4667 If <option>environment</option> is given as an argument, the set of environment
4668 variables is output, line by line. Using the <option>-n</option> flag suppresses the value of the
4669 variables.
4670 </para>
4671 <para>
4672 <indexterm role="concept">
4673 <primary>options</primary>
4674 <secondary>macro &ndash; extracting</secondary>
4675 </indexterm>
4676 If invoked by an admin user, then <option>macro</option>, <option>macro_list</option> and <option>macros</option>
4677 are available, similarly to the drivers.  Because macros are sometimes used
4678 for storing passwords, this option is restricted.
4679 The output format is one item per line.
4680 For the "-bP macro &lt;name&gt;" form, if no such macro is found
4681 the exit status will be nonzero.
4682 </para>
4683 </listitem></varlistentry>
4684 <varlistentry>
4685 <term><option>-bp</option></term>
4686 <listitem>
4687 <para>
4688 <indexterm role="option">
4689 <primary><option>-bp</option></primary>
4690 </indexterm>
4691 <indexterm role="concept">
4692 <primary>queue</primary>
4693 <secondary>listing messages in</secondary>
4694 </indexterm>
4695 <indexterm role="concept">
4696 <primary>listing</primary>
4697 <secondary>messages in the queue</secondary>
4698 </indexterm>
4699 This option requests a listing of the contents of the mail queue on the
4700 standard output. If the <option>-bp</option> option is followed by a list of message ids,
4701 just those messages are listed. By default, this option can be used only by an
4702 admin user. However, the <option>queue_list_requires_admin</option> option can be set false
4703 to allow any user to see the queue.
4704 </para>
4705 <para>
4706 Each message in the queue is displayed as in the following example:
4707 </para>
4708 <literallayout class="monospaced">
4709 25m  2.9K 0t5C6f-0000c8-00 &lt;alice@wonderland.fict.example&gt;
4710           red.king@looking-glass.fict.example
4711           &lt;other addresses&gt;
4712 </literallayout>
4713 <para>
4714 <indexterm role="concept">
4715 <primary>message</primary>
4716 <secondary>size in queue listing</secondary>
4717 </indexterm>
4718 <indexterm role="concept">
4719 <primary>size</primary>
4720 <secondary>of message</secondary>
4721 </indexterm>
4722 The first line contains the length of time the message has been in the queue
4723 (in this case 25 minutes), the size of the message (2.9K), the unique local
4724 identifier for the message, and the message sender, as contained in the
4725 envelope. For bounce messages, the sender address is empty, and appears as
4726 <quote>&lt;&gt;</quote>. If the message was submitted locally by an untrusted user who overrode
4727 the default sender address, the user&#x2019;s login name is shown in parentheses
4728 before the sender address.
4729 </para>
4730 <para>
4731 <indexterm role="concept">
4732 <primary>frozen messages</primary>
4733 <secondary>in queue listing</secondary>
4734 </indexterm>
4735 If the message is frozen (attempts to deliver it are suspended) then the text
4736 <quote>*** frozen ***</quote> is displayed at the end of this line.
4737 </para>
4738 <para>
4739 The recipients of the message (taken from the envelope, not the headers) are
4740 displayed on subsequent lines. Those addresses to which the message has already
4741 been delivered are marked with the letter D. If an original address gets
4742 expanded into several addresses via an alias or forward file, the original is
4743 displayed with a D only when deliveries for all of its child addresses are
4744 complete.
4745 </para>
4746 </listitem></varlistentry>
4747 <varlistentry>
4748 <term><option>-bpa</option></term>
4749 <listitem>
4750 <para>
4751 <indexterm role="option">
4752 <primary><option>-bpa</option></primary>
4753 </indexterm>
4754 This option operates like <option>-bp</option>, but in addition it shows delivered addresses
4755 that were generated from the original top level address(es) in each message by
4756 alias or forwarding operations. These addresses are flagged with <quote>+D</quote> instead
4757 of just <quote>D</quote>.
4758 </para>
4759 </listitem></varlistentry>
4760 <varlistentry>
4761 <term><option>-bpc</option></term>
4762 <listitem>
4763 <para>
4764 <indexterm role="option">
4765 <primary><option>-bpc</option></primary>
4766 </indexterm>
4767 <indexterm role="concept">
4768 <primary>queue</primary>
4769 <secondary>count of messages on</secondary>
4770 </indexterm>
4771 This option counts the number of messages in the queue, and writes the total
4772 to the standard output. It is restricted to admin users, unless
4773 <option>queue_list_requires_admin</option> is set false.
4774 </para>
4775 </listitem></varlistentry>
4776 <varlistentry>
4777 <term><option>-bpr</option></term>
4778 <listitem>
4779 <para>
4780 <indexterm role="option">
4781 <primary><option>-bpr</option></primary>
4782 </indexterm>
4783 This option operates like <option>-bp</option>, but the output is not sorted into
4784 chronological order of message arrival. This can speed it up when there are
4785 lots of messages in the queue, and is particularly useful if the output is
4786 going to be post-processed in a way that doesn&#x2019;t need the sorting.
4787 </para>
4788 </listitem></varlistentry>
4789 <varlistentry>
4790 <term><option>-bpra</option></term>
4791 <listitem>
4792 <para>
4793 <indexterm role="option">
4794 <primary><option>-bpra</option></primary>
4795 </indexterm>
4796 This option is a combination of <option>-bpr</option> and <option>-bpa</option>.
4797 </para>
4798 </listitem></varlistentry>
4799 <varlistentry>
4800 <term><option>-bpru</option></term>
4801 <listitem>
4802 <para>
4803 <indexterm role="option">
4804 <primary><option>-bpru</option></primary>
4805 </indexterm>
4806 This option is a combination of <option>-bpr</option> and <option>-bpu</option>.
4807 </para>
4808 </listitem></varlistentry>
4809 <varlistentry>
4810 <term><option>-bpu</option></term>
4811 <listitem>
4812 <para>
4813 <indexterm role="option">
4814 <primary><option>-bpu</option></primary>
4815 </indexterm>
4816 This option operates like <option>-bp</option> but shows only undelivered top-level
4817 addresses for each message displayed. Addresses generated by aliasing or
4818 forwarding are not shown, unless the message was deferred after processing by a
4819 router with the <option>one_time</option> option set.
4820 </para>
4821 </listitem></varlistentry>
4822 <varlistentry>
4823 <term><option>-brt</option></term>
4824 <listitem>
4825 <para>
4826 <indexterm role="option">
4827 <primary><option>-brt</option></primary>
4828 </indexterm>
4829 <indexterm role="concept">
4830 <primary>testing</primary>
4831 <secondary>retry configuration</secondary>
4832 </indexterm>
4833 <indexterm role="concept">
4834 <primary>retry</primary>
4835 <secondary>configuration testing</secondary>
4836 </indexterm>
4837 This option is for testing retry rules, and it must be followed by up to three
4838 arguments. It causes Exim to look for a retry rule that matches the values
4839 and to write it to the standard output. For example:
4840 </para>
4841 <literallayout class="monospaced">
4842 exim -brt bach.comp.mus.example
4843 Retry rule: *.comp.mus.example  F,2h,15m; F,4d,30m;
4844 </literallayout>
4845 <para>
4846 See chapter <xref linkend="CHAPretry"/> for a description of Exim&#x2019;s retry rules. The first
4847 argument, which is required, can be a complete address in the form
4848 <emphasis>local_part@domain</emphasis>, or it can be just a domain name. If the second argument
4849 contains a dot, it is interpreted as an optional second domain name; if no
4850 retry rule is found for the first argument, the second is tried. This ties in
4851 with Exim&#x2019;s behaviour when looking for retry rules for remote hosts &ndash; if no
4852 rule is found that matches the host, one that matches the mail domain is
4853 sought. Finally, an argument that is the name of a specific delivery error, as
4854 used in setting up retry rules, can be given. For example:
4855 </para>
4856 <literallayout class="monospaced">
4857 exim -brt haydn.comp.mus.example quota_3d
4858 Retry rule: *@haydn.comp.mus.example quota_3d  F,1h,15m
4859 </literallayout>
4860 </listitem></varlistentry>
4861 <varlistentry>
4862 <term><option>-brw</option></term>
4863 <listitem>
4864 <para>
4865 <indexterm role="option">
4866 <primary><option>-brw</option></primary>
4867 </indexterm>
4868 <indexterm role="concept">
4869 <primary>testing</primary>
4870 <secondary>rewriting</secondary>
4871 </indexterm>
4872 <indexterm role="concept">
4873 <primary>rewriting</primary>
4874 <secondary>testing</secondary>
4875 </indexterm>
4876 This option is for testing address rewriting rules, and it must be followed by
4877 a single argument, consisting of either a local part without a domain, or a
4878 complete address with a fully qualified domain. Exim outputs how this address
4879 would be rewritten for each possible place it might appear. See chapter
4880 <xref linkend="CHAPrewrite"/> for further details.
4881 </para>
4882 </listitem></varlistentry>
4883 <varlistentry>
4884 <term><option>-bS</option></term>
4885 <listitem>
4886 <para>
4887 <indexterm role="option">
4888 <primary><option>-bS</option></primary>
4889 </indexterm>
4890 <indexterm role="concept">
4891 <primary>SMTP</primary>
4892 <secondary>batched incoming</secondary>
4893 </indexterm>
4894 <indexterm role="concept">
4895 <primary>batched SMTP input</primary>
4896 </indexterm>
4897 This option is used for batched SMTP input, which is an alternative interface
4898 for non-interactive local message submission. A number of messages can be
4899 submitted in a single run. However, despite its name, this is not really SMTP
4900 input. Exim reads each message&#x2019;s envelope from SMTP commands on the standard
4901 input, but generates no responses. If the caller is trusted, or
4902 <option>untrusted_set_sender</option> is set, the senders in the SMTP MAIL commands are
4903 believed; otherwise the sender is always the caller of Exim.
4904 </para>
4905 <para>
4906 The message itself is read from the standard input, in SMTP format (leading
4907 dots doubled), terminated by a line containing just a single dot. An error is
4908 provoked if the terminating dot is missing. A further message may then follow.
4909 </para>
4910 <para>
4911 As for other local message submissions, the contents of incoming batch SMTP
4912 messages can be checked using the non-SMTP ACL (see chapter <xref linkend="CHAPACL"/>).
4913 Unqualified addresses are automatically qualified using <option>qualify_domain</option> and
4914 <option>qualify_recipient</option>, as appropriate, unless the <option>-bnq</option> option is used.
4915 </para>
4916 <para>
4917 Some other SMTP commands are recognized in the input. HELO and EHLO act
4918 as RSET; VRFY, EXPN, ETRN, and HELP act as NOOP;
4919 QUIT quits, ignoring the rest of the standard input.
4920 </para>
4921 <para>
4922 <indexterm role="concept">
4923 <primary>return code</primary>
4924 <secondary>for <option>-bS</option></secondary>
4925 </indexterm>
4926 If any error is encountered, reports are written to the standard output and
4927 error streams, and Exim gives up immediately. The return code is 0 if no error
4928 was detected; it is 1 if one or more messages were accepted before the error
4929 was detected; otherwise it is 2.
4930 </para>
4931 <para>
4932 More details of input using batched SMTP are given in section
4933 <xref linkend="SECTincomingbatchedSMTP"/>.
4934 </para>
4935 </listitem></varlistentry>
4936 <varlistentry>
4937 <term><option>-bs</option></term>
4938 <listitem>
4939 <para>
4940 <indexterm role="option">
4941 <primary><option>-bs</option></primary>
4942 </indexterm>
4943 <indexterm role="concept">
4944 <primary>SMTP</primary>
4945 <secondary>local input</secondary>
4946 </indexterm>
4947 <indexterm role="concept">
4948 <primary>local SMTP input</primary>
4949 </indexterm>
4950 This option causes Exim to accept one or more messages by reading SMTP commands
4951 on the standard input, and producing SMTP replies on the standard output. SMTP
4952 policy controls, as defined in ACLs (see chapter <xref linkend="CHAPACL"/>) are applied.
4953 Some user agents use this interface as a way of passing locally-generated
4954 messages to the MTA.
4955 </para>
4956 <para>
4957 In
4958 <indexterm role="concept">
4959 <primary>sender</primary>
4960 <secondary>source of</secondary>
4961 </indexterm>
4962 this usage, if the caller of Exim is trusted, or <option>untrusted_set_sender</option> is
4963 set, the senders of messages are taken from the SMTP MAIL commands.
4964 Otherwise the content of these commands is ignored and the sender is set up as
4965 the calling user. Unqualified addresses are automatically qualified using
4966 <option>qualify_domain</option> and <option>qualify_recipient</option>, as appropriate, unless the
4967 <option>-bnq</option> option is used.
4968 </para>
4969 <para>
4970 <indexterm role="concept">
4971 <primary>inetd</primary>
4972 </indexterm>
4973 The
4974 <option>-bs</option> option is also used to run Exim from <emphasis>inetd</emphasis>, as an alternative to
4975 using a listening daemon. Exim can distinguish the two cases by checking
4976 whether the standard input is a TCP/IP socket. When Exim is called from
4977 <emphasis>inetd</emphasis>, the source of the mail is assumed to be remote, and the comments
4978 above concerning senders and qualification do not apply. In this situation,
4979 Exim behaves in exactly the same way as it does when receiving a message via
4980 the listening daemon.
4981 </para>
4982 </listitem></varlistentry>
4983 <varlistentry>
4984 <term><option>-bt</option></term>
4985 <listitem>
4986 <para>
4987 <indexterm role="option">
4988 <primary><option>-bt</option></primary>
4989 </indexterm>
4990 <indexterm role="concept">
4991 <primary>testing</primary>
4992 <secondary>addresses</secondary>
4993 </indexterm>
4994 <indexterm role="concept">
4995 <primary>address</primary>
4996 <secondary>testing</secondary>
4997 </indexterm>
4998 This option runs Exim in address testing mode, in which each argument is taken
4999 as a recipient address to be tested for deliverability. The results are
5000 written to the standard output. If a test fails, and the caller is not an admin
5001 user, no details of the failure are output, because these might contain
5002 sensitive information such as usernames and passwords for database lookups.
5003 </para>
5004 <para>
5005 If no arguments are given, Exim runs in an interactive manner, prompting with a
5006 right angle bracket for addresses to be tested.
5007 </para>
5008 <para>
5009 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
5010 <function>readline()</function> function, because it is running as <emphasis>root</emphasis> and there are
5011 security issues.
5012 </para>
5013 <para>
5014 Each address is handled as if it were the recipient address of a message
5015 (compare the <option>-bv</option> option). It is passed to the routers and the result is
5016 written to the standard output. However, any router that has
5017 <option>no_address_test</option> set is bypassed. This can make <option>-bt</option> easier to use for
5018 genuine routing tests if your first router passes everything to a scanner
5019 program.
5020 </para>
5021 <para>
5022 <indexterm role="concept">
5023 <primary>return code</primary>
5024 <secondary>for <option>-bt</option></secondary>
5025 </indexterm>
5026 The return code is 2 if any address failed outright; it is 1 if no address
5027 failed outright but at least one could not be resolved for some reason. Return
5028 code 0 is given only when all addresses succeed.
5029 </para>
5030 <para>
5031 <indexterm role="concept">
5032 <primary>duplicate addresses</primary>
5033 </indexterm>
5034 <emphasis role="bold">Note</emphasis>: When actually delivering a message, Exim removes duplicate recipient
5035 addresses after routing is complete, so that only one delivery takes place.
5036 This does not happen when testing with <option>-bt</option>; the full results of routing are
5037 always shown.
5038 </para>
5039 <para>
5040 <emphasis role="bold">Warning</emphasis>: <option>-bt</option> can only do relatively simple testing. If any of the
5041 routers in the configuration makes any tests on the sender address of a
5042 message,
5043 <indexterm role="option">
5044 <primary><option>-f</option></primary>
5045 <secondary>for address testing</secondary>
5046 </indexterm>
5047 you can use the <option>-f</option> option to set an appropriate sender when running
5048 <option>-bt</option> tests. Without it, the sender is assumed to be the calling user at the
5049 default qualifying domain. However, if you have set up (for example) routers
5050 whose behaviour depends on the contents of an incoming message, you cannot test
5051 those conditions using <option>-bt</option>. The <option>-N</option> option provides a possible way of
5052 doing such tests.
5053 </para>
5054 </listitem></varlistentry>
5055 <varlistentry>
5056 <term><option>-bV</option></term>
5057 <listitem>
5058 <para>
5059 <indexterm role="option">
5060 <primary><option>-bV</option></primary>
5061 </indexterm>
5062 <indexterm role="concept">
5063 <primary>version number of Exim</primary>
5064 </indexterm>
5065 This option causes Exim to write the current version number, compilation
5066 number, and compilation date of the <emphasis>exim</emphasis> binary to the standard output.
5067 It also lists the DBM library that is being used, the optional modules (such as
5068 specific lookup types), the drivers that are included in the binary, and the
5069 name of the runtime configuration file that is in use.
5070 </para>
5071 <para>
5072 As part of its operation, <option>-bV</option> causes Exim to read and syntax check its
5073 configuration file. However, this is a static check only. It cannot check
5074 values that are to be expanded. For example, although a misspelt ACL verb is
5075 detected, an error in the verb&#x2019;s arguments is not. You cannot rely on <option>-bV</option>
5076 alone to discover (for example) all the typos in the configuration; some
5077 realistic testing is needed. The <option>-bh</option> and <option>-N</option> options provide more
5078 dynamic testing facilities.
5079 </para>
5080 </listitem></varlistentry>
5081 <varlistentry>
5082 <term><option>-bv</option></term>
5083 <listitem>
5084 <para>
5085 <indexterm role="option">
5086 <primary><option>-bv</option></primary>
5087 </indexterm>
5088 <indexterm role="concept">
5089 <primary>verifying address</primary>
5090 <secondary>using <option>-bv</option></secondary>
5091 </indexterm>
5092 <indexterm role="concept">
5093 <primary>address</primary>
5094 <secondary>verification</secondary>
5095 </indexterm>
5096 This option runs Exim in address verification mode, in which each argument is
5097 taken as a recipient address to be verified by the routers. (This does
5098 not involve any verification callouts). During normal operation, verification
5099 happens mostly as a consequence processing a <option>verify</option> condition in an ACL
5100 (see chapter <xref linkend="CHAPACL"/>). If you want to test an entire ACL, possibly
5101 including callouts, see the <option>-bh</option> and <option>-bhc</option> options.
5102 </para>
5103 <para>
5104 If verification fails, and the caller is not an admin user, no details of the
5105 failure are output, because these might contain sensitive information such as
5106 usernames and passwords for database lookups.
5107 </para>
5108 <para>
5109 If no arguments are given, Exim runs in an interactive manner, prompting with a
5110 right angle bracket for addresses to be verified.
5111 </para>
5112 <para>
5113 Unlike the <option>-be</option> test option, you cannot arrange for Exim to use the
5114 <function>readline()</function> function, because it is running as <emphasis>exim</emphasis> and there are
5115 security issues.
5116 </para>
5117 <para>
5118 Verification differs from address testing (the <option>-bt</option> option) in that routers
5119 that have <option>no_verify</option> set are skipped, and if the address is accepted by a
5120 router that has <option>fail_verify</option> set, verification fails. The address is
5121 verified as a recipient if <option>-bv</option> is used; to test verification for a sender
5122 address, <option>-bvs</option> should be used.
5123 </para>
5124 <para>
5125 If the <option>-v</option> option is not set, the output consists of a single line for each
5126 address, stating whether it was verified or not, and giving a reason in the
5127 latter case. Without <option>-v</option>, generating more than one address by redirection
5128 causes verification to end successfully, without considering the generated
5129 addresses. However, if just one address is generated, processing continues,
5130 and the generated address must verify successfully for the overall verification
5131 to succeed.
5132 </para>
5133 <para>
5134 When <option>-v</option> is set, more details are given of how the address has been handled,
5135 and in the case of address redirection, all the generated addresses are also
5136 considered. Verification may succeed for some and fail for others.
5137 </para>
5138 <para>
5139 The
5140 <indexterm role="concept">
5141 <primary>return code</primary>
5142 <secondary>for <option>-bv</option></secondary>
5143 </indexterm>
5144 return code is 2 if any address failed outright; it is 1 if no address
5145 failed outright but at least one could not be resolved for some reason. Return
5146 code 0 is given only when all addresses succeed.
5147 </para>
5148 <para>
5149 If any of the routers in the configuration makes any tests on the sender
5150 address of a message, you should use the <option>-f</option> option to set an appropriate
5151 sender when running <option>-bv</option> tests. Without it, the sender is assumed to be the
5152 calling user at the default qualifying domain.
5153 </para>
5154 </listitem></varlistentry>
5155 <varlistentry>
5156 <term><option>-bvs</option></term>
5157 <listitem>
5158 <para>
5159 <indexterm role="option">
5160 <primary><option>-bvs</option></primary>
5161 </indexterm>
5162 This option acts like <option>-bv</option>, but verifies the address as a sender rather
5163 than a recipient address. This affects any rewriting and qualification that
5164 might happen.
5165 </para>
5166 </listitem></varlistentry>
5167 <varlistentry>
5168 <term><option>-bw</option></term>
5169 <listitem>
5170 <para>
5171 <indexterm role="option">
5172 <primary><option>-bw</option></primary>
5173 </indexterm>
5174 <indexterm role="concept">
5175 <primary>daemon</primary>
5176 </indexterm>
5177 <indexterm role="concept">
5178 <primary>inetd</primary>
5179 </indexterm>
5180 <indexterm role="concept">
5181 <primary>inetd</primary>
5182 <secondary>wait mode</secondary>
5183 </indexterm>
5184 This option runs Exim as a daemon, awaiting incoming SMTP connections,
5185 similarly to the <option>-bd</option> option.  All port specifications on the command-line
5186 and in the configuration file are ignored.  Queue-running may not be specified.
5187 </para>
5188 <para>
5189 In this mode, Exim expects to be passed a socket as fd 0 (stdin) which is
5190 listening for connections.  This permits the system to start up and have
5191 inetd (or equivalent) listen on the SMTP ports, starting an Exim daemon for
5192 each port only when the first connection is received.
5193 </para>
5194 <para>
5195 If the option is given as <option>-bw</option>&lt;<emphasis>time</emphasis>&gt; then the time is a timeout, after
5196 which the daemon will exit, which should cause inetd to listen once more.
5197 </para>
5198 </listitem></varlistentry>
5199 <varlistentry>
5200 <term><option>-C</option>&nbsp;&lt;<emphasis>filelist</emphasis>&gt;</term>
5201 <listitem>
5202 <para>
5203 <indexterm role="option">
5204 <primary><option>-C</option></primary>
5205 </indexterm>
5206 <indexterm role="concept">
5207 <primary>configuration file</primary>
5208 <secondary>alternate</secondary>
5209 </indexterm>
5210 <indexterm role="concept">
5211 <primary>CONFIGURE_FILE</primary>
5212 </indexterm>
5213 <indexterm role="concept">
5214 <primary>alternate configuration file</primary>
5215 </indexterm>
5216 This option causes Exim to find the runtime configuration file from the given
5217 list instead of from the list specified by the CONFIGURE_FILE
5218 compile-time setting. Usually, the list will consist of just a single filename,
5219 but it can be a colon-separated list of names. In this case, the first
5220 file that exists is used. Failure to open an existing file stops Exim from
5221 proceeding any further along the list, and an error is generated.
5222 </para>
5223 <para>
5224 When this option is used by a caller other than root, and the list is different
5225 from the compiled-in list, Exim gives up its root privilege immediately, and
5226 runs with the real and effective uid and gid set to those of the caller.
5227 However, if a TRUSTED_CONFIG_LIST file is defined in <filename>Local/Makefile</filename>, that
5228 file contains a list of full pathnames, one per line, for configuration files
5229 which are trusted. Root privilege is retained for any configuration file so
5230 listed, as long as the caller is the Exim user (or the user specified in the
5231 CONFIGURE_OWNER option, if any), and as long as the configuration file is
5232 not writeable by inappropriate users or groups.
5233 </para>
5234 <para>
5235 Leaving TRUSTED_CONFIG_LIST unset precludes the possibility of testing a
5236 configuration using <option>-C</option> right through message reception and delivery,
5237 even if the caller is root. The reception works, but by that time, Exim is
5238 running as the Exim user, so when it re-executes to regain privilege for the
5239 delivery, the use of <option>-C</option> causes privilege to be lost. However, root can
5240 test reception and delivery using two separate commands (one to put a message
5241 in the queue, using <option>-odq</option>, and another to do the delivery, using <option>-M</option>).
5242 </para>
5243 <para>
5244 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
5245 prefix string with which any file named in a <option>-C</option> command line option
5246 must start. In addition, the filename must not contain the sequence <literal>/../</literal>.
5247 However, if the value of the <option>-C</option> option is identical to the value of
5248 CONFIGURE_FILE in <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as
5249 usual. There is no default setting for ALT_CONFIG_PREFIX; when it is
5250 unset, any filename can be used with <option>-C</option>.
5251 </para>
5252 <para>
5253 ALT_CONFIG_PREFIX can be used to confine alternative configuration files
5254 to a directory to which only root has access. This prevents someone who has
5255 broken into the Exim account from running a privileged Exim with an arbitrary
5256 configuration file.
5257 </para>
5258 <para>
5259 The <option>-C</option> facility is useful for ensuring that configuration files are
5260 syntactically correct, but cannot be used for test deliveries, unless the
5261 caller is privileged, or unless it is an exotic configuration that does not
5262 require privilege. No check is made on the owner or group of the files
5263 specified by this option.
5264 </para>
5265 </listitem></varlistentry>
5266 <varlistentry>
5267 <term><option>-D</option>&lt;<emphasis>macro</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;</term>
5268 <listitem>
5269 <para>
5270 <indexterm role="option">
5271 <primary><option>-D</option></primary>
5272 </indexterm>
5273 <indexterm role="concept">
5274 <primary>macro</primary>
5275 <secondary>setting on command line</secondary>
5276 </indexterm>
5277 This option can be used to override macro definitions in the configuration file
5278 (see section <xref linkend="SECTmacrodefs"/>). However, like <option>-C</option>, if it is used by an
5279 unprivileged caller, it causes Exim to give up its root privilege.
5280 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
5281 completely disabled, and its use causes an immediate error exit.
5282 </para>
5283 <para>
5284 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename> then it should be a
5285 colon-separated list of macros which are considered safe and, if <option>-D</option> only
5286 supplies macros from this list, and the values are acceptable, then Exim will
5287 not give up root privilege if the caller is root, the Exim run-time user, or
5288 the CONFIGURE_OWNER, if set.  This is a transition mechanism and is expected
5289 to be removed in the future.  Acceptable values for the macros satisfy the
5290 regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
5291 </para>
5292 <para>
5293 The entire option (including equals sign if present) must all be within one
5294 command line item. <option>-D</option> can be used to set the value of a macro to the empty
5295 string, in which case the equals sign is optional. These two commands are
5296 synonymous:
5297 </para>
5298 <literallayout class="monospaced">
5299 exim -DABC  ...
5300 exim -DABC= ...
5301 </literallayout>
5302 <para>
5303 To include spaces in a macro definition item, quotes must be used. If you use
5304 quotes, spaces are permitted around the macro name and the equals sign. For
5305 example:
5306 </para>
5307 <literallayout class="monospaced">
5308 exim '-D ABC = something' ...
5309 </literallayout>
5310 <para>
5311 <option>-D</option> may be repeated up to 10 times on a command line.
5312 Only macro names up to 22 letters long can be set.
5313 </para>
5314 </listitem></varlistentry>
5315 <varlistentry>
5316 <term><option>-d</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5317 <listitem>
5318 <para>
5319 <indexterm role="option">
5320 <primary><option>-d</option></primary>
5321 </indexterm>
5322 <indexterm role="concept">
5323 <primary>debugging</primary>
5324 <secondary>list of selectors</secondary>
5325 </indexterm>
5326 <indexterm role="concept">
5327 <primary>debugging</primary>
5328 <secondary><option>-d</option> option</secondary>
5329 </indexterm>
5330 This option causes debugging information to be written to the standard
5331 error stream. It is restricted to admin users because debugging output may show
5332 database queries that contain password information. Also, the details of users&#x2019;
5333 filter files should be protected. If a non-admin user uses <option>-d</option>, Exim
5334 writes an error message to the standard error stream and exits with a non-zero
5335 return code.
5336 </para>
5337 <para>
5338 When <option>-d</option> is used, <option>-v</option> is assumed. If <option>-d</option> is given on its own, a lot of
5339 standard debugging data is output. This can be reduced, or increased to include
5340 some more rarely needed information, by directly following <option>-d</option> with a string
5341 made up of names preceded by plus or minus characters. These add or remove sets
5342 of debugging data, respectively. For example, <option>-d+filter</option> adds filter
5343 debugging, whereas <option>-d-all+filter</option> selects only filter debugging. Note that
5344 no spaces are allowed in the debug setting. The available debugging categories
5345 are:
5346 </para>
5347 <informaltable frame="none">
5348 <tgroup cols="2" colsep="0" rowsep="0">
5349 <colspec colwidth="1pt" align="left"/>
5350 <colspec colwidth="1pt" align="left"/>
5351 <tbody>
5352 <row>
5353 <entry>&nbsp;&nbsp;&nbsp;&nbsp;acl</entry>
5354 <entry>ACL interpretation</entry>
5355 </row>
5356 <row>
5357 <entry>&nbsp;&nbsp;&nbsp;&nbsp;auth</entry>
5358 <entry>authenticators</entry>
5359 </row>
5360 <row>
5361 <entry>&nbsp;&nbsp;&nbsp;&nbsp;deliver</entry>
5362 <entry>general delivery logic</entry>
5363 </row>
5364 <row>
5365 <entry>&nbsp;&nbsp;&nbsp;&nbsp;dns</entry>
5366 <entry>DNS lookups (see also resolver)</entry>
5367 </row>
5368 <row>
5369 <entry>&nbsp;&nbsp;&nbsp;&nbsp;dnsbl</entry>
5370 <entry>DNS black list (aka RBL) code</entry>
5371 </row>
5372 <row>
5373 <entry>&nbsp;&nbsp;&nbsp;&nbsp;exec</entry>
5374 <entry>arguments for <function>execv()</function> calls</entry>
5375 </row>
5376 <row>
5377 <entry>&nbsp;&nbsp;&nbsp;&nbsp;expand</entry>
5378 <entry>detailed debugging for string expansions</entry>
5379 </row>
5380 <row>
5381 <entry>&nbsp;&nbsp;&nbsp;&nbsp;filter</entry>
5382 <entry>filter handling</entry>
5383 </row>
5384 <row>
5385 <entry>&nbsp;&nbsp;&nbsp;&nbsp;hints_lookup</entry>
5386 <entry>hints data lookups</entry>
5387 </row>
5388 <row>
5389 <entry>&nbsp;&nbsp;&nbsp;&nbsp;host_lookup</entry>
5390 <entry>all types of name-to-IP address handling</entry>
5391 </row>
5392 <row>
5393 <entry>&nbsp;&nbsp;&nbsp;&nbsp;ident</entry>
5394 <entry>ident lookup</entry>
5395 </row>
5396 <row>
5397 <entry>&nbsp;&nbsp;&nbsp;&nbsp;interface</entry>
5398 <entry>lists of local interfaces</entry>
5399 </row>
5400 <row>
5401 <entry>&nbsp;&nbsp;&nbsp;&nbsp;lists</entry>
5402 <entry>matching things in lists</entry>
5403 </row>
5404 <row>
5405 <entry>&nbsp;&nbsp;&nbsp;&nbsp;load</entry>
5406 <entry>system load checks</entry>
5407 </row>
5408 <row>
5409 <entry>&nbsp;&nbsp;&nbsp;&nbsp;local_scan</entry>
5410 <entry>can be used by <function>local_scan()</function> (see chapter <xref linkend="CHAPlocalscan"/>)</entry>
5411 </row>
5412 <row>
5413 <entry>&nbsp;&nbsp;&nbsp;&nbsp;lookup</entry>
5414 <entry>general lookup code and all lookups</entry>
5415 </row>
5416 <row>
5417 <entry>&nbsp;&nbsp;&nbsp;&nbsp;memory</entry>
5418 <entry>memory handling</entry>
5419 </row>
5420 <row>
5421 <entry>&nbsp;&nbsp;&nbsp;&nbsp;noutf8</entry>
5422 <entry>modifier: avoid UTF-8 line-drawing</entry>
5423 </row>
5424 <row>
5425 <entry>&nbsp;&nbsp;&nbsp;&nbsp;pid</entry>
5426 <entry>modifier: add pid to debug output lines</entry>
5427 </row>
5428 <row>
5429 <entry>&nbsp;&nbsp;&nbsp;&nbsp;process_info</entry>
5430 <entry>setting info for the process log</entry>
5431 </row>
5432 <row>
5433 <entry>&nbsp;&nbsp;&nbsp;&nbsp;queue_run</entry>
5434 <entry>queue runs</entry>
5435 </row>
5436 <row>
5437 <entry>&nbsp;&nbsp;&nbsp;&nbsp;receive</entry>
5438 <entry>general message reception logic</entry>
5439 </row>
5440 <row>
5441 <entry>&nbsp;&nbsp;&nbsp;&nbsp;resolver</entry>
5442 <entry>turn on the DNS resolver&#x2019;s debugging output</entry>
5443 </row>
5444 <row>
5445 <entry>&nbsp;&nbsp;&nbsp;&nbsp;retry</entry>
5446 <entry>retry handling</entry>
5447 </row>
5448 <row>
5449 <entry>&nbsp;&nbsp;&nbsp;&nbsp;rewrite</entry>
5450 <entry>address rewriting"</entry>
5451 </row>
5452 <row>
5453 <entry>&nbsp;&nbsp;&nbsp;&nbsp;route</entry>
5454 <entry>address routing</entry>
5455 </row>
5456 <row>
5457 <entry>&nbsp;&nbsp;&nbsp;&nbsp;timestamp</entry>
5458 <entry>modifier: add timestamp to debug output lines</entry>
5459 </row>
5460 <row>
5461 <entry>&nbsp;&nbsp;&nbsp;&nbsp;tls</entry>
5462 <entry>TLS logic</entry>
5463 </row>
5464 <row>
5465 <entry>&nbsp;&nbsp;&nbsp;&nbsp;transport</entry>
5466 <entry>transports</entry>
5467 </row>
5468 <row>
5469 <entry>&nbsp;&nbsp;&nbsp;&nbsp;uid</entry>
5470 <entry>changes of uid/gid and looking up uid/gid</entry>
5471 </row>
5472 <row>
5473 <entry>&nbsp;&nbsp;&nbsp;&nbsp;verify</entry>
5474 <entry>address verification logic</entry>
5475 </row>
5476 <row>
5477 <entry>&nbsp;&nbsp;&nbsp;&nbsp;all</entry>
5478 <entry>almost all of the above (see below), and also <option>-v</option></entry>
5479 </row>
5480 </tbody>
5481 </tgroup>
5482 </informaltable>
5483 <para>
5484 The <literal>all</literal> option excludes <literal>memory</literal> when used as <literal>+all</literal>, but includes it
5485 for <literal>-all</literal>. The reason for this is that <literal>+all</literal> is something that people
5486 tend to use when generating debug output for Exim maintainers. If <literal>+memory</literal>
5487 is included, an awful lot of output that is very rarely of interest is
5488 generated, so it now has to be explicitly requested. However, <literal>-all</literal> does
5489 turn everything off.
5490 </para>
5491 <para>
5492 <indexterm role="concept">
5493 <primary>resolver, debugging output</primary>
5494 </indexterm>
5495 <indexterm role="concept">
5496 <primary>DNS resolver, debugging output</primary>
5497 </indexterm>
5498 The <literal>resolver</literal> option produces output only if the DNS resolver was compiled
5499 with DEBUG enabled. This is not the case in some operating systems. Also,
5500 unfortunately, debugging output from the DNS resolver is written to stdout
5501 rather than stderr.
5502 </para>
5503 <para>
5504 The default (<option>-d</option> with no argument) omits <literal>expand</literal>, <literal>filter</literal>,
5505 <literal>interface</literal>, <literal>load</literal>, <literal>memory</literal>, <literal>pid</literal>, <literal>resolver</literal>, and <literal>timestamp</literal>.
5506 However, the <literal>pid</literal> selector is forced when debugging is turned on for a
5507 daemon, which then passes it on to any re-executed Exims. Exim also
5508 automatically adds the pid to debug lines when several remote deliveries are
5509 run in parallel.
5510 </para>
5511 <para>
5512 The <literal>timestamp</literal> selector causes the current time to be inserted at the start
5513 of all debug output lines. This can be useful when trying to track down delays
5514 in processing.
5515 </para>
5516 <para>
5517 <indexterm role="concept">
5518 <primary>debugging</primary>
5519 <secondary>UTF-8 in</secondary>
5520 </indexterm>
5521 <indexterm role="concept">
5522 <primary>UTF-8</primary>
5523 <secondary>in debug output</secondary>
5524 </indexterm>
5525 The <literal>noutf8</literal> selector disables the use of
5526 UTF-8 line-drawing characters to group related information.
5527 When disabled. ascii-art is used instead.
5528 Using the <literal>+all</literal> option does not set this modifier,
5529 </para>
5530 <para>
5531 If the <option>debug_print</option> option is set in any driver, it produces output whenever
5532 any debugging is selected, or if <option>-v</option> is used.
5533 </para>
5534 </listitem></varlistentry>
5535 <varlistentry>
5536 <term><option>-dd</option>&lt;<emphasis>debug&nbsp;options</emphasis>&gt;</term>
5537 <listitem>
5538 <para>
5539 <indexterm role="option">
5540 <primary><option>-dd</option></primary>
5541 </indexterm>
5542 This option behaves exactly like <option>-d</option> except when used on a command that
5543 starts a daemon process. In that case, debugging is turned off for the
5544 subprocesses that the daemon creates. Thus, it is useful for monitoring the
5545 behaviour of the daemon without creating as much output as full debugging does.
5546 </para>
5547 </listitem></varlistentry>
5548 <varlistentry>
5549 <term><option>-dropcr</option></term>
5550 <listitem>
5551 <para>
5552 <indexterm role="option">
5553 <primary><option>-dropcr</option></primary>
5554 </indexterm>
5555 This is an obsolete option that is now a no-op. It used to affect the way Exim
5556 handled CR and LF characters in incoming messages. What happens now is
5557 described in section <xref linkend="SECTlineendings"/>.
5558 </para>
5559 </listitem></varlistentry>
5560 <varlistentry>
5561 <term><option>-E</option></term>
5562 <listitem>
5563 <para>
5564 <indexterm role="option">
5565 <primary><option>-E</option></primary>
5566 </indexterm>
5567 <indexterm role="concept">
5568 <primary>bounce message</primary>
5569 <secondary>generating</secondary>
5570 </indexterm>
5571 This option specifies that an incoming message is a locally-generated delivery
5572 failure report. It is used internally by Exim when handling delivery failures
5573 and is not intended for external use. Its only effect is to stop Exim
5574 generating certain messages to the postmaster, as otherwise message cascades
5575 could occur in some situations. As part of the same option, a message id may
5576 follow the characters <option>-E</option>. If it does, the log entry for the receipt of the
5577 new message contains the id, following <quote>R=</quote>, as a cross-reference.
5578 </para>
5579 </listitem></varlistentry>
5580 <varlistentry>
5581 <term><option>-e</option><emphasis>x</emphasis></term>
5582 <listitem>
5583 <para>
5584 <indexterm role="option">
5585 <primary><option>-e</option><emphasis>x</emphasis></primary>
5586 </indexterm>
5587 There are a number of Sendmail options starting with <option>-oe</option> which seem to be
5588 called by various programs without the leading <option>o</option> in the option. For
5589 example, the <option>vacation</option> program uses <option>-eq</option>. Exim treats all options of the
5590 form <option>-e</option><emphasis>x</emphasis> as synonymous with the corresponding <option>-oe</option><emphasis>x</emphasis> options.
5591 </para>
5592 </listitem></varlistentry>
5593 <varlistentry>
5594 <term><option>-F</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
5595 <listitem>
5596 <para>
5597 <indexterm role="option">
5598 <primary><option>-F</option></primary>
5599 </indexterm>
5600 <indexterm role="concept">
5601 <primary>sender</primary>
5602 <secondary>name</secondary>
5603 </indexterm>
5604 <indexterm role="concept">
5605 <primary>name</primary>
5606 <secondary>of sender</secondary>
5607 </indexterm>
5608 This option sets the sender&#x2019;s full name for use when a locally-generated
5609 message is being accepted. In the absence of this option, the user&#x2019;s <emphasis>gecos</emphasis>
5610 entry from the password data is used. As users are generally permitted to alter
5611 their <emphasis>gecos</emphasis> entries, no security considerations are involved. White space
5612 between <option>-F</option> and the &lt;<emphasis>string</emphasis>&gt; is optional.
5613 </para>
5614 </listitem></varlistentry>
5615 <varlistentry>
5616 <term><option>-f</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
5617 <listitem>
5618 <para>
5619 <indexterm role="option">
5620 <primary><option>-f</option></primary>
5621 </indexterm>
5622 <indexterm role="concept">
5623 <primary>sender</primary>
5624 <secondary>address</secondary>
5625 </indexterm>
5626 <indexterm role="concept">
5627 <primary>address</primary>
5628 <secondary>sender</secondary>
5629 </indexterm>
5630 <indexterm role="concept">
5631 <primary>trusted users</primary>
5632 </indexterm>
5633 <indexterm role="concept">
5634 <primary>envelope from</primary>
5635 </indexterm>
5636 <indexterm role="concept">
5637 <primary>envelope sender</primary>
5638 </indexterm>
5639 <indexterm role="concept">
5640 <primary>user</primary>
5641 <secondary>trusted</secondary>
5642 </indexterm>
5643 This option sets the address of the envelope sender of a locally-generated
5644 message (also known as the return path). The option can normally be used only
5645 by a trusted user, but <option>untrusted_set_sender</option> can be set to allow untrusted
5646 users to use it.
5647 </para>
5648 <para>
5649 Processes running as root or the Exim user are always trusted. Other
5650 trusted users are defined by the <option>trusted_users</option> or <option>trusted_groups</option>
5651 options. In the absence of <option>-f</option>, or if the caller is not trusted, the sender
5652 of a local message is set to the caller&#x2019;s login name at the default qualify
5653 domain.
5654 </para>
5655 <para>
5656 There is one exception to the restriction on the use of <option>-f</option>: an empty sender
5657 can be specified by any user, trusted or not, to create a message that can
5658 never provoke a bounce. An empty sender can be specified either as an empty
5659 string, or as a pair of angle brackets with nothing between them, as in these
5660 examples of shell commands:
5661 </para>
5662 <literallayout class="monospaced">
5663 exim -f '&lt;&gt;' user@domain
5664 exim -f "" user@domain
5665 </literallayout>
5666 <para>
5667 In addition, the use of <option>-f</option> is not restricted when testing a filter file
5668 with <option>-bf</option> or when testing or verifying addresses using the <option>-bt</option> or
5669 <option>-bv</option> options.
5670 </para>
5671 <para>
5672 Allowing untrusted users to change the sender address does not of itself make
5673 it possible to send anonymous mail. Exim still checks that the <emphasis>From:</emphasis> header
5674 refers to the local user, and if it does not, it adds a <emphasis>Sender:</emphasis> header,
5675 though this can be overridden by setting <option>no_local_from_check</option>.
5676 </para>
5677 <para>
5678 White
5679 <indexterm role="concept">
5680 <primary><quote>From</quote> line</primary>
5681 </indexterm>
5682 space between <option>-f</option> and the &lt;<emphasis>address</emphasis>&gt; is optional (that is, they can be
5683 given as two arguments or one combined argument). The sender of a
5684 locally-generated message can also be set (when permitted) by an initial
5685 <quote>From&nbsp;</quote> line in the message &ndash; see the description of <option>-bm</option> above &ndash; but
5686 if <option>-f</option> is also present, it overrides <quote>From&nbsp;</quote>.
5687 </para>
5688 </listitem></varlistentry>
5689 <varlistentry>
5690 <term><option>-G</option></term>
5691 <listitem>
5692 <para>
5693 <indexterm role="option">
5694 <primary><option>-G</option></primary>
5695 </indexterm>
5696 <indexterm role="concept">
5697 <primary>submission fixups, suppressing (command-line)</primary>
5698 </indexterm>
5699 This option is equivalent to an ACL applying:
5700 </para>
5701 <literallayout class="monospaced">
5702 control = suppress_local_fixups
5703 </literallayout>
5704 <para>
5705 for every message received.  Note that Sendmail will complain about such
5706 bad formatting, where Exim silently just does not fix it up.  This may change
5707 in future.
5708 </para>
5709 <para>
5710 As this affects audit information, the caller must be a trusted user to use
5711 this option.
5712 </para>
5713 </listitem></varlistentry>
5714 <varlistentry>
5715 <term><option>-h</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
5716 <listitem>
5717 <para>
5718 <indexterm role="option">
5719 <primary><option>-h</option></primary>
5720 </indexterm>
5721 <indexterm role="concept">
5722 <primary>Sendmail compatibility</primary>
5723 <secondary><option>-h</option> option ignored</secondary>
5724 </indexterm>
5725 This option is accepted for compatibility with Sendmail, but has no effect. (In
5726 Sendmail it overrides the <quote>hop count</quote> obtained by counting <emphasis>Received:</emphasis>
5727 headers.)
5728 </para>
5729 </listitem></varlistentry>
5730 <varlistentry>
5731 <term><option>-i</option></term>
5732 <listitem>
5733 <para>
5734 <indexterm role="option">
5735 <primary><option>-i</option></primary>
5736 </indexterm>
5737 <indexterm role="concept">
5738 <primary>Solaris</primary>
5739 <secondary><emphasis>mail</emphasis> command</secondary>
5740 </indexterm>
5741 <indexterm role="concept">
5742 <primary>dot</primary>
5743 <secondary>in incoming non-SMTP message</secondary>
5744 </indexterm>
5745 This option, which has the same effect as <option>-oi</option>, specifies that a dot on a
5746 line by itself should not terminate an incoming, non-SMTP message.
5747 Solaris 2.4 (SunOS 5.4) Sendmail has a similar <option>-i</option> processing option
5748 <emphasis role="bold"><ulink url="https://docs.oracle.com/cd/E19457-01/801-6680-1M/801-6680-1M.pdf">https://docs.oracle.com/cd/E19457-01/801-6680-1M/801-6680-1M.pdf</ulink></emphasis>,
5749 p. 1M-529), and therefore a <option>-oi</option> command line option, which both are used
5750 by its <emphasis>mailx</emphasis> command.
5751 </para>
5752 </listitem></varlistentry>
5753 <varlistentry>
5754 <term><option>-L</option>&nbsp;&lt;<emphasis>tag</emphasis>&gt;</term>
5755 <listitem>
5756 <para>
5757 <indexterm role="option">
5758 <primary><option>-L</option></primary>
5759 </indexterm>
5760 <indexterm role="concept">
5761 <primary>syslog</primary>
5762 <secondary>process name; set with flag</secondary>
5763 </indexterm>
5764 This option is equivalent to setting <option>syslog_processname</option> in the config
5765 file and setting <option>log_file_path</option> to <literal>syslog</literal>.
5766 Its use is restricted to administrators.  The configuration file has to be
5767 read and parsed, to determine access rights, before this is set and takes
5768 effect, so early configuration file errors will not honour this flag.
5769 </para>
5770 <para>
5771 The tag should not be longer than 32 characters.
5772 </para>
5773 </listitem></varlistentry>
5774 <varlistentry>
5775 <term><option>-M</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
5776 <listitem>
5777 <para>
5778 <indexterm role="option">
5779 <primary><option>-M</option></primary>
5780 </indexterm>
5781 <indexterm role="concept">
5782 <primary>forcing delivery</primary>
5783 </indexterm>
5784 <indexterm role="concept">
5785 <primary>delivery</primary>
5786 <secondary>forcing attempt</secondary>
5787 </indexterm>
5788 <indexterm role="concept">
5789 <primary>frozen messages</primary>
5790 <secondary>forcing delivery</secondary>
5791 </indexterm>
5792 This option requests Exim to run a delivery attempt on each message in turn. If
5793 any of the messages are frozen, they are automatically thawed before the
5794 delivery attempt. The settings of <option>queue_domains</option>, <option>queue_smtp_domains</option>,
5795 and <option>hold_domains</option> are ignored.
5796 </para>
5797 <para>
5798 Retry
5799 <indexterm role="concept">
5800 <primary>hints database</primary>
5801 <secondary>overriding retry hints</secondary>
5802 </indexterm>
5803 hints for any of the addresses are overridden &ndash; Exim tries to deliver even if
5804 the normal retry time has not yet been reached. This option requires the caller
5805 to be an admin user. However, there is an option called <option>prod_requires_admin</option>
5806 which can be set false to relax this restriction (and also the same requirement
5807 for the <option>-q</option>, <option>-R</option>, and <option>-S</option> options).
5808 </para>
5809 <para>
5810 The deliveries happen synchronously, that is, the original Exim process does
5811 not terminate until all the delivery attempts have finished. No output is
5812 produced unless there is a serious error. If you want to see what is happening,
5813 use the <option>-v</option> option as well, or inspect Exim&#x2019;s main log.
5814 </para>
5815 </listitem></varlistentry>
5816 <varlistentry>
5817 <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>
5818 <listitem>
5819 <para>
5820 <indexterm role="option">
5821 <primary><option>-Mar</option></primary>
5822 </indexterm>
5823 <indexterm role="concept">
5824 <primary>message</primary>
5825 <secondary>adding recipients</secondary>
5826 </indexterm>
5827 <indexterm role="concept">
5828 <primary>recipient</primary>
5829 <secondary>adding</secondary>
5830 </indexterm>
5831 This option requests Exim to add the addresses to the list of recipients of the
5832 message (<quote>ar</quote> for <quote>add recipients</quote>). The first argument must be a message
5833 id, and the remaining ones must be email addresses. However, if the message is
5834 active (in the middle of a delivery attempt), it is not altered. This option
5835 can be used only by an admin user.
5836 </para>
5837 </listitem></varlistentry>
5838 <varlistentry>
5839 <term><option>-MC</option>&nbsp;&lt;<emphasis>transport</emphasis>&gt;&nbsp;&lt;<emphasis>hostname</emphasis>&gt;&nbsp;&lt;<emphasis>host&nbsp;IP</emphasis>&gt;&nbsp;&lt;<emphasis>sequence&nbsp;number</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
5840 <listitem>
5841 <para>
5842 <indexterm role="option">
5843 <primary><option>-MC</option></primary>
5844 </indexterm>
5845 <indexterm role="concept">
5846 <primary>SMTP</primary>
5847 <secondary>passed connection</secondary>
5848 </indexterm>
5849 <indexterm role="concept">
5850 <primary>SMTP</primary>
5851 <secondary>multiple deliveries</secondary>
5852 </indexterm>
5853 <indexterm role="concept">
5854 <primary>multiple SMTP deliveries</primary>
5855 </indexterm>
5856 This option is not intended for use by external callers. It is used internally
5857 by Exim to invoke another instance of itself to deliver a waiting message using
5858 an existing SMTP connection, which is passed as the standard input. Details are
5859 given in chapter <xref linkend="CHAPSMTP"/>. This must be the final option, and the caller
5860 must be root or the Exim user in order to use it.
5861 </para>
5862 </listitem></varlistentry>
5863 <varlistentry>
5864 <term><option>-MCA</option></term>
5865 <listitem>
5866 <para>
5867 <indexterm role="option">
5868 <primary><option>-MCA</option></primary>
5869 </indexterm>
5870 This option is not intended for use by external callers. It is used internally
5871 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5872 connection to the remote host has been authenticated.
5873 </para>
5874 </listitem></varlistentry>
5875 <varlistentry>
5876 <term><option>-MCD</option></term>
5877 <listitem>
5878 <para>
5879 <indexterm role="option">
5880 <primary><option>-MCD</option></primary>
5881 </indexterm>
5882 This option is not intended for use by external callers. It is used internally
5883 by Exim in conjunction with the <option>-MC</option> option. It signifies that the
5884 remote host supports the ESMTP <filename>DSN</filename> extension.
5885 </para>
5886 </listitem></varlistentry>
5887 <varlistentry>
5888 <term><option>-MCd</option></term>
5889 <listitem>
5890 <para>
5891 <indexterm role="option">
5892 <primary><option>-MCd</option></primary>
5893 </indexterm>
5894 This option is not intended for use by external callers. It is used internally
5895 by Exim in conjunction with the <option>-d</option> option
5896 to pass on an information string on the purpose of the process.
5897 </para>
5898 </listitem></varlistentry>
5899 <varlistentry>
5900 <term><option>-MCG</option>&nbsp;&lt;<emphasis>queue&nbsp;name</emphasis>&gt;</term>
5901 <listitem>
5902 <para>
5903 <indexterm role="option">
5904 <primary><option>-MCG</option></primary>
5905 </indexterm>
5906 This option is not intended for use by external callers. It is used internally
5907 by Exim in conjunction with the <option>-MC</option> option. It signifies that an
5908 alternate queue is used, named by the following argument.
5909 </para>
5910 </listitem></varlistentry>
5911 <varlistentry>
5912 <term><option>-MCK</option></term>
5913 <listitem>
5914 <para>
5915 <indexterm role="option">
5916 <primary><option>-MCK</option></primary>
5917 </indexterm>
5918 This option is not intended for use by external callers. It is used internally
5919 by Exim in conjunction with the <option>-MC</option> option. It signifies that a
5920 remote host supports the ESMTP <filename>CHUNKING</filename> extension.
5921 </para>
5922 </listitem></varlistentry>
5923 <varlistentry>
5924 <term><option>-MCL</option></term>
5925 <listitem>
5926 <para>
5927 <indexterm role="option">
5928 <primary><option>-MCL</option></primary>
5929 </indexterm>
5930 This option is not intended for use by external callers. It is used internally
5931 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5932 which Exim is connected advertised limits on numbers of mails, recipients or
5933 recipient domains.
5934 The limits are given by the following three arguments.
5935 </para>
5936 </listitem></varlistentry>
5937 <varlistentry>
5938 <term><option>-MCP</option></term>
5939 <listitem>
5940 <para>
5941 <indexterm role="option">
5942 <primary><option>-MCP</option></primary>
5943 </indexterm>
5944 This option is not intended for use by external callers. It is used internally
5945 by Exim in conjunction with the <option>-MC</option> option. It signifies that the server to
5946 which Exim is connected supports pipelining.
5947 </para>
5948 </listitem></varlistentry>
5949 <varlistentry>
5950 <term><option>-MCp</option></term>
5951 <listitem>
5952 <para>
5953 <indexterm role="option">
5954 <primary><option>-MCp</option></primary>
5955 </indexterm>
5956 This option is not intended for use by external callers. It is used internally
5957 by Exim in conjunction with the <option>-MC</option> option. It signifies that the connection
5958 t a remote server is via a SOCKS proxy, using addresses and ports given by
5959 the following four arguments.
5960 </para>
5961 </listitem></varlistentry>
5962 <varlistentry>
5963 <term><option>-MCQ</option>&nbsp;&lt;<emphasis>process&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>pipe&nbsp;fd</emphasis>&gt;</term>
5964 <listitem>
5965 <para>
5966 <indexterm role="option">
5967 <primary><option>-MCQ</option></primary>
5968 </indexterm>
5969 This option is not intended for use by external callers. It is used internally
5970 by Exim in conjunction with the <option>-MC</option> option when the original delivery was
5971 started by a queue runner. It passes on the process id of the queue runner,
5972 together with the file descriptor number of an open pipe. Closure of the pipe
5973 signals the final completion of the sequence of processes that are passing
5974 messages through the same SMTP connection.
5975 </para>
5976 </listitem></varlistentry>
5977 <varlistentry>
5978 <term><option>-MCq</option>&nbsp;&lt;<emphasis>recipient&nbsp;address</emphasis>&gt;&nbsp;&lt;<emphasis>size</emphasis>&gt;</term>
5979 <listitem>
5980 <para>
5981 <indexterm role="option">
5982 <primary><option>-MCq</option></primary>
5983 </indexterm>
5984 This option is not intended for use by external callers. It is used internally
5985 by Exim to implement quota checking for local users.
5986 </para>
5987 </listitem></varlistentry>
5988 <varlistentry>
5989 <term><option>-MCS</option></term>
5990 <listitem>
5991 <para>
5992 <indexterm role="option">
5993 <primary><option>-MCS</option></primary>
5994 </indexterm>
5995 This option is not intended for use by external callers. It is used internally
5996 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
5997 ESMTP SIZE option should be used on messages delivered down the existing
5998 connection.
5999 </para>
6000 </listitem></varlistentry>
6001 <varlistentry>
6002 <term><option>-MCT</option></term>
6003 <listitem>
6004 <para>
6005 <indexterm role="option">
6006 <primary><option>-MCT</option></primary>
6007 </indexterm>
6008 This option is not intended for use by external callers. It is used internally
6009 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
6010 host to which Exim is connected supports TLS encryption.
6011 </para>
6012 </listitem></varlistentry>
6013 <varlistentry>
6014 <term><option>-MCr</option>&nbsp;&lt;<emphasis>SNI</emphasis>&gt;</term>
6015 <term><option>-MCs</option>&nbsp;&lt;<emphasis>SNI</emphasis>&gt;</term>
6016 <listitem>
6017 <para>
6018 <indexterm role="option">
6019 <primary><option>-MCs</option></primary>
6020 </indexterm>
6021 <indexterm role="option">
6022 <primary><option>-MCr</option></primary>
6023 </indexterm>
6024 These options are not intended for use by external callers. It is used internally
6025 by Exim in conjunction with the <option>-MCt</option> option, and passes on the fact that
6026 a TLS Server Name Indication was sent as part of the channel establishment.
6027 The argument gives the SNI string.
6028 The "r" variant indicates a DANE-verified connection.
6029 </para>
6030 </listitem></varlistentry>
6031 <varlistentry>
6032 <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>
6033 <listitem>
6034 <para>
6035 <indexterm role="option">
6036 <primary><option>-MCt</option></primary>
6037 </indexterm>
6038 This option is not intended for use by external callers. It is used internally
6039 by Exim in conjunction with the <option>-MC</option> option, and passes on the fact that the
6040 connection is being proxied by a parent process for handling TLS encryption.
6041 The arguments give the local address and port being proxied, and the TLS cipher.
6042 </para>
6043 </listitem></varlistentry>
6044 <varlistentry>
6045 <term><option>-Mc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6046 <listitem>
6047 <para>
6048 <indexterm role="option">
6049 <primary><option>-Mc</option></primary>
6050 </indexterm>
6051 <indexterm role="concept">
6052 <primary>hints database</primary>
6053 <secondary>not overridden by <option>-Mc</option></secondary>
6054 </indexterm>
6055 <indexterm role="concept">
6056 <primary>delivery</primary>
6057 <secondary>manually started &ndash; not forced</secondary>
6058 </indexterm>
6059 This option requests Exim to run a delivery attempt on each message, in turn,
6060 but unlike the <option>-M</option> option, it does check for retry hints, and respects any
6061 that are found. This option is not very useful to external callers. It is
6062 provided mainly for internal use by Exim when it needs to re-invoke itself in
6063 order to regain root privilege for a delivery (see chapter <xref linkend="CHAPsecurity"/>).
6064 However, <option>-Mc</option> can be useful when testing, in order to run a delivery that
6065 respects retry times and other options such as <option>hold_domains</option> that are
6066 overridden when <option>-M</option> is used. Such a delivery does not count as a queue run.
6067 If you want to run a specific delivery as if in a queue run, you should use
6068 <option>-q</option> with a message id argument. A distinction between queue run deliveries
6069 and other deliveries is made in one or two places.
6070 </para>
6071 </listitem></varlistentry>
6072 <varlistentry>
6073 <term><option>-Mes</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6074 <listitem>
6075 <para>
6076 <indexterm role="option">
6077 <primary><option>-Mes</option></primary>
6078 </indexterm>
6079 <indexterm role="concept">
6080 <primary>message</primary>
6081 <secondary>changing sender</secondary>
6082 </indexterm>
6083 <indexterm role="concept">
6084 <primary>sender</primary>
6085 <secondary>changing</secondary>
6086 </indexterm>
6087 This option requests Exim to change the sender address in the message to the
6088 given address, which must be a fully qualified address or <quote>&lt;&gt;</quote> (<quote>es</quote> for
6089 <quote>edit sender</quote>). There must be exactly two arguments. The first argument must
6090 be a message id, and the second one an email address. However, if the message
6091 is active (in the middle of a delivery attempt), its status is not altered.
6092 This option can be used only by an admin user.
6093 </para>
6094 </listitem></varlistentry>
6095 <varlistentry>
6096 <term><option>-Mf</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6097 <listitem>
6098 <para>
6099 <indexterm role="option">
6100 <primary><option>-Mf</option></primary>
6101 </indexterm>
6102 <indexterm role="concept">
6103 <primary>freezing messages</primary>
6104 </indexterm>
6105 <indexterm role="concept">
6106 <primary>message</primary>
6107 <secondary>manually freezing</secondary>
6108 </indexterm>
6109 This option requests Exim to mark each listed message as <quote>frozen</quote>. This
6110 prevents any delivery attempts taking place until the message is <quote>thawed</quote>,
6111 either manually or as a result of the <option>auto_thaw</option> configuration option.
6112 However, if any of the messages are active (in the middle of a delivery
6113 attempt), their status is not altered. This option can be used only by an admin
6114 user.
6115 </para>
6116 </listitem></varlistentry>
6117 <varlistentry>
6118 <term><option>-Mg</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6119 <listitem>
6120 <para>
6121 <indexterm role="option">
6122 <primary><option>-Mg</option></primary>
6123 </indexterm>
6124 <indexterm role="concept">
6125 <primary>giving up on messages</primary>
6126 </indexterm>
6127 <indexterm role="concept">
6128 <primary>message</primary>
6129 <secondary>abandoning delivery attempts</secondary>
6130 </indexterm>
6131 <indexterm role="concept">
6132 <primary>delivery</primary>
6133 <secondary>abandoning further attempts</secondary>
6134 </indexterm>
6135 This option requests Exim to give up trying to deliver the listed messages,
6136 including any that are frozen. However, if any of the messages are active,
6137 their status is not altered. For non-bounce messages, a delivery error message
6138 is sent to the sender, containing the text <quote>cancelled by administrator</quote>.
6139 Bounce messages are just discarded. This option can be used only by an admin
6140 user.
6141 </para>
6142 </listitem></varlistentry>
6143 <varlistentry>
6144 <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>
6145 <listitem>
6146 <para>
6147 <indexterm role="option">
6148 <primary><option>-MG</option></primary>
6149 </indexterm>
6150 <indexterm role="concept">
6151 <primary>queue</primary>
6152 <secondary>named</secondary>
6153 </indexterm>
6154 <indexterm role="concept">
6155 <primary>named queues</primary>
6156 <secondary>moving messages</secondary>
6157 </indexterm>
6158 <indexterm role="concept">
6159 <primary>queue</primary>
6160 <secondary>moving messages</secondary>
6161 </indexterm>
6162 This option requests that each listed message be moved from its current
6163 queue to the given named queue.
6164 The destination queue name argument is required, but can be an empty
6165 string to define the default queue.
6166 If the messages are not currently located in the default queue,
6167 a <option>-qG&lt;name&gt;</option> option will be required to define the source queue.
6168 </para>
6169 </listitem></varlistentry>
6170 <varlistentry>
6171 <term><option>-Mmad</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6172 <listitem>
6173 <para>
6174 <indexterm role="option">
6175 <primary><option>-Mmad</option></primary>
6176 </indexterm>
6177 <indexterm role="concept">
6178 <primary>delivery</primary>
6179 <secondary>cancelling all</secondary>
6180 </indexterm>
6181 This option requests Exim to mark all the recipient addresses in the messages
6182 as already delivered (<quote>mad</quote> for <quote>mark all delivered</quote>). However, if any
6183 message is active (in the middle of a delivery attempt), its status is not
6184 altered. This option can be used only by an admin user.
6185 </para>
6186 </listitem></varlistentry>
6187 <varlistentry>
6188 <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>
6189 <listitem>
6190 <para>
6191 <indexterm role="option">
6192 <primary><option>-Mmd</option></primary>
6193 </indexterm>
6194 <indexterm role="concept">
6195 <primary>delivery</primary>
6196 <secondary>cancelling by address</secondary>
6197 </indexterm>
6198 <indexterm role="concept">
6199 <primary>recipient</primary>
6200 <secondary>removing</secondary>
6201 </indexterm>
6202 <indexterm role="concept">
6203 <primary>removing recipients</primary>
6204 </indexterm>
6205 This option requests Exim to mark the given addresses as already delivered
6206 (<quote>md</quote> for <quote>mark delivered</quote>). The first argument must be a message id, and
6207 the remaining ones must be email addresses. These are matched to recipient
6208 addresses in the message in a case-sensitive manner. If the message is active
6209 (in the middle of a delivery attempt), its status is not altered. This option
6210 can be used only by an admin user.
6211 </para>
6212 </listitem></varlistentry>
6213 <varlistentry>
6214 <term><option>-Mrm</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6215 <listitem>
6216 <para>
6217 <indexterm role="option">
6218 <primary><option>-Mrm</option></primary>
6219 </indexterm>
6220 <indexterm role="concept">
6221 <primary>removing messages</primary>
6222 </indexterm>
6223 <indexterm role="concept">
6224 <primary>abandoning mail</primary>
6225 </indexterm>
6226 <indexterm role="concept">
6227 <primary>message</primary>
6228 <secondary>manually discarding</secondary>
6229 </indexterm>
6230 This option requests Exim to remove the given messages from the queue. No
6231 bounce messages are sent; each message is simply forgotten. However, if any of
6232 the messages are active, their status is not altered. This option can be used
6233 only by an admin user or by the user who originally caused the message to be
6234 placed in the queue.
6235 </para>
6236 </listitem></varlistentry>
6237 <varlistentry>
6238 <term><option>-Mset</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6239 <listitem>
6240 <para>
6241 <indexterm role="option">
6242 <primary><option>-Mset</option></primary>
6243 </indexterm>
6244 <indexterm role="concept">
6245 <primary>testing</primary>
6246 <secondary>string expansion</secondary>
6247 </indexterm>
6248 <indexterm role="concept">
6249 <primary>expansion</primary>
6250 <secondary>testing</secondary>
6251 </indexterm>
6252 This option is useful only in conjunction with <option>-be</option> (that is, when testing
6253 string expansions). Exim loads the given message from its spool before doing
6254 the test expansions, thus setting message-specific variables such as
6255 <varname>$message_size</varname> and the header variables. The <varname>$recipients</varname> variable is made
6256 available. This feature is provided to make it easier to test expansions that
6257 make use of these variables. However, this option can be used only by an admin
6258 user. See also <option>-bem</option>.
6259 </para>
6260 </listitem></varlistentry>
6261 <varlistentry>
6262 <term><option>-Mt</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;&nbsp;...</term>
6263 <listitem>
6264 <para>
6265 <indexterm role="option">
6266 <primary><option>-Mt</option></primary>
6267 </indexterm>
6268 <indexterm role="concept">
6269 <primary>thawing messages</primary>
6270 </indexterm>
6271 <indexterm role="concept">
6272 <primary>unfreezing messages</primary>
6273 </indexterm>
6274 <indexterm role="concept">
6275 <primary>frozen messages</primary>
6276 <secondary>thawing</secondary>
6277 </indexterm>
6278 <indexterm role="concept">
6279 <primary>message</primary>
6280 <secondary>thawing frozen</secondary>
6281 </indexterm>
6282 This option requests Exim to <quote>thaw</quote> any of the listed messages that are
6283 <quote>frozen</quote>, so that delivery attempts can resume. However, if any of the
6284 messages are active, their status is not altered. This option can be used only
6285 by an admin user.
6286 </para>
6287 </listitem></varlistentry>
6288 <varlistentry>
6289 <term><option>-Mvb</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6290 <listitem>
6291 <para>
6292 <indexterm role="option">
6293 <primary><option>-Mvb</option></primary>
6294 </indexterm>
6295 <indexterm role="concept">
6296 <primary>listing</primary>
6297 <secondary>message body</secondary>
6298 </indexterm>
6299 <indexterm role="concept">
6300 <primary>message</primary>
6301 <secondary>listing body of</secondary>
6302 </indexterm>
6303 This option causes the contents of the message body (-D) spool file to be
6304 written to the standard output. This option can be used only by an admin user.
6305 </para>
6306 </listitem></varlistentry>
6307 <varlistentry>
6308 <term><option>-Mvc</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6309 <listitem>
6310 <para>
6311 <indexterm role="option">
6312 <primary><option>-Mvc</option></primary>
6313 </indexterm>
6314 <indexterm role="concept">
6315 <primary>message</primary>
6316 <secondary>listing in RFC 2822 format</secondary>
6317 </indexterm>
6318 <indexterm role="concept">
6319 <primary>listing</primary>
6320 <secondary>message in RFC 2822 format</secondary>
6321 </indexterm>
6322 This option causes a copy of the complete message (header lines plus body) to
6323 be written to the standard output in RFC 2822 format. This option can be used
6324 only by an admin user.
6325 </para>
6326 </listitem></varlistentry>
6327 <varlistentry>
6328 <term><option>-Mvh</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6329 <listitem>
6330 <para>
6331 <indexterm role="option">
6332 <primary><option>-Mvh</option></primary>
6333 </indexterm>
6334 <indexterm role="concept">
6335 <primary>listing</primary>
6336 <secondary>message headers</secondary>
6337 </indexterm>
6338 <indexterm role="concept">
6339 <primary>header lines</primary>
6340 <secondary>listing</secondary>
6341 </indexterm>
6342 <indexterm role="concept">
6343 <primary>message</primary>
6344 <secondary>listing header lines</secondary>
6345 </indexterm>
6346 This option causes the contents of the message headers (-H) spool file to be
6347 written to the standard output. This option can be used only by an admin user.
6348 </para>
6349 </listitem></varlistentry>
6350 <varlistentry>
6351 <term><option>-Mvl</option>&nbsp;&lt;<emphasis>message&nbsp;id</emphasis>&gt;</term>
6352 <listitem>
6353 <para>
6354 <indexterm role="option">
6355 <primary><option>-Mvl</option></primary>
6356 </indexterm>
6357 <indexterm role="concept">
6358 <primary>listing</primary>
6359 <secondary>message log</secondary>
6360 </indexterm>
6361 <indexterm role="concept">
6362 <primary>message</primary>
6363 <secondary>listing message log</secondary>
6364 </indexterm>
6365 This option causes the contents of the message log spool file to be written to
6366 the standard output. This option can be used only by an admin user.
6367 </para>
6368 </listitem></varlistentry>
6369 <varlistentry>
6370 <term><option>-m</option></term>
6371 <listitem>
6372 <para>
6373 <indexterm role="option">
6374 <primary><option>-m</option></primary>
6375 </indexterm>
6376 This is a synonym for <option>-om</option> that is accepted by Sendmail
6377 (<emphasis role="bold"><ulink url="https://docs.oracle.com/cd/E19457-01/801-6680-1M/801-6680-1M.pdf">https://docs.oracle.com/cd/E19457-01/801-6680-1M/801-6680-1M.pdf</ulink></emphasis>
6378 p. 1M-258), so Exim treats it that way too.
6379 </para>
6380 </listitem></varlistentry>
6381 <varlistentry>
6382 <term><option>-N</option></term>
6383 <listitem>
6384 <para>
6385 <indexterm role="option">
6386 <primary><option>-N</option></primary>
6387 </indexterm>
6388 <indexterm role="concept">
6389 <primary>debugging</primary>
6390 <secondary><option>-N</option> option</secondary>
6391 </indexterm>
6392 <indexterm role="concept">
6393 <primary>debugging</primary>
6394 <secondary>suppressing delivery</secondary>
6395 </indexterm>
6396 This is a debugging option that inhibits delivery of a message at the transport
6397 level. It implies <option>-v</option>. Exim goes through many of the motions of delivery &ndash;
6398 it just doesn&#x2019;t actually transport the message, but instead behaves as if it
6399 had successfully done so. However, it does not make any updates to the retry
6400 database, and the log entries for deliveries are flagged with <quote>*&gt;</quote> rather
6401 than <quote>=&gt;</quote>.
6402 </para>
6403 <para>
6404 Because <option>-N</option> discards any message to which it applies, only root or the Exim
6405 user are allowed to use it with <option>-bd</option>, <option>-q</option>, <option>-R</option> or <option>-M</option>. In other
6406 words, an ordinary user can use it only when supplying an incoming message to
6407 which it will apply. Although transportation never fails when <option>-N</option> is set, an
6408 address may be deferred because of a configuration problem on a transport, or a
6409 routing problem. Once <option>-N</option> has been used for a delivery attempt, it sticks to
6410 the message, and applies to any subsequent delivery attempts that may happen
6411 for that message.
6412 </para>
6413 </listitem></varlistentry>
6414 <varlistentry>
6415 <term><option>-n</option></term>
6416 <listitem>
6417 <para>
6418 <indexterm role="option">
6419 <primary><option>-n</option></primary>
6420 </indexterm>
6421 This option is interpreted by Sendmail to mean <quote>no aliasing</quote>.
6422 For normal modes of operation, it is ignored by Exim.
6423 When combined with <option>-bP</option> it makes the output more terse (suppresses
6424 option names, environment values and config pretty printing).
6425 </para>
6426 </listitem></varlistentry>
6427 <varlistentry>
6428 <term><option>-O</option>&nbsp;&lt;<emphasis>data</emphasis>&gt;</term>
6429 <listitem>
6430 <para>
6431 <indexterm role="option">
6432 <primary><option>-O</option></primary>
6433 </indexterm>
6434 This option is interpreted by Sendmail to mean <literal>set option</literal>. It is ignored by
6435 Exim.
6436 </para>
6437 </listitem></varlistentry>
6438 <varlistentry>
6439 <term><option>-oA</option>&nbsp;&lt;<emphasis>file&nbsp;name</emphasis>&gt;</term>
6440 <listitem>
6441 <para>
6442 <indexterm role="option">
6443 <primary><option>-oA</option></primary>
6444 </indexterm>
6445 <indexterm role="concept">
6446 <primary>Sendmail compatibility</primary>
6447 <secondary><option>-oA</option> option</secondary>
6448 </indexterm>
6449 This option is used by Sendmail in conjunction with <option>-bi</option> to specify an
6450 alternative alias filename. Exim handles <option>-bi</option> differently; see the
6451 description above.
6452 </para>
6453 </listitem></varlistentry>
6454 <varlistentry>
6455 <term><option>-oB</option>&nbsp;&lt;<emphasis>n</emphasis>&gt;</term>
6456 <listitem>
6457 <para>
6458 <indexterm role="option">
6459 <primary><option>-oB</option></primary>
6460 </indexterm>
6461 <indexterm role="concept">
6462 <primary>SMTP</primary>
6463 <secondary>passed connection</secondary>
6464 </indexterm>
6465 <indexterm role="concept">
6466 <primary>SMTP</primary>
6467 <secondary>multiple deliveries</secondary>
6468 </indexterm>
6469 <indexterm role="concept">
6470 <primary>multiple SMTP deliveries</primary>
6471 </indexterm>
6472 This is a debugging option which limits the maximum number of messages that can
6473 be delivered down one SMTP connection, overriding the value set in any <command>smtp</command>
6474 transport. If &lt;<emphasis>n</emphasis>&gt; is omitted, the limit is set to 1.
6475 </para>
6476 </listitem></varlistentry>
6477 <varlistentry>
6478 <term><option>-odb</option></term>
6479 <listitem>
6480 <para>
6481 <indexterm role="option">
6482 <primary><option>-odb</option></primary>
6483 </indexterm>
6484 <indexterm role="concept">
6485 <primary>background delivery</primary>
6486 </indexterm>
6487 <indexterm role="concept">
6488 <primary>delivery</primary>
6489 <secondary>in the background</secondary>
6490 </indexterm>
6491 This option applies to all modes in which Exim accepts incoming messages,
6492 including the listening daemon. It requests <quote>background</quote> delivery of such
6493 messages, which means that the accepting process automatically starts a
6494 delivery process for each message received, but does not wait for the delivery
6495 processes to finish.
6496 </para>
6497 <para>
6498 When all the messages have been received, the reception process exits,
6499 leaving the delivery processes to finish in their own time. The standard output
6500 and error streams are closed at the start of each delivery process.
6501 This is the default action if none of the <option>-od</option> options are present.
6502 </para>
6503 <para>
6504 If one of the queueing options in the configuration file
6505 (<option>queue_only</option> or <option>queue_only_file</option>, for example) is in effect, <option>-odb</option>
6506 overrides it if <option>queue_only_override</option> is set true, which is the default
6507 setting. If <option>queue_only_override</option> is set false, <option>-odb</option> has no effect.
6508 </para>
6509 </listitem></varlistentry>
6510 <varlistentry>
6511 <term><option>-odf</option></term>
6512 <listitem>
6513 <para>
6514 <indexterm role="option">
6515 <primary><option>-odf</option></primary>
6516 </indexterm>
6517 <indexterm role="concept">
6518 <primary>foreground delivery</primary>
6519 </indexterm>
6520 <indexterm role="concept">
6521 <primary>delivery</primary>
6522 <secondary>in the foreground</secondary>
6523 </indexterm>
6524 This option requests <quote>foreground</quote> (synchronous) delivery when Exim has
6525 accepted a locally-generated message. (For the daemon it is exactly the same as
6526 <option>-odb</option>.) A delivery process is automatically started to deliver the message,
6527 and Exim waits for it to complete before proceeding.
6528 </para>
6529 <para>
6530 The original Exim reception process does not finish until the delivery
6531 process for the final message has ended. The standard error stream is left open
6532 during deliveries.
6533 </para>
6534 <para>
6535 However, like <option>-odb</option>, this option has no effect if <option>queue_only_override</option> is
6536 false and one of the queueing options in the configuration file is in effect.
6537 </para>
6538 <para>
6539 If there is a temporary delivery error during foreground delivery, the
6540 message is left in the queue for later delivery, and the original reception
6541 process exits. See chapter <xref linkend="CHAPnonqueueing"/> for a way of setting up a
6542 restricted configuration that never queues messages.
6543 </para>
6544 </listitem></varlistentry>
6545 <varlistentry>
6546 <term><option>-odi</option></term>
6547 <listitem>
6548 <para>
6549 <indexterm role="option">
6550 <primary><option>-odi</option></primary>
6551 </indexterm>
6552 This option is synonymous with <option>-odf</option>. It is provided for compatibility with
6553 Sendmail.
6554 </para>
6555 </listitem></varlistentry>
6556 <varlistentry>
6557 <term><option>-odq</option></term>
6558 <listitem>
6559 <para>
6560 <indexterm role="option">
6561 <primary><option>-odq</option></primary>
6562 </indexterm>
6563 <indexterm role="concept">
6564 <primary>non-immediate delivery</primary>
6565 </indexterm>
6566 <indexterm role="concept">
6567 <primary>delivery</primary>
6568 <secondary>suppressing immediate</secondary>
6569 </indexterm>
6570 <indexterm role="concept">
6571 <primary>queueing incoming messages</primary>
6572 </indexterm>
6573 This option applies to all modes in which Exim accepts incoming messages,
6574 including the listening daemon. It specifies that the accepting process should
6575 not automatically start a delivery process for each message received. Messages
6576 are placed in the queue, and remain there until a subsequent queue runner
6577 process encounters them. There are several configuration options (such as
6578 <option>queue_only</option>) that can be used to queue incoming messages under certain
6579 conditions. This option overrides all of them and also <option>-odqs</option>. It always
6580 forces queueing.
6581 </para>
6582 </listitem></varlistentry>
6583 <varlistentry>
6584 <term><option>-odqs</option></term>
6585 <listitem>
6586 <para>
6587 <indexterm role="option">
6588 <primary><option>-odqs</option></primary>
6589 </indexterm>
6590 <indexterm role="concept">
6591 <primary>SMTP</primary>
6592 <secondary>delaying delivery</secondary>
6593 </indexterm>
6594 <indexterm role="concept">
6595 <primary>first pass routing</primary>
6596 </indexterm>
6597 This option is a hybrid between <option>-odb</option>/<option>-odi</option> and <option>-odq</option>.
6598 However, like <option>-odb</option> and <option>-odi</option>, this option has no effect if
6599 <option>queue_only_override</option> is false and one of the queueing options in the
6600 configuration file is in effect.
6601 </para>
6602 <para>
6603 When <option>-odqs</option> does operate, a delivery process is started for each incoming
6604 message, in the background by default, but in the foreground if <option>-odi</option> is
6605 also present. The recipient addresses are routed, and local deliveries are done
6606 in the normal way. However, if any SMTP deliveries are required, they are not
6607 done at this time, so the message remains in the queue until a subsequent queue
6608 runner process encounters it. Because routing was done, Exim knows which
6609 messages are waiting for which hosts, and so a number of messages for the same
6610 host can be sent in a single SMTP connection. The <option>queue_smtp_domains</option>
6611 configuration option has the same effect for specific domains. See also the
6612 <option>-qq</option> option.
6613 </para>
6614 </listitem></varlistentry>
6615 <varlistentry>
6616 <term><option>-oee</option></term>
6617 <listitem>
6618 <para>
6619 <indexterm role="option">
6620 <primary><option>-oee</option></primary>
6621 </indexterm>
6622 <indexterm role="concept">
6623 <primary>error</primary>
6624 <secondary>reporting</secondary>
6625 </indexterm>
6626 If an error is detected while a non-SMTP message is being received (for
6627 example, a malformed address), the error is reported to the sender in a mail
6628 message.
6629 </para>
6630 <para>
6631 <indexterm role="concept">
6632 <primary>return code</primary>
6633 <secondary>for <option>-oee</option></secondary>
6634 </indexterm>
6635 Provided
6636 this error message is successfully sent, the Exim receiving process
6637 exits with a return code of zero. If not, the return code is 2 if the problem
6638 is that the original message has no recipients, or 1 for any other error.
6639 This is the default <option>-oe</option><emphasis>x</emphasis> option if Exim is called as <emphasis>rmail</emphasis>.
6640 </para>
6641 </listitem></varlistentry>
6642 <varlistentry>
6643 <term><option>-oem</option></term>
6644 <listitem>
6645 <para>
6646 <indexterm role="option">
6647 <primary><option>-oem</option></primary>
6648 </indexterm>
6649 <indexterm role="concept">
6650 <primary>error</primary>
6651 <secondary>reporting</secondary>
6652 </indexterm>
6653 <indexterm role="concept">
6654 <primary>return code</primary>
6655 <secondary>for <option>-oem</option></secondary>
6656 </indexterm>
6657 This is the same as <option>-oee</option>, except that Exim always exits with a non-zero
6658 return code, whether or not the error message was successfully sent.
6659 This is the default <option>-oe</option><emphasis>x</emphasis> option, unless Exim is called as <emphasis>rmail</emphasis>.
6660 </para>
6661 </listitem></varlistentry>
6662 <varlistentry>
6663 <term><option>-oep</option></term>
6664 <listitem>
6665 <para>
6666 <indexterm role="option">
6667 <primary><option>-oep</option></primary>
6668 </indexterm>
6669 <indexterm role="concept">
6670 <primary>error</primary>
6671 <secondary>reporting</secondary>
6672 </indexterm>
6673 If an error is detected while a non-SMTP message is being received, the
6674 error is reported by writing a message to the standard error file (stderr).
6675 <indexterm role="concept">
6676 <primary>return code</primary>
6677 <secondary>for <option>-oep</option></secondary>
6678 </indexterm>
6679 The return code is 1 for all errors.
6680 </para>
6681 </listitem></varlistentry>
6682 <varlistentry>
6683 <term><option>-oeq</option></term>
6684 <listitem>
6685 <para>
6686 <indexterm role="option">
6687 <primary><option>-oeq</option></primary>
6688 </indexterm>
6689 <indexterm role="concept">
6690 <primary>error</primary>
6691 <secondary>reporting</secondary>
6692 </indexterm>
6693 This option is supported for compatibility with Sendmail, but has the same
6694 effect as <option>-oep</option>.
6695 </para>
6696 </listitem></varlistentry>
6697 <varlistentry>
6698 <term><option>-oew</option></term>
6699 <listitem>
6700 <para>
6701 <indexterm role="option">
6702 <primary><option>-oew</option></primary>
6703 </indexterm>
6704 <indexterm role="concept">
6705 <primary>error</primary>
6706 <secondary>reporting</secondary>
6707 </indexterm>
6708 This option is supported for compatibility with Sendmail, but has the same
6709 effect as <option>-oem</option>.
6710 </para>
6711 </listitem></varlistentry>
6712 <varlistentry>
6713 <term><option>-oi</option></term>
6714 <listitem>
6715 <para>
6716 <indexterm role="option">
6717 <primary><option>-oi</option></primary>
6718 </indexterm>
6719 <indexterm role="concept">
6720 <primary>dot</primary>
6721 <secondary>in incoming non-SMTP message</secondary>
6722 </indexterm>
6723 This option, which has the same effect as <option>-i</option>, specifies that a dot on a
6724 line by itself should not terminate an incoming, non-SMTP message. Otherwise, a
6725 single dot does terminate, though Exim does no special processing for other
6726 lines that start with a dot. This option is set by default if Exim is called as
6727 <emphasis>rmail</emphasis>. See also <option>-ti</option>.
6728 </para>
6729 </listitem></varlistentry>
6730 <varlistentry>
6731 <term><option>-oitrue</option></term>
6732 <listitem>
6733 <para>
6734 <indexterm role="option">
6735 <primary><option>-oitrue</option></primary>
6736 </indexterm>
6737 This option is treated as synonymous with <option>-oi</option>.
6738 </para>
6739 </listitem></varlistentry>
6740 <varlistentry>
6741 <term><option>-oMa</option>&nbsp;&lt;<emphasis>host&nbsp;address</emphasis>&gt;</term>
6742 <listitem>
6743 <para>
6744 <indexterm role="option">
6745 <primary><option>-oMa</option></primary>
6746 </indexterm>
6747 <indexterm role="concept">
6748 <primary>sender</primary>
6749 <secondary>host address, specifying for local message</secondary>
6750 </indexterm>
6751 A number of options starting with <option>-oM</option> can be used to set values associated
6752 with remote hosts on locally-submitted messages (that is, messages not received
6753 over TCP/IP). These options can be used by any caller in conjunction with the
6754 <option>-bh</option>, <option>-be</option>, <option>-bf</option>, <option>-bF</option>, <option>-bt</option>, or <option>-bv</option> testing options. In
6755 other circumstances, they are ignored unless the caller is trusted.
6756 </para>
6757 <para>
6758 The <option>-oMa</option> option sets the sender host address. This may include a port
6759 number at the end, after a full stop (period). For example:
6760 </para>
6761 <literallayout class="monospaced">
6762 exim -bs -oMa 10.9.8.7.1234
6763 </literallayout>
6764 <para>
6765 An alternative syntax is to enclose the IP address in square brackets,
6766 followed by a colon and the port number:
6767 </para>
6768 <literallayout class="monospaced">
6769 exim -bs -oMa [10.9.8.7]:1234
6770 </literallayout>
6771 <para>
6772 The IP address is placed in the <varname>$sender_host_address</varname> variable, and the
6773 port, if present, in <varname>$sender_host_port</varname>. If both <option>-oMa</option> and <option>-bh</option>
6774 are present on the command line, the sender host IP address is taken from
6775 whichever one is last.
6776 </para>
6777 </listitem></varlistentry>
6778 <varlistentry>
6779 <term><option>-oMaa</option>&nbsp;&lt;<emphasis>name</emphasis>&gt;</term>
6780 <listitem>
6781 <para>
6782 <indexterm role="option">
6783 <primary><option>-oMaa</option></primary>
6784 </indexterm>
6785 <indexterm role="concept">
6786 <primary>authentication</primary>
6787 <secondary>name, specifying for local message</secondary>
6788 </indexterm>
6789 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMaa</option>
6790 option sets the value of <varname>$sender_host_authenticated</varname> (the authenticator
6791 name). See chapter <xref linkend="CHAPSMTPAUTH"/> for a discussion of SMTP authentication.
6792 This option can be used with <option>-bh</option> and <option>-bs</option> to set up an
6793 authenticated SMTP session without actually using the SMTP AUTH command.
6794 </para>
6795 </listitem></varlistentry>
6796 <varlistentry>
6797 <term><option>-oMai</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
6798 <listitem>
6799 <para>
6800 <indexterm role="option">
6801 <primary><option>-oMai</option></primary>
6802 </indexterm>
6803 <indexterm role="concept">
6804 <primary>authentication</primary>
6805 <secondary>id, specifying for local message</secondary>
6806 </indexterm>
6807 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMai</option>
6808 option sets the value of <varname>$authenticated_id</varname> (the id that was authenticated).
6809 This overrides the default value (the caller&#x2019;s login id, except with <option>-bh</option>,
6810 where there is no default) for messages from local sources. See chapter
6811 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated ids.
6812 </para>
6813 </listitem></varlistentry>
6814 <varlistentry>
6815 <term><option>-oMas</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
6816 <listitem>
6817 <para>
6818 <indexterm role="option">
6819 <primary><option>-oMas</option></primary>
6820 </indexterm>
6821 <indexterm role="concept">
6822 <primary>authentication</primary>
6823 <secondary>sender, specifying for local message</secondary>
6824 </indexterm>
6825 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMas</option>
6826 option sets the authenticated sender value in <varname>$authenticated_sender</varname>. It
6827 overrides the sender address that is created from the caller&#x2019;s login id for
6828 messages from local sources, except when <option>-bh</option> is used, when there is no
6829 default. For both <option>-bh</option> and <option>-bs</option>, an authenticated sender that is
6830 specified on a MAIL command overrides this value. See chapter
6831 <xref linkend="CHAPSMTPAUTH"/> for a discussion of authenticated senders.
6832 </para>
6833 </listitem></varlistentry>
6834 <varlistentry>
6835 <term><option>-oMi</option>&nbsp;&lt;<emphasis>interface&nbsp;address</emphasis>&gt;</term>
6836 <listitem>
6837 <para>
6838 <indexterm role="option">
6839 <primary><option>-oMi</option></primary>
6840 </indexterm>
6841 <indexterm role="concept">
6842 <primary>interface</primary>
6843 <secondary>address, specifying for local message</secondary>
6844 </indexterm>
6845 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMi</option>
6846 option sets the IP interface address value. A port number may be included,
6847 using the same syntax as for <option>-oMa</option>. The interface address is placed in
6848 <varname>$received_ip_address</varname> and the port number, if present, in <varname>$received_port</varname>.
6849 </para>
6850 </listitem></varlistentry>
6851 <varlistentry>
6852 <term><option>-oMm</option>&nbsp;&lt;<emphasis>message&nbsp;reference</emphasis>&gt;</term>
6853 <listitem>
6854 <para>
6855 <indexterm role="option">
6856 <primary><option>-oMm</option></primary>
6857 </indexterm>
6858 <indexterm role="concept">
6859 <primary>message reference</primary>
6860 <secondary>message reference, specifying for local message</secondary>
6861 </indexterm>
6862 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMm</option>
6863 option sets the message reference, e.g. message-id, and is logged during
6864 delivery. This is useful when some kind of audit trail is required to tie
6865 messages together. The format of the message reference is checked and will
6866 abort if the format is invalid. The option will only be accepted if exim is
6867 running in trusted mode, not as any regular user.
6868 </para>
6869 <para>
6870 The best example of a message reference is when Exim sends a bounce message.
6871 The message reference is the message-id of the original message for which Exim
6872 is sending the bounce.
6873 </para>
6874 </listitem></varlistentry>
6875 <varlistentry>
6876 <term><option>-oMr</option>&nbsp;&lt;<emphasis>protocol&nbsp;name</emphasis>&gt;</term>
6877 <listitem>
6878 <para>
6879 <indexterm role="option">
6880 <primary><option>-oMr</option></primary>
6881 </indexterm>
6882 <indexterm role="concept">
6883 <primary>protocol, specifying for local message</primary>
6884 </indexterm>
6885 <indexterm role="variable">
6886 <primary><varname>$received_protocol</varname></primary>
6887 </indexterm>
6888 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMr</option>
6889 option sets the received protocol value that is stored in
6890 <varname>$received_protocol</varname>. However, it does not apply (and is ignored) when <option>-bh</option>
6891 or <option>-bs</option> is used. For <option>-bh</option>, the protocol is forced to one of the standard
6892 SMTP protocol names (see the description of <varname>$received_protocol</varname> in section
6893 <xref linkend="SECTexpvar"/>). For <option>-bs</option>, the protocol is always <quote>local-</quote> followed by
6894 one of those same names. For <option>-bS</option> (batched SMTP) however, the protocol can
6895 be set by <option>-oMr</option>. Repeated use of this option is not supported.
6896 </para>
6897 </listitem></varlistentry>
6898 <varlistentry>
6899 <term><option>-oMs</option>&nbsp;&lt;<emphasis>host&nbsp;name</emphasis>&gt;</term>
6900 <listitem>
6901 <para>
6902 <indexterm role="option">
6903 <primary><option>-oMs</option></primary>
6904 </indexterm>
6905 <indexterm role="concept">
6906 <primary>sender</primary>
6907 <secondary>host name, specifying for local message</secondary>
6908 </indexterm>
6909 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMs</option>
6910 option sets the sender host name in <varname>$sender_host_name</varname>. When this option is
6911 present, Exim does not attempt to look up a host name from an IP address; it
6912 uses the name it is given.
6913 </para>
6914 </listitem></varlistentry>
6915 <varlistentry>
6916 <term><option>-oMt</option>&nbsp;&lt;<emphasis>ident&nbsp;string</emphasis>&gt;</term>
6917 <listitem>
6918 <para>
6919 <indexterm role="option">
6920 <primary><option>-oMt</option></primary>
6921 </indexterm>
6922 <indexterm role="concept">
6923 <primary>sender</primary>
6924 <secondary>ident string, specifying for local message</secondary>
6925 </indexterm>
6926 See <option>-oMa</option> above for general remarks about the <option>-oM</option> options. The <option>-oMt</option>
6927 option sets the sender ident value in <varname>$sender_ident</varname>. The default setting for
6928 local callers is the login id of the calling process, except when <option>-bh</option> is
6929 used, when there is no default.
6930 </para>
6931 </listitem></varlistentry>
6932 <varlistentry>
6933 <term><option>-om</option></term>
6934 <listitem>
6935 <para>
6936 <indexterm role="option">
6937 <primary><option>-om</option></primary>
6938 </indexterm>
6939 <indexterm role="concept">
6940 <primary>Sendmail compatibility</primary>
6941 <secondary><option>-om</option> option ignored</secondary>
6942 </indexterm>
6943 In Sendmail, this option means <quote>me too</quote>, indicating that the sender of a
6944 message should receive a copy of the message if the sender appears in an alias
6945 expansion. Exim always does this, so the option does nothing.
6946 </para>
6947 </listitem></varlistentry>
6948 <varlistentry>
6949 <term><option>-oo</option></term>
6950 <listitem>
6951 <para>
6952 <indexterm role="option">
6953 <primary><option>-oo</option></primary>
6954 </indexterm>
6955 <indexterm role="concept">
6956 <primary>Sendmail compatibility</primary>
6957 <secondary><option>-oo</option> option ignored</secondary>
6958 </indexterm>
6959 This option is ignored. In Sendmail it specifies <quote>old style headers</quote>,
6960 whatever that means.
6961 </para>
6962 </listitem></varlistentry>
6963 <varlistentry>
6964 <term><option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
6965 <listitem>
6966 <para>
6967 <indexterm role="option">
6968 <primary><option>-oP</option></primary>
6969 </indexterm>
6970 <indexterm role="concept">
6971 <primary>pid (process id)</primary>
6972 <secondary>of daemon</secondary>
6973 </indexterm>
6974 <indexterm role="concept">
6975 <primary>daemon</primary>
6976 <secondary>process id (pid)</secondary>
6977 </indexterm>
6978 This option is useful only in conjunction with <option>-bd</option> or <option>-q</option> with a time
6979 value. The option specifies the file to which the process id of the daemon is
6980 written. When <option>-oX</option> is used with <option>-bd</option>, or when <option>-q</option> with a time is used
6981 without <option>-bd</option>, this is the only way of causing Exim to write a pid file,
6982 because in those cases, the normal pid file is not used.
6983 </para>
6984 </listitem></varlistentry>
6985 <varlistentry>
6986 <term><option>-oPX</option></term>
6987 <listitem>
6988 <para>
6989 <indexterm role="option">
6990 <primary><option>-oPX</option></primary>
6991 </indexterm>
6992 <indexterm role="concept">
6993 <primary>pid (process id)</primary>
6994 <secondary>of daemon</secondary>
6995 </indexterm>
6996 <indexterm role="concept">
6997 <primary>daemon</primary>
6998 <secondary>process id (pid)</secondary>
6999 </indexterm>
7000 This option is not intended for general use.
7001 The daemon uses it when terminating due to a SIGTEM, possibly in
7002 combination with <option>-oP</option>&nbsp;&lt;<emphasis>path</emphasis>&gt;.
7003 It causes the pid file to be removed.
7004 </para>
7005 </listitem></varlistentry>
7006 <varlistentry>
7007 <term><option>-or</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
7008 <listitem>
7009 <para>
7010 <indexterm role="option">
7011 <primary><option>-or</option></primary>
7012 </indexterm>
7013 <indexterm role="concept">
7014 <primary>timeout</primary>
7015 <secondary>for non-SMTP input</secondary>
7016 </indexterm>
7017 This option sets a timeout value for incoming non-SMTP messages. If it is not
7018 set, Exim will wait forever for the standard input. The value can also be set
7019 by the <option>receive_timeout</option> option. The format used for specifying times is
7020 described in section <xref linkend="SECTtimeformat"/>.
7021 </para>
7022 </listitem></varlistentry>
7023 <varlistentry>
7024 <term><option>-os</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
7025 <listitem>
7026 <para>
7027 <indexterm role="option">
7028 <primary><option>-os</option></primary>
7029 </indexterm>
7030 <indexterm role="concept">
7031 <primary>timeout</primary>
7032 <secondary>for SMTP input</secondary>
7033 </indexterm>
7034 <indexterm role="concept">
7035 <primary>SMTP</primary>
7036 <secondary>input timeout</secondary>
7037 </indexterm>
7038 This option sets a timeout value for incoming SMTP messages. The timeout
7039 applies to each SMTP command and block of data. The value can also be set by
7040 the <option>smtp_receive_timeout</option> option; it defaults to 5 minutes. The format used
7041 for specifying times is described in section <xref linkend="SECTtimeformat"/>.
7042 </para>
7043 </listitem></varlistentry>
7044 <varlistentry>
7045 <term><option>-ov</option></term>
7046 <listitem>
7047 <para>
7048 <indexterm role="option">
7049 <primary><option>-ov</option></primary>
7050 </indexterm>
7051 This option has exactly the same effect as <option>-v</option>.
7052 </para>
7053 </listitem></varlistentry>
7054 <varlistentry>
7055 <term><option>-oX</option>&nbsp;&lt;<emphasis>number&nbsp;or&nbsp;string</emphasis>&gt;</term>
7056 <listitem>
7057 <para>
7058 <indexterm role="option">
7059 <primary><option>-oX</option></primary>
7060 </indexterm>
7061 <indexterm role="concept">
7062 <primary>TCP/IP</primary>
7063 <secondary>setting listening ports</secondary>
7064 </indexterm>
7065 <indexterm role="concept">
7066 <primary>TCP/IP</primary>
7067 <secondary>setting listening interfaces</secondary>
7068 </indexterm>
7069 <indexterm role="concept">
7070 <primary>port</primary>
7071 <secondary>receiving TCP/IP</secondary>
7072 </indexterm>
7073 This option is relevant only when the <option>-bd</option> (start listening daemon) option
7074 is also given. It controls which ports and interfaces the daemon uses. Details
7075 of the syntax, and how it interacts with configuration file options, are given
7076 in chapter <xref linkend="CHAPinterfaces"/>. When <option>-oX</option> is used to start a daemon, no pid
7077 file is written unless <option>-oP</option> is also present to specify a pid filename.
7078 </para>
7079 </listitem></varlistentry>
7080 <varlistentry>
7081 <term><option>-oY</option></term>
7082 <listitem>
7083 <para>
7084 <indexterm role="option">
7085 <primary><option>-oY</option></primary>
7086 </indexterm>
7087 <indexterm role="concept">
7088 <primary>daemon notifier socket</primary>
7089 </indexterm>
7090 This option controls the creation of an inter-process communications endpoint
7091 by the Exim daemon.
7092 It is only relevant when the <option>-bd</option> (start listening daemon) option is also
7093 given.
7094 Normally the daemon creates this socket, unless a <option>-oX</option> and <emphasis role="bold">no</emphasis> <option>-oP</option>
7095 option is also present.
7096 If this option is given then the socket will not be created.  This could be
7097 required if the system is running multiple daemons.
7098 </para>
7099 <para>
7100 The socket is currently used for
7101 </para>
7102 <itemizedlist>
7103 <listitem>
7104 <para>
7105 fast ramp-up of queue runner processes
7106 </para>
7107 </listitem>
7108 <listitem>
7109 <para>
7110 obtaining a current queue size
7111 </para>
7112 </listitem>
7113 </itemizedlist>
7114 </listitem></varlistentry>
7115 <varlistentry>
7116 <term><option>-pd</option></term>
7117 <listitem>
7118 <para>
7119 <indexterm role="option">
7120 <primary><option>-pd</option></primary>
7121 </indexterm>
7122 <indexterm role="concept">
7123 <primary>Perl</primary>
7124 <secondary>starting the interpreter</secondary>
7125 </indexterm>
7126 This option applies when an embedded Perl interpreter is linked with Exim (see
7127 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
7128 option, forcing the starting of the interpreter to be delayed until it is
7129 needed.
7130 </para>
7131 </listitem></varlistentry>
7132 <varlistentry>
7133 <term><option>-ps</option></term>
7134 <listitem>
7135 <para>
7136 <indexterm role="option">
7137 <primary><option>-ps</option></primary>
7138 </indexterm>
7139 <indexterm role="concept">
7140 <primary>Perl</primary>
7141 <secondary>starting the interpreter</secondary>
7142 </indexterm>
7143 This option applies when an embedded Perl interpreter is linked with Exim (see
7144 chapter <xref linkend="CHAPperl"/>). It overrides the setting of the <option>perl_at_start</option>
7145 option, forcing the starting of the interpreter to occur as soon as Exim is
7146 started.
7147 </para>
7148 </listitem></varlistentry>
7149 <varlistentry>
7150 <term><option>-p</option>&lt;<emphasis>rval</emphasis>&gt;:&lt;<emphasis>sval</emphasis>&gt;</term>
7151 <listitem>
7152 <para>
7153 <indexterm role="option">
7154 <primary><option>-p</option></primary>
7155 </indexterm>
7156 For compatibility with Sendmail, this option is equivalent to
7157 </para>
7158 <literallayout>
7159 <literal>-oMr</literal> &lt;<emphasis>rval</emphasis>&gt; <literal>-oMs</literal> &lt;<emphasis>sval</emphasis>&gt;
7160 </literallayout>
7161 <para>
7162 It sets the incoming protocol and host name (for trusted callers). The
7163 host name and its colon can be omitted when only the protocol is to be set.
7164 Note the Exim already has two private options, <option>-pd</option> and <option>-ps</option>, that refer
7165 to embedded Perl. It is therefore impossible to set a protocol value of <literal>d</literal>
7166 or <literal>s</literal> using this option (but that does not seem a real limitation).
7167 Repeated use of this option is not supported.
7168 </para>
7169 </listitem></varlistentry>
7170 <varlistentry>
7171 <term><option>-q</option></term>
7172 <listitem>
7173 <para>
7174 <indexterm role="option">
7175 <primary><option>-q</option></primary>
7176 </indexterm>
7177 <indexterm role="concept">
7178 <primary>queue runner</primary>
7179 <secondary>starting manually</secondary>
7180 </indexterm>
7181 This option is normally restricted to admin users. However, there is a
7182 configuration option called <option>prod_requires_admin</option> which can be set false to
7183 relax this restriction (and also the same requirement for the <option>-M</option>, <option>-R</option>,
7184 and <option>-S</option> options).
7185 </para>
7186 <para>
7187 <indexterm role="concept">
7188 <primary>queue runner</primary>
7189 <secondary>description of operation</secondary>
7190 </indexterm>
7191 If other commandline options do not specify an action,
7192 the <option>-q</option> option starts one queue runner process. This scans the queue of
7193 waiting messages, and runs a delivery process for each one in turn. It waits
7194 for each delivery process to finish before starting the next one. A delivery
7195 process may not actually do any deliveries if the retry times for the addresses
7196 have not been reached. Use <option>-qf</option> (see below) if you want to override this.
7197 </para>
7198 <para>
7199 If
7200 <indexterm role="concept">
7201 <primary>SMTP</primary>
7202 <secondary>passed connection</secondary>
7203 </indexterm>
7204 <indexterm role="concept">
7205 <primary>SMTP</primary>
7206 <secondary>multiple deliveries</secondary>
7207 </indexterm>
7208 <indexterm role="concept">
7209 <primary>multiple SMTP deliveries</primary>
7210 </indexterm>
7211 the delivery process spawns other processes to deliver other messages down
7212 passed SMTP connections, the queue runner waits for these to finish before
7213 proceeding.
7214 </para>
7215 <para>
7216 When all the queued messages have been considered, the original queue runner
7217 process terminates. In other words, a single pass is made over the waiting
7218 mail, one message at a time. Use <option>-q</option> with a time (see below) if you want
7219 this to be repeated periodically.
7220 </para>
7221 <para>
7222 Exim processes the waiting messages in an unpredictable order. It isn&#x2019;t very
7223 random, but it is likely to be different each time, which is all that matters.
7224 If one particular message screws up a remote MTA, other messages to the same
7225 MTA have a chance of getting through if they get tried first.
7226 </para>
7227 <para>
7228 It is possible to cause the messages to be processed in lexical message id
7229 order, which is essentially the order in which they arrived, by setting the
7230 <option>queue_run_in_order</option> option, but this is not recommended for normal use.
7231 </para>
7232 </listitem></varlistentry>
7233 <varlistentry>
7234 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;</term>
7235 <listitem>
7236 <para>
7237 The <option>-q</option> option may be followed by one or more flag letters that change its
7238 behaviour. They are all optional, but if more than one is present, they must
7239 appear in the correct order. Each flag is described in a separate item below.
7240 </para>
7241 </listitem></varlistentry>
7242 <varlistentry>
7243 <term><option>-qq...</option></term>
7244 <listitem>
7245 <para>
7246 <indexterm role="option">
7247 <primary><option>-qq</option></primary>
7248 </indexterm>
7249 <indexterm role="concept">
7250 <primary>queue</primary>
7251 <secondary>double scanning</secondary>
7252 </indexterm>
7253 <indexterm role="concept">
7254 <primary>queue</primary>
7255 <secondary>routing</secondary>
7256 </indexterm>
7257 <indexterm role="concept">
7258 <primary>routing</primary>
7259 <secondary>whole queue before delivery</secondary>
7260 </indexterm>
7261 <indexterm role="concept">
7262 <primary>first pass routing</primary>
7263 </indexterm>
7264 <indexterm role="concept">
7265 <primary>queue runner</primary>
7266 <secondary>two phase</secondary>
7267 </indexterm>
7268 An option starting with <option>-qq</option> requests a two-stage queue run. In the first
7269 stage, the queue is scanned as if the <option>queue_smtp_domains</option> option matched
7270 every domain. Addresses are routed, local deliveries happen, but no remote
7271 transports are run.
7272 </para>
7273 <para>
7274 Performance will be best if the <option>queue_run_in_order</option> option is false.
7275 If that is so and the <option>queue_fast_ramp</option> option is true then
7276 in the first phase of the run,
7277 once a threshold number of messages are routed for a given host,
7278 a delivery process is forked in parallel with the rest of the scan.
7279 </para>
7280 <para>
7281 <indexterm role="concept">
7282 <primary>hints database</primary>
7283 <secondary>remembering routing</secondary>
7284 </indexterm>
7285 The hints database that remembers which messages are waiting for specific hosts
7286 is updated, as if delivery to those hosts had been deferred. After this is
7287 complete, a second, normal queue scan happens, with routing and delivery taking
7288 place as normal. Messages that are routed to the same host should mostly be
7289 delivered down a single SMTP
7290 <indexterm role="concept">
7291 <primary>SMTP</primary>
7292 <secondary>passed connection</secondary>
7293 </indexterm>
7294 <indexterm role="concept">
7295 <primary>SMTP</primary>
7296 <secondary>multiple deliveries</secondary>
7297 </indexterm>
7298 <indexterm role="concept">
7299 <primary>multiple SMTP deliveries</primary>
7300 </indexterm>
7301 connection because of the hints that were set up during the first queue scan.
7302 This option may be useful for hosts that are connected to the Internet
7303 intermittently.
7304 </para>
7305 </listitem></varlistentry>
7306 <varlistentry>
7307 <term><option>-q[q]i...</option></term>
7308 <listitem>
7309 <para>
7310 <indexterm role="option">
7311 <primary><option>-qi</option></primary>
7312 </indexterm>
7313 <indexterm role="concept">
7314 <primary>queue</primary>
7315 <secondary>initial delivery</secondary>
7316 </indexterm>
7317 If the <emphasis>i</emphasis> flag is present, the queue runner runs delivery processes only for
7318 those messages that haven&#x2019;t previously been tried. (<emphasis>i</emphasis> stands for <quote>initial
7319 delivery</quote>.) This can be helpful if you are putting messages in the queue using
7320 <option>-odq</option> and want a queue runner just to process the new messages.
7321 </para>
7322 </listitem></varlistentry>
7323 <varlistentry>
7324 <term><option>-q[q][i]f...</option></term>
7325 <listitem>
7326 <para>
7327 <indexterm role="option">
7328 <primary><option>-qf</option></primary>
7329 </indexterm>
7330 <indexterm role="concept">
7331 <primary>queue</primary>
7332 <secondary>forcing delivery</secondary>
7333 </indexterm>
7334 <indexterm role="concept">
7335 <primary>delivery</primary>
7336 <secondary>forcing in queue run</secondary>
7337 </indexterm>
7338 If one <emphasis>f</emphasis> flag is present, a delivery attempt is forced for each non-frozen
7339 message, whereas without <emphasis>f</emphasis> only those non-frozen addresses that have passed
7340 their retry times are tried.
7341 </para>
7342 </listitem></varlistentry>
7343 <varlistentry>
7344 <term><option>-q[q][i]ff...</option></term>
7345 <listitem>
7346 <para>
7347 <indexterm role="option">
7348 <primary><option>-qff</option></primary>
7349 </indexterm>
7350 <indexterm role="concept">
7351 <primary>frozen messages</primary>
7352 <secondary>forcing delivery</secondary>
7353 </indexterm>
7354 If <emphasis>ff</emphasis> is present, a delivery attempt is forced for every message, whether
7355 frozen or not.
7356 </para>
7357 </listitem></varlistentry>
7358 <varlistentry>
7359 <term><option>-q[q][i][f[f]]l</option></term>
7360 <listitem>
7361 <para>
7362 <indexterm role="option">
7363 <primary><option>-ql</option></primary>
7364 </indexterm>
7365 <indexterm role="concept">
7366 <primary>queue</primary>
7367 <secondary>local deliveries only</secondary>
7368 </indexterm>
7369 The <emphasis>l</emphasis> (the letter <quote>ell</quote>) flag specifies that only local deliveries are to
7370 be done. If a message requires any remote deliveries, it remains in the queue
7371 for later delivery.
7372 </para>
7373 </listitem></varlistentry>
7374 <varlistentry>
7375 <term><option>-q[q][i][f[f]][l][G&lt;name&gt;[/&lt;time&gt;]]]</option></term>
7376 <listitem>
7377 <para>
7378 <indexterm role="option">
7379 <primary><option>-qG</option></primary>
7380 </indexterm>
7381 <indexterm role="concept">
7382 <primary>queue</primary>
7383 <secondary>named</secondary>
7384 </indexterm>
7385 <indexterm role="concept">
7386 <primary>named queues</primary>
7387 <secondary>deliver from</secondary>
7388 </indexterm>
7389 <indexterm role="concept">
7390 <primary>queue</primary>
7391 <secondary>delivering specific messages</secondary>
7392 </indexterm>
7393 If the <emphasis>G</emphasis> flag and a name is present, the queue runner operates on the
7394 queue with the given name rather than the default queue.
7395 The name should not contain a <emphasis>/</emphasis> character.
7396 For a periodic queue run (see below)
7397 append to the name a slash and a time value.
7398 </para>
7399 <para>
7400 If other commandline options specify an action, a <emphasis>-qG&lt;name&gt;</emphasis> option
7401 will specify a queue to operate on.
7402 For example:
7403 </para>
7404 <literallayout class="monospaced">
7405 exim -bp -qGquarantine
7406 mailq -qGquarantine
7407 exim -qGoffpeak -Rf @special.domain.example
7408 </literallayout>
7409 </listitem></varlistentry>
7410 <varlistentry>
7411 <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>
7412 <listitem>
7413 <para>
7414 When scanning the queue, Exim can be made to skip over messages whose ids are
7415 lexically less than a given value by following the <option>-q</option> option with a
7416 starting message id. For example:
7417 </para>
7418 <literallayout class="monospaced">
7419 exim -q 0t5C6f-0000c8-00
7420 </literallayout>
7421 <para>
7422 Messages that arrived earlier than <literal>0t5C6f-0000c8-00</literal> are not inspected. If a
7423 second message id is given, messages whose ids are lexically greater than it
7424 are also skipped. If the same id is given twice, for example,
7425 </para>
7426 <literallayout class="monospaced">
7427 exim -q 0t5C6f-0000c8-00 0t5C6f-0000c8-00
7428 </literallayout>
7429 <para>
7430 just one delivery process is started, for that message. This differs from
7431 <option>-M</option> in that retry data is respected, and it also differs from <option>-Mc</option> in
7432 that it counts as a delivery from a queue run. Note that the selection
7433 mechanism does not affect the order in which the messages are scanned. There
7434 are also other ways of selecting specific sets of messages for delivery in a
7435 queue run &ndash; see <option>-R</option> and <option>-S</option>.
7436 </para>
7437 </listitem></varlistentry>
7438 <varlistentry>
7439 <term><option>-q</option>&lt;<emphasis>qflags</emphasis>&gt;&lt;<emphasis>time</emphasis>&gt;</term>
7440 <listitem>
7441 <para>
7442 <indexterm role="concept">
7443 <primary>queue runner</primary>
7444 <secondary>starting periodically</secondary>
7445 </indexterm>
7446 <indexterm role="concept">
7447 <primary>periodic queue running</primary>
7448 </indexterm>
7449 When a time value is present, the <option>-q</option> option causes Exim to run as a daemon,
7450 starting a queue runner process at intervals specified by the given time value
7451 (whose format is described in section <xref linkend="SECTtimeformat"/>). This form of the
7452 <option>-q</option> option is commonly combined with the <option>-bd</option> option, in which case a
7453 single daemon process handles both functions. A common way of starting up a
7454 combined daemon at system boot time is to use a command such as
7455 </para>
7456 <literallayout class="monospaced">
7457 /usr/exim/bin/exim -bd -q30m
7458 </literallayout>
7459 <para>
7460 Such a daemon listens for incoming SMTP calls, and also starts a queue runner
7461 process every 30 minutes.
7462 </para>
7463 <para>
7464 When a daemon is started by <option>-q</option> with a time value, but without <option>-bd</option>, no
7465 pid file is written unless one is explicitly requested by the <option>-oP</option> option.
7466 </para>
7467 </listitem></varlistentry>
7468 <varlistentry>
7469 <term><option>-qR</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7470 <listitem>
7471 <para>
7472 <indexterm role="option">
7473 <primary><option>-qR</option></primary>
7474 </indexterm>
7475 This option is synonymous with <option>-R</option>. It is provided for Sendmail
7476 compatibility.
7477 </para>
7478 </listitem></varlistentry>
7479 <varlistentry>
7480 <term><option>-qS</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7481 <listitem>
7482 <para>
7483 <indexterm role="option">
7484 <primary><option>-qS</option></primary>
7485 </indexterm>
7486 This option is synonymous with <option>-S</option>.
7487 </para>
7488 </listitem></varlistentry>
7489 <varlistentry>
7490 <term><option>-R</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7491 <listitem>
7492 <para>
7493 <indexterm role="option">
7494 <primary><option>-R</option></primary>
7495 </indexterm>
7496 <indexterm role="concept">
7497 <primary>queue runner</primary>
7498 <secondary>for specific recipients</secondary>
7499 </indexterm>
7500 <indexterm role="concept">
7501 <primary>delivery</primary>
7502 <secondary>to given domain</secondary>
7503 </indexterm>
7504 <indexterm role="concept">
7505 <primary>domain</primary>
7506 <secondary>delivery to</secondary>
7507 </indexterm>
7508 The &lt;<emphasis>rsflags</emphasis>&gt; may be empty, in which case the white space before the string
7509 is optional, unless the string is <emphasis>f</emphasis>, <emphasis>ff</emphasis>, <emphasis>r</emphasis>, <emphasis>rf</emphasis>, or <emphasis>rff</emphasis>,
7510 which are the possible values for &lt;<emphasis>rsflags</emphasis>&gt;. White space is required if
7511 &lt;<emphasis>rsflags</emphasis>&gt; is not empty.
7512 </para>
7513 <para>
7514 This option is similar to <option>-q</option> with no time value, that is, it causes Exim to
7515 perform a single queue run, except that, when scanning the messages on the
7516 queue, Exim processes only those that have at least one undelivered recipient
7517 address containing the given string, which is checked in a case-independent
7518 way. If the &lt;<emphasis>rsflags</emphasis>&gt; start with <emphasis>r</emphasis>, &lt;<emphasis>string</emphasis>&gt; is interpreted as a
7519 regular expression; otherwise it is a literal string.
7520 </para>
7521 <para>
7522 If you want to do periodic queue runs for messages with specific recipients,
7523 you can combine <option>-R</option> with <option>-q</option> and a time value. For example:
7524 </para>
7525 <literallayout class="monospaced">
7526 exim -q25m -R @special.domain.example
7527 </literallayout>
7528 <para>
7529 This example does a queue run for messages with recipients in the given domain
7530 every 25 minutes. Any additional flags that are specified with <option>-q</option> are
7531 applied to each queue run.
7532 </para>
7533 <para>
7534 Once a message is selected for delivery by this mechanism, all its addresses
7535 are processed. For the first selected message, Exim overrides any retry
7536 information and forces a delivery attempt for each undelivered address. This
7537 means that if delivery of any address in the first message is successful, any
7538 existing retry information is deleted, and so delivery attempts for that
7539 address in subsequently selected messages (which are processed without forcing)
7540 will run. However, if delivery of any address does not succeed, the retry
7541 information is updated, and in subsequently selected messages, the failing
7542 address will be skipped.
7543 </para>
7544 <para>
7545 <indexterm role="concept">
7546 <primary>frozen messages</primary>
7547 <secondary>forcing delivery</secondary>
7548 </indexterm>
7549 If the &lt;<emphasis>rsflags</emphasis>&gt; contain <emphasis>f</emphasis> or <emphasis>ff</emphasis>, the delivery forcing applies to
7550 all selected messages, not just the first; frozen messages are included when
7551 <emphasis>ff</emphasis> is present.
7552 </para>
7553 <para>
7554 The <option>-R</option> option makes it straightforward to initiate delivery of all messages
7555 to a given domain after a host has been down for some time. When the SMTP
7556 command ETRN is accepted by its ACL (see chapter <xref linkend="CHAPACL"/>), its default
7557 effect is to run Exim with the <option>-R</option> option, but it can be configured to run
7558 an arbitrary command instead.
7559 </para>
7560 </listitem></varlistentry>
7561 <varlistentry>
7562 <term><option>-r</option></term>
7563 <listitem>
7564 <para>
7565 <indexterm role="option">
7566 <primary><option>-r</option></primary>
7567 </indexterm>
7568 This is a documented (for Sendmail) obsolete alternative name for <option>-f</option>.
7569 </para>
7570 </listitem></varlistentry>
7571 <varlistentry>
7572 <term><option>-S</option>&lt;<emphasis>rsflags</emphasis>&gt;&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
7573 <listitem>
7574 <para>
7575 <indexterm role="option">
7576 <primary><option>-S</option></primary>
7577 </indexterm>
7578 <indexterm role="concept">
7579 <primary>delivery</primary>
7580 <secondary>from given sender</secondary>
7581 </indexterm>
7582 <indexterm role="concept">
7583 <primary>queue runner</primary>
7584 <secondary>for specific senders</secondary>
7585 </indexterm>
7586 This option acts like <option>-R</option> except that it checks the string against each
7587 message&#x2019;s sender instead of against the recipients. If <option>-R</option> is also set, both
7588 conditions must be met for a message to be selected. If either of the options
7589 has <emphasis>f</emphasis> or <emphasis>ff</emphasis> in its flags, the associated action is taken.
7590 </para>
7591 </listitem></varlistentry>
7592 <varlistentry>
7593 <term><option>-Tqt</option>&nbsp;&lt;<emphasis>times</emphasis>&gt;</term>
7594 <listitem>
7595 <para>
7596 <indexterm role="option">
7597 <primary><option>-Tqt</option></primary>
7598 </indexterm>
7599 This is an option that is exclusively for use by the Exim testing suite. It is not
7600 recognized when Exim is run normally. It allows for the setting up of explicit
7601 <quote>queue times</quote> so that various warning/retry features can be tested.
7602 </para>
7603 </listitem></varlistentry>
7604 <varlistentry>
7605 <term><option>-t</option></term>
7606 <listitem>
7607 <para>
7608 <indexterm role="option">
7609 <primary><option>-t</option></primary>
7610 </indexterm>
7611 <indexterm role="concept">
7612 <primary>recipient</primary>
7613 <secondary>extracting from header lines</secondary>
7614 </indexterm>
7615 <indexterm role="concept">
7616 <primary><emphasis>Bcc:</emphasis> header line</primary>
7617 </indexterm>
7618 <indexterm role="concept">
7619 <primary>header lines</primary>
7620 <secondary>Bcc:</secondary>
7621 </indexterm>
7622 <indexterm role="concept">
7623 <primary><emphasis>Cc:</emphasis> header line</primary>
7624 </indexterm>
7625 <indexterm role="concept">
7626 <primary>header lines</primary>
7627 <secondary>Cc:</secondary>
7628 </indexterm>
7629 <indexterm role="concept">
7630 <primary><emphasis>To:</emphasis> header line</primary>
7631 </indexterm>
7632 <indexterm role="concept">
7633 <primary>header lines</primary>
7634 <secondary>To:</secondary>
7635 </indexterm>
7636 When Exim is receiving a locally-generated, non-SMTP message on its standard
7637 input, the <option>-t</option> option causes the recipients of the message to be obtained
7638 from the <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis> header lines in the message instead of
7639 from the command arguments. The addresses are extracted before any rewriting
7640 takes place and the <emphasis>Bcc:</emphasis> header line, if present, is then removed.
7641 </para>
7642 <para>
7643 <indexterm role="concept">
7644 <primary>Sendmail compatibility</primary>
7645 <secondary><option>-t</option> option</secondary>
7646 </indexterm>
7647 If the command has any arguments, they specify addresses to which the message
7648 is <emphasis>not</emphasis> to be delivered. That is, the argument addresses are removed from
7649 the recipients list obtained from the headers. This is compatible with Smail 3
7650 and in accordance with the documented behaviour of several versions of
7651 Sendmail, as described in man pages on a number of operating systems (e.g.
7652 Solaris 8, IRIX 6.5, HP-UX 11). However, some versions of Sendmail <emphasis>add</emphasis>
7653 argument addresses to those obtained from the headers, and the O&#x2019;Reilly
7654 Sendmail book documents it that way. Exim can be made to add argument addresses
7655 instead of subtracting them by setting the option
7656 <option>extract_addresses_remove_arguments</option> false.
7657 </para>
7658 <para>
7659 <indexterm role="concept">
7660 <primary><option>Resent-</option> header lines</primary>
7661 <secondary>with <option>-t</option></secondary>
7662 </indexterm>
7663 If there are any <option>Resent-</option> header lines in the message, Exim extracts
7664 recipients from all <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>, and <emphasis>Resent-Bcc:</emphasis> header
7665 lines instead of from <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and <emphasis>Bcc:</emphasis>. This is for compatibility
7666 with Sendmail and other MTAs. (Prior to release 4.20, Exim gave an error if
7667 <option>-t</option> was used in conjunction with <option>Resent-</option> header lines.)
7668 </para>
7669 <para>
7670 RFC 2822 talks about different sets of <option>Resent-</option> header lines (for when a
7671 message is resent several times). The RFC also specifies that they should be
7672 added at the front of the message, and separated by <emphasis>Received:</emphasis> lines. It is
7673 not at all clear how <option>-t</option> should operate in the present of multiple sets,
7674 nor indeed exactly what constitutes a <quote>set</quote>.
7675 In practice, it seems that MUAs do not follow the RFC. The <option>Resent-</option> lines
7676 are often added at the end of the header, and if a message is resent more than
7677 once, it is common for the original set of <option>Resent-</option> headers to be renamed as
7678 <option>X-Resent-</option> when a new set is added. This removes any possible ambiguity.
7679 </para>
7680 </listitem></varlistentry>
7681 <varlistentry>
7682 <term><option>-ti</option></term>
7683 <listitem>
7684 <para>
7685 <indexterm role="option">
7686 <primary><option>-ti</option></primary>
7687 </indexterm>
7688 This option is exactly equivalent to <option>-t</option> <option>-i</option>. It is provided for
7689 compatibility with Sendmail.
7690 </para>
7691 </listitem></varlistentry>
7692 <varlistentry>
7693 <term><option>-tls-on-connect</option></term>
7694 <listitem>
7695 <para>
7696 <indexterm role="option">
7697 <primary><option>-tls-on-connect</option></primary>
7698 </indexterm>
7699 <indexterm role="concept">
7700 <primary>TLS</primary>
7701 <secondary>use without STARTTLS</secondary>
7702 </indexterm>
7703 <indexterm role="concept">
7704 <primary>TLS</primary>
7705 <secondary>automatic start</secondary>
7706 </indexterm>
7707 This option is available when Exim is compiled with TLS support. It forces all
7708 incoming SMTP connections to behave as if the incoming port is listed in the
7709 <option>tls_on_connect_ports</option> option. See section <xref linkend="SECTsupobssmt"/> and chapter
7710 <xref linkend="CHAPTLS"/> for further details.
7711 </para>
7712 </listitem></varlistentry>
7713 <varlistentry>
7714 <term><option>-U</option></term>
7715 <listitem>
7716 <para>
7717 <indexterm role="option">
7718 <primary><option>-U</option></primary>
7719 </indexterm>
7720 <indexterm role="concept">
7721 <primary>Sendmail compatibility</primary>
7722 <secondary><option>-U</option> option ignored</secondary>
7723 </indexterm>
7724 Sendmail uses this option for <quote>initial message submission</quote>, and its
7725 documentation states that in future releases, it may complain about
7726 syntactically invalid messages rather than fixing them when this flag is not
7727 set. Exim ignores this option.
7728 </para>
7729 </listitem></varlistentry>
7730 <varlistentry>
7731 <term><option>-v</option></term>
7732 <listitem>
7733 <para>
7734 <indexterm role="option">
7735 <primary><option>-v</option></primary>
7736 </indexterm>
7737 This option causes Exim to write information to the standard error stream,
7738 describing what it is doing. In particular, it shows the log lines for
7739 receiving and delivering a message, and if an SMTP connection is made, the SMTP
7740 dialogue is shown. Some of the log lines shown may not actually be written to
7741 the log if the setting of <option>log_selector</option> discards them. Any relevant
7742 selectors are shown with each log line. If none are shown, the logging is
7743 unconditional.
7744 </para>
7745 </listitem></varlistentry>
7746 <varlistentry>
7747 <term><option>-x</option></term>
7748 <listitem>
7749 <para>
7750 <indexterm role="option">
7751 <primary><option>-x</option></primary>
7752 </indexterm>
7753 AIX uses <option>-x</option> for a private purpose (<quote>mail from a local mail program has
7754 National Language Support extended characters in the body of the mail item</quote>).
7755 It sets <option>-x</option> when calling the MTA from its <option>mail</option> command. Exim ignores
7756 this option.
7757 </para>
7758 </listitem></varlistentry>
7759 <varlistentry>
7760 <term><option>-X</option>&nbsp;&lt;<emphasis>logfile</emphasis>&gt;</term>
7761 <listitem>
7762 <para>
7763 <indexterm role="option">
7764 <primary><option>-X</option></primary>
7765 </indexterm>
7766 This option is interpreted by Sendmail to cause debug information to be sent
7767 to the named file.  It is ignored by Exim.
7768 </para>
7769 </listitem></varlistentry>
7770 <varlistentry>
7771 <term><option>-z</option>&nbsp;&lt;<emphasis>log-line</emphasis>&gt;</term>
7772 <listitem>
7773 <para>
7774 <indexterm role="option">
7775 <primary><option>-z</option></primary>
7776 </indexterm>
7777 This option writes its argument to Exim&#x2019;s logfile.
7778 Use is restricted to administrators; the intent is for operational notes.
7779 Quotes should be used to maintain a multi-word item as a single argument,
7780 under most shells.
7781 </para>
7782 </listitem></varlistentry>
7783 </variablelist>
7784 <para>
7785 <indexterm role="concept" startref="IIDclo1" class="endofrange"/>
7786 <indexterm role="concept" startref="IIDclo2" class="endofrange"/>
7787 </para>
7788 <!-- === End of command line options === -->
7789 </section>
7790 </chapter>
7791
7792 <chapter id="CHAPconf">
7793 <title>The Exim runtime configuration file</title>
7794 <titleabbrev>The runtime configuration file</titleabbrev>
7795 <para>
7796 <indexterm role="concept">
7797 <primary>runtime configuration</primary>
7798 </indexterm>
7799 <indexterm role="concept">
7800 <primary>configuration file</primary>
7801 <secondary>general description</secondary>
7802 </indexterm>
7803 <indexterm role="concept">
7804 <primary>CONFIGURE_FILE</primary>
7805 </indexterm>
7806 <indexterm role="concept">
7807 <primary>configuration file</primary>
7808 <secondary>errors in</secondary>
7809 </indexterm>
7810 <indexterm role="concept">
7811 <primary>error</primary>
7812 <secondary>in configuration file</secondary>
7813 </indexterm>
7814 <indexterm role="concept">
7815 <primary>return code</primary>
7816 <secondary>for bad configuration</secondary>
7817 </indexterm>
7818 Exim uses a single runtime configuration file that is read whenever an Exim
7819 binary is executed. Note that in normal operation, this happens frequently,
7820 because Exim is designed to operate in a distributed manner, without central
7821 control.
7822 </para>
7823 <para>
7824 If a syntax error is detected while reading the configuration file, Exim
7825 writes a message on the standard error, and exits with a non-zero return code.
7826 The message is also written to the panic log. <emphasis role="bold">Note</emphasis>: Only simple syntax
7827 errors can be detected at this time. The values of any expanded options are
7828 not checked until the expansion happens, even when the expansion does not
7829 actually alter the string.
7830 </para>
7831 <para>
7832 The name of the configuration file is compiled into the binary for security
7833 reasons, and is specified by the CONFIGURE_FILE compilation option. In
7834 most configurations, this specifies a single file. However, it is permitted to
7835 give a colon-separated list of filenames, in which case Exim uses the first
7836 existing file in the list.
7837 </para>
7838 <para>
7839 <indexterm role="concept">
7840 <primary>EXIM_USER</primary>
7841 </indexterm>
7842 <indexterm role="concept">
7843 <primary>EXIM_GROUP</primary>
7844 </indexterm>
7845 <indexterm role="concept">
7846 <primary>CONFIGURE_OWNER</primary>
7847 </indexterm>
7848 <indexterm role="concept">
7849 <primary>CONFIGURE_GROUP</primary>
7850 </indexterm>
7851 <indexterm role="concept">
7852 <primary>configuration file</primary>
7853 <secondary>ownership</secondary>
7854 </indexterm>
7855 <indexterm role="concept">
7856 <primary>ownership</primary>
7857 <secondary>configuration file</secondary>
7858 </indexterm>
7859 The runtime configuration file must be owned by root or by the user that is
7860 specified at compile time by the CONFIGURE_OWNER option (if set). The
7861 configuration file must not be world-writeable, or group-writeable unless its
7862 group is the root group or the one specified at compile time by the
7863 CONFIGURE_GROUP option.
7864 </para>
7865 <para>
7866 <emphasis role="bold">Warning</emphasis>: In a conventional configuration, where the Exim binary is setuid
7867 to root, anybody who is able to edit the runtime configuration file has an
7868 easy way to run commands as root. If you specify a user or group in the
7869 CONFIGURE_OWNER or CONFIGURE_GROUP options, then that user and/or any users
7870 who are members of that group will trivially be able to obtain root privileges.
7871 </para>
7872 <para>
7873 Up to Exim version 4.72, the runtime configuration file was also permitted to
7874 be writeable by the Exim user and/or group. That has been changed in Exim 4.73
7875 since it offered a simple privilege escalation for any attacker who managed to
7876 compromise the Exim user account.
7877 </para>
7878 <para>
7879 A default configuration file, which will work correctly in simple situations,
7880 is provided in the file <filename>src/configure.default</filename>. If CONFIGURE_FILE
7881 defines just one filename, the installation process copies the default
7882 configuration to a new file of that name if it did not previously exist. If
7883 CONFIGURE_FILE is a list, no default is automatically installed. Chapter
7884 <xref linkend="CHAPdefconfil"/> is a <quote>walk-through</quote> discussion of the default
7885 configuration.
7886 </para>
7887 <section id="SECID40">
7888 <title>Using a different configuration file</title>
7889 <para>
7890 <indexterm role="concept">
7891 <primary>configuration file</primary>
7892 <secondary>alternate</secondary>
7893 </indexterm>
7894 A one-off alternate configuration can be specified by the <option>-C</option> command line
7895 option, which may specify a single file or a list of files. However, when
7896 <option>-C</option> is used, Exim gives up its root privilege, unless called by root (or
7897 unless the argument for <option>-C</option> is identical to the built-in value from
7898 CONFIGURE_FILE), or is listed in the TRUSTED_CONFIG_LIST file and the caller
7899 is the Exim user or the user specified in the CONFIGURE_OWNER setting. <option>-C</option>
7900 is useful mainly for checking the syntax of configuration files before
7901 installing them. No owner or group checks are done on a configuration file
7902 specified by <option>-C</option>, if root privilege has been dropped.
7903 </para>
7904 <para>
7905 Even the Exim user is not trusted to specify an arbitrary configuration file
7906 with the <option>-C</option> option to be used with root privileges, unless that file is
7907 listed in the TRUSTED_CONFIG_LIST file. This locks out the possibility of
7908 testing a configuration using <option>-C</option> right through message reception and
7909 delivery, even if the caller is root. The reception works, but by that time,
7910 Exim is running as the Exim user, so when it re-execs to regain privilege for
7911 the delivery, the use of <option>-C</option> causes privilege to be lost. However, root
7912 can test reception and delivery using two separate commands (one to put a
7913 message in the queue, using <option>-odq</option>, and another to do the delivery, using
7914 <option>-M</option>).
7915 </para>
7916 <para>
7917 If ALT_CONFIG_PREFIX is defined <filename>in Local/Makefile</filename>, it specifies a
7918 prefix string with which any file named in a <option>-C</option> command line option must
7919 start. In addition, the filename must not contain the sequence <quote><literal>/../</literal></quote>.
7920 There is no default setting for ALT_CONFIG_PREFIX; when it is unset, any
7921 filename can be used with <option>-C</option>.
7922 </para>
7923 <para>
7924 One-off changes to a configuration can be specified by the <option>-D</option> command line
7925 option, which defines and overrides values for macros used inside the
7926 configuration file. However, like <option>-C</option>, the use of this option by a
7927 non-privileged user causes Exim to discard its root privilege.
7928 If DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the use of <option>-D</option> is
7929 completely disabled, and its use causes an immediate error exit.
7930 </para>
7931 <para>
7932 The WHITELIST_D_MACROS option in <filename>Local/Makefile</filename> permits the binary builder
7933 to declare certain macro names trusted, such that root privilege will not
7934 necessarily be discarded.
7935 WHITELIST_D_MACROS defines a colon-separated list of macros which are
7936 considered safe and, if <option>-D</option> only supplies macros from this list, and the
7937 values are acceptable, then Exim will not give up root privilege if the caller
7938 is root, the Exim run-time user, or the CONFIGURE_OWNER, if set.  This is a
7939 transition mechanism and is expected to be removed in the future.  Acceptable
7940 values for the macros satisfy the regexp: <literal>^[A-Za-z0-9_/.-]*$</literal>
7941 </para>
7942 <para>
7943 Some sites may wish to use the same Exim binary on different machines that
7944 share a file system, but to use different configuration files on each machine.
7945 If CONFIGURE_FILE_USE_NODE is defined in <filename>Local/Makefile</filename>, Exim first
7946 looks for a file whose name is the configuration filename followed by a dot
7947 and the machine&#x2019;s node name, as obtained from the <function>uname()</function> function. If this
7948 file does not exist, the standard name is tried. This processing occurs for
7949 each filename in the list given by CONFIGURE_FILE or <option>-C</option>.
7950 </para>
7951 <para>
7952 In some esoteric situations different versions of Exim may be run under
7953 different effective uids and the CONFIGURE_FILE_USE_EUID is defined to
7954 help with this. See the comments in <filename>src/EDITME</filename> for details.
7955 </para>
7956 </section>
7957 <section id="SECTconffilfor">
7958 <title>Configuration file format</title>
7959 <para>
7960 <indexterm role="concept">
7961 <primary>configuration file</primary>
7962 <secondary>format of</secondary>
7963 </indexterm>
7964 <indexterm role="concept">
7965 <primary>format</primary>
7966 <secondary>configuration file</secondary>
7967 </indexterm>
7968 Exim&#x2019;s configuration file is divided into a number of different parts. General
7969 option settings must always appear at the start of the file. The other parts
7970 are all optional, and may appear in any order. Each part other than the first
7971 is introduced by the word <quote>begin</quote> followed by at least one literal
7972 space, and the name of the part. The optional parts are:
7973 </para>
7974 <itemizedlist>
7975 <listitem>
7976 <para>
7977 <emphasis>ACL</emphasis>: Access control lists for controlling incoming SMTP mail (see chapter
7978 <xref linkend="CHAPACL"/>).
7979 </para>
7980 </listitem>
7981 <listitem>
7982 <para>
7983 <indexterm role="concept">
7984 <primary>AUTH</primary>
7985 <secondary>configuration</secondary>
7986 </indexterm>
7987 <emphasis>authenticators</emphasis>: Configuration settings for the authenticator drivers. These
7988 are concerned with the SMTP AUTH command (see chapter <xref linkend="CHAPSMTPAUTH"/>).
7989 </para>
7990 </listitem>
7991 <listitem>
7992 <para>
7993 <emphasis>routers</emphasis>: Configuration settings for the router drivers. Routers process
7994 addresses and determine how the message is to be delivered (see chapters
7995 <xref linkend="CHAProutergeneric"/>&ndash;<xref linkend="CHAPredirect"/>).
7996 </para>
7997 </listitem>
7998 <listitem>
7999 <para>
8000 <emphasis>transports</emphasis>: Configuration settings for the transport drivers. Transports
8001 define mechanisms for copying messages to destinations (see chapters
8002 <xref linkend="CHAPtransportgeneric"/>&ndash;<xref linkend="CHAPsmtptrans"/>).
8003 </para>
8004 </listitem>
8005 <listitem>
8006 <para>
8007 <emphasis>retry</emphasis>: Retry rules, for use when a message cannot be delivered immediately.
8008 If there is no retry section, or if it is empty (that is, no retry rules are
8009 defined), Exim will not retry deliveries. In this situation, temporary errors
8010 are treated the same as permanent errors. Retry rules are discussed in chapter
8011 <xref linkend="CHAPretry"/>.
8012 </para>
8013 </listitem>
8014 <listitem>
8015 <para>
8016 <emphasis>rewrite</emphasis>: Global address rewriting rules, for use when a message arrives and
8017 when new addresses are generated during delivery. Rewriting is discussed in
8018 chapter <xref linkend="CHAPrewrite"/>.
8019 </para>
8020 </listitem>
8021 <listitem>
8022 <para>
8023 <emphasis>local_scan</emphasis>: Private options for the <function>local_scan()</function> function. If you
8024 want to use this feature, you must set
8025 </para>
8026 <literallayout class="monospaced">
8027 LOCAL_SCAN_HAS_OPTIONS=yes
8028 </literallayout>
8029 <para>
8030 in <filename>Local/Makefile</filename> before building Exim. Details of the <function>local_scan()</function>
8031 facility are given in chapter <xref linkend="CHAPlocalscan"/>.
8032 </para>
8033 </listitem>
8034 </itemizedlist>
8035 <para>
8036 <indexterm role="concept">
8037 <primary>configuration file</primary>
8038 <secondary>leading white space in</secondary>
8039 </indexterm>
8040 <indexterm role="concept">
8041 <primary>configuration file</primary>
8042 <secondary>trailing white space in</secondary>
8043 </indexterm>
8044 <indexterm role="concept">
8045 <primary>white space</primary>
8046 <secondary>in configuration file</secondary>
8047 </indexterm>
8048 Leading and trailing white space in configuration lines is always ignored.
8049 </para>
8050 <para>
8051 Blank lines in the file, and lines starting with a # character (ignoring
8052 leading white space) are treated as comments and are ignored. <emphasis role="bold">Note</emphasis>: A
8053 # character other than at the beginning of a line is not treated specially,
8054 and does not introduce a comment.
8055 </para>
8056 <para>
8057 Any non-comment line can be continued by ending it with a backslash. Note that
8058 the general rule for white space means that trailing white space after the
8059 backslash and leading white space at the start of continuation
8060 lines is ignored. Comment lines beginning with # (but not empty lines) may
8061 appear in the middle of a sequence of continuation lines.
8062 </para>
8063 <para>
8064 A convenient way to create a configuration file is to start from the
8065 default, which is supplied in <filename>src/configure.default</filename>, and add, delete, or
8066 change settings as required.
8067 </para>
8068 <para>
8069 The ACLs, retry rules, and rewriting rules have their own syntax which is
8070 described in chapters <xref linkend="CHAPACL"/>, <xref linkend="CHAPretry"/>, and <xref linkend="CHAPrewrite"/>,
8071 respectively. The other parts of the configuration file have some syntactic
8072 items in common, and these are described below, from section <xref linkend="SECTcos"/>
8073 onwards. Before that, the inclusion, macro, and conditional facilities are
8074 described.
8075 </para>
8076 </section>
8077 <section id="SECID41">
8078 <title>File inclusions in the configuration file</title>
8079 <para>
8080 <indexterm role="concept">
8081 <primary>inclusions in configuration file</primary>
8082 </indexterm>
8083 <indexterm role="concept">
8084 <primary>configuration file</primary>
8085 <secondary>including other files</secondary>
8086 </indexterm>
8087 <indexterm role="concept">
8088 <primary><literal>.include</literal> in configuration file</primary>
8089 </indexterm>
8090 <indexterm role="concept">
8091 <primary><literal>.include_if_exists</literal> in configuration file</primary>
8092 </indexterm>
8093 You can include other files inside Exim&#x2019;s runtime configuration file by
8094 using this syntax:
8095 </para>
8096 <literallayout>
8097 <literal>.include</literal> &lt;<emphasis>filename</emphasis>&gt;
8098 <literal>.include_if_exists</literal> &lt;<emphasis>filename</emphasis>&gt;
8099 </literallayout>
8100 <para>
8101 on a line by itself. Double quotes round the filename are optional. If you use
8102 the first form, a configuration error occurs if the file does not exist; the
8103 second form does nothing for non-existent files.
8104 The first form allows a relative name. It is resolved relative to
8105 the directory of the including file. For the second form an absolute filename
8106 is required.
8107 </para>
8108 <para>
8109 Includes may be nested to any depth, but remember that Exim reads its
8110 configuration file often, so it is a good idea to keep them to a minimum.
8111 If you change the contents of an included file, you must HUP the daemon,
8112 because an included file is read only when the configuration itself is read.
8113 </para>
8114 <para>
8115 The processing of inclusions happens early, at a physical line level, so, like
8116 comment lines, an inclusion can be used in the middle of an option setting,
8117 for example:
8118 </para>
8119 <literallayout class="monospaced">
8120 hosts_lookup = a.b.c \
8121                .include /some/file
8122 </literallayout>
8123 <para>
8124 Include processing happens after macro processing (see below). Its effect is to
8125 process the lines of the included file as if they occurred inline where the
8126 inclusion appears.
8127 </para>
8128 </section>
8129 <section id="SECTmacrodefs">
8130 <title>Macros in the configuration file</title>
8131 <para>
8132 <indexterm role="concept">
8133 <primary>macro</primary>
8134 <secondary>description of</secondary>
8135 </indexterm>
8136 <indexterm role="concept">
8137 <primary>configuration file</primary>
8138 <secondary>macros</secondary>
8139 </indexterm>
8140 If a line in the main part of the configuration (that is, before the first
8141 <quote>begin</quote> line) begins with an upper case letter, it is taken as a macro
8142 definition, and must be of the form
8143 </para>
8144 <literallayout>
8145 &lt;<emphasis>name</emphasis>&gt; = &lt;<emphasis>rest of line</emphasis>&gt;
8146 </literallayout>
8147 <para>
8148 The name must consist of letters, digits, and underscores, and need not all be
8149 in upper case, though that is recommended. The rest of the line, including any
8150 continuations, is the replacement text, and has leading and trailing white
8151 space removed. Quotes are not removed. The replacement text can never end with
8152 a backslash character, but this doesn&#x2019;t seem to be a serious limitation.
8153 </para>
8154 <para>
8155 Macros may also be defined between router, transport, authenticator, or ACL
8156 definitions. They may not, however, be defined within an individual driver or
8157 ACL, or in the <option>local_scan</option>, retry, or rewrite sections of the configuration.
8158 </para>
8159 </section>
8160 <section id="SECID42">
8161 <title>Macro substitution</title>
8162 <para>
8163 Once a macro is defined, all subsequent lines in the file (and any included
8164 files) are scanned for the macro name; if there are several macros, the line is
8165 scanned for each, in turn, in the order in which the macros are defined. The
8166 replacement text is not re-scanned for the current macro, though it is scanned
8167 for subsequently defined macros. For this reason, a macro name may not contain
8168 the name of a previously defined macro as a substring. You could, for example,
8169 define
8170 </para>
8171 <literallayout>
8172 <literal>ABCD_XYZ = </literal>&lt;<emphasis>something</emphasis>&gt;
8173 <literal>ABCD = </literal>&lt;<emphasis>something else</emphasis>&gt;
8174 </literallayout>
8175 <para>
8176 but putting the definitions in the opposite order would provoke a configuration
8177 error. Macro expansion is applied to individual physical lines from the file,
8178 before checking for line continuation or file inclusion (see above). If a line
8179 consists solely of a macro name, and the expansion of the macro is empty, the
8180 line is ignored. A macro at the start of a line may turn the line into a
8181 comment line or a <literal>.include</literal> line.
8182 </para>
8183 </section>
8184 <section id="SECID43">
8185 <title>Redefining macros</title>
8186 <para>
8187 Once defined, the value of a macro can be redefined later in the configuration
8188 (or in an included file). Redefinition is specified by using <emphasis>==</emphasis> instead of
8189 <emphasis>=</emphasis>. For example:
8190 </para>
8191 <literallayout class="monospaced">
8192 MAC =  initial value
8193 ...
8194 MAC == updated value
8195 </literallayout>
8196 <para>
8197 Redefinition does not alter the order in which the macros are applied to the
8198 subsequent lines of the configuration file. It is still the same order in which
8199 the macros were originally defined. All that changes is the macro&#x2019;s value.
8200 Redefinition makes it possible to accumulate values. For example:
8201 </para>
8202 <literallayout class="monospaced">
8203 MAC =  initial value
8204 ...
8205 MAC == MAC and something added
8206 </literallayout>
8207 <para>
8208 This can be helpful in situations where the configuration file is built
8209 from a number of other files.
8210 </para>
8211 </section>
8212 <section id="SECID44">
8213 <title>Overriding macro values</title>
8214 <para>
8215 The values set for macros in the configuration file can be overridden by the
8216 <option>-D</option> command line option, but Exim gives up its root privilege when <option>-D</option> is
8217 used, unless called by root or the Exim user. A definition on the command line
8218 using the <option>-D</option> option causes all definitions and redefinitions within the
8219 file to be ignored.
8220 </para>
8221 </section>
8222 <section id="SECID45">
8223 <title>Example of macro usage</title>
8224 <para>
8225 As an example of macro usage, consider a configuration where aliases are looked
8226 up in a MySQL database. It helps to keep the file less cluttered if long
8227 strings such as SQL statements are defined separately as macros, for example:
8228 </para>
8229 <literallayout class="monospaced">
8230 ALIAS_QUERY = select mailbox from user where \
8231               login='${quote_mysql:$local_part}';
8232 </literallayout>
8233 <para>
8234 This can then be used in a <command>redirect</command> router setting like this:
8235 </para>
8236 <literallayout class="monospaced">
8237 data = ${lookup mysql{ALIAS_QUERY}}
8238 </literallayout>
8239 <para>
8240 In earlier versions of Exim macros were sometimes used for domain, host, or
8241 address lists. In Exim 4 these are handled better by named lists &ndash; see
8242 section <xref linkend="SECTnamedlists"/>.
8243 </para>
8244 </section>
8245 <section id="SECTbuiltinmacros">
8246 <title>Builtin macros</title>
8247 <para>
8248 Exim defines some macros depending on facilities available, which may
8249 differ due to build-time definitions and from one release to another.
8250 All of these macros start with an underscore.
8251 They can be used to conditionally include parts of a configuration
8252 (see below).
8253 </para>
8254 <para>
8255 The following classes of macros are defined:
8256 </para>
8257 <literallayout>
8258 <literal> _HAVE_*                    </literal>  build-time defines
8259 <literal> _DRIVER_ROUTER_*           </literal>  router drivers
8260 <literal> _DRIVER_TRANSPORT_*        </literal>  transport drivers
8261 <literal> _DRIVER_AUTHENTICATOR_*    </literal>  authenticator drivers
8262 <literal> _LOG_*                     </literal>  log_selector values
8263 <literal> _OPT_MAIN_*                </literal>  main config options
8264 <literal> _OPT_ROUTERS_*             </literal>  generic router options
8265 <literal> _OPT_TRANSPORTS_*          </literal>  generic transport options
8266 <literal> _OPT_AUTHENTICATORS_*      </literal>  generic authenticator options
8267 <literal> _OPT_ROUTER_*_*            </literal>  private router options
8268 <literal> _OPT_TRANSPORT_*_*         </literal>  private transport options
8269 <literal> _OPT_AUTHENTICATOR_*_*     </literal>  private authenticator options
8270 </literallayout>
8271 <para>
8272 Use an <quote>exim -bP macros</quote> command to get the list of macros.
8273 </para>
8274 </section>
8275 <section id="SECID46">
8276 <title>Conditional skips in the configuration file</title>
8277 <para>
8278 <indexterm role="concept">
8279 <primary>configuration file</primary>
8280 <secondary>conditional skips</secondary>
8281 </indexterm>
8282 <indexterm role="concept">
8283 <primary><literal>.ifdef</literal></primary>
8284 </indexterm>
8285 You can use the directives <literal>.ifdef</literal>, <literal>.ifndef</literal>, <literal>.elifdef</literal>,
8286 <literal>.elifndef</literal>, <literal>.else</literal>, and <literal>.endif</literal> to dynamically include or exclude
8287 portions of the configuration file. The processing happens whenever the file is
8288 read (that is, when an Exim binary starts to run).
8289 </para>
8290 <para>
8291 The implementation is very simple. Instances of the first four directives must
8292 be followed by text that includes the names of one or macros. The condition
8293 that is tested is whether or not any macro substitution has taken place in the
8294 line. Thus:
8295 </para>
8296 <literallayout class="monospaced">
8297 .ifdef AAA
8298 message_size_limit = 50M
8299 .else
8300 message_size_limit = 100M
8301 .endif
8302 </literallayout>
8303 <para>
8304 sets a message size limit of 50M if the macro <literal>AAA</literal> is defined
8305 (or <literal>A</literal> or <literal>AA</literal>), and 100M
8306 otherwise. If there is more than one macro named on the line, the condition
8307 is true if any of them are defined. That is, it is an <quote>or</quote> condition. To
8308 obtain an <quote>and</quote> condition, you need to use nested <literal>.ifdef</literal>s.
8309 </para>
8310 <para>
8311 Although you can use a macro expansion to generate one of these directives,
8312 it is not very useful, because the condition <quote>there was a macro substitution
8313 in this line</quote> will always be true.
8314 </para>
8315 <para>
8316 Text following <literal>.else</literal> and <literal>.endif</literal> is ignored, and can be used as comment
8317 to clarify complicated nestings.
8318 </para>
8319 </section>
8320 <section id="SECTcos">
8321 <title>Common option syntax</title>
8322 <para>
8323 <indexterm role="concept">
8324 <primary>common option syntax</primary>
8325 </indexterm>
8326 <indexterm role="concept">
8327 <primary>syntax of common options</primary>
8328 </indexterm>
8329 <indexterm role="concept">
8330 <primary>configuration file</primary>
8331 <secondary>common option syntax</secondary>
8332 </indexterm>
8333 For the main set of options, driver options, and <function>local_scan()</function> options,
8334 each setting is on a line by itself, and starts with a name consisting of
8335 lower-case letters and underscores. Many options require a data value, and in
8336 these cases the name must be followed by an equals sign (with optional white
8337 space) and then the value. For example:
8338 </para>
8339 <literallayout class="monospaced">
8340 qualify_domain = mydomain.example.com
8341 </literallayout>
8342 <para>
8343 <indexterm role="concept">
8344 <primary>hiding configuration option values</primary>
8345 </indexterm>
8346 <indexterm role="concept">
8347 <primary>configuration options</primary>
8348 <secondary>hiding value of</secondary>
8349 </indexterm>
8350 <indexterm role="concept">
8351 <primary>options</primary>
8352 <secondary>hiding value of</secondary>
8353 </indexterm>
8354 Some option settings may contain sensitive data, for example, passwords for
8355 accessing databases. To stop non-admin users from using the <option>-bP</option> command
8356 line option to read these values, you can precede the option settings with the
8357 word <quote>hide</quote>. For example:
8358 </para>
8359 <literallayout class="monospaced">
8360 hide mysql_servers = localhost/users/admin/secret-password
8361 </literallayout>
8362 <para>
8363 For non-admin users, such options are displayed like this:
8364 </para>
8365 <literallayout class="monospaced">
8366 mysql_servers = &lt;value not displayable&gt;
8367 </literallayout>
8368 <para>
8369 If <quote>hide</quote> is used on a driver option, it hides the value of that option on
8370 all instances of the same driver.
8371 </para>
8372 <para>
8373 The following sections describe the syntax used for the different data types
8374 that are found in option settings.
8375 </para>
8376 </section>
8377 <section id="SECID47">
8378 <title>Boolean options</title>
8379 <para>
8380 <indexterm role="concept">
8381 <primary>format</primary>
8382 <secondary>boolean</secondary>
8383 </indexterm>
8384 <indexterm role="concept">
8385 <primary>boolean configuration values</primary>
8386 </indexterm>
8387 <indexterm role="option">
8388 <primary><option>no_</option><emphasis>xxx</emphasis></primary>
8389 </indexterm>
8390 <indexterm role="option">
8391 <primary><option>not_</option><emphasis>xxx</emphasis></primary>
8392 </indexterm>
8393 Options whose type is given as boolean are on/off switches. There are two
8394 different ways of specifying such options: with and without a data value. If
8395 the option name is specified on its own without data, the switch is turned on;
8396 if it is preceded by <quote>no_</quote> or <quote>not_</quote> the switch is turned off. However,
8397 boolean options may be followed by an equals sign and one of the words
8398 <quote>true</quote>, <quote>false</quote>, <quote>yes</quote>, or <quote>no</quote>, as an alternative syntax. For example,
8399 the following two settings have exactly the same effect:
8400 </para>
8401 <literallayout class="monospaced">
8402 queue_only
8403 queue_only = true
8404 </literallayout>
8405 <para>
8406 The following two lines also have the same (opposite) effect:
8407 </para>
8408 <literallayout class="monospaced">
8409 no_queue_only
8410 queue_only = false
8411 </literallayout>
8412 <para>
8413 You can use whichever syntax you prefer.
8414 </para>
8415 </section>
8416 <section id="SECID48">
8417 <title>Integer values</title>
8418 <para>
8419 <indexterm role="concept">
8420 <primary>integer configuration values</primary>
8421 </indexterm>
8422 <indexterm role="concept">
8423 <primary>format</primary>
8424 <secondary>integer</secondary>
8425 </indexterm>
8426 If an option&#x2019;s type is given as <quote>integer</quote>, the value can be given in decimal,
8427 hexadecimal, or octal. If it starts with a digit greater than zero, a decimal
8428 number is assumed. Otherwise, it is treated as an octal number unless it starts
8429 with the characters <quote>0x</quote>, in which case the remainder is interpreted as a
8430 hexadecimal number.
8431 </para>
8432 <para>
8433 If an integer value is followed by the letter K, it is multiplied by 1024; if
8434 it is followed by the letter M, it is multiplied by 1024x1024;
8435 if by the letter G, 1024x1024x1024.
8436 When the values
8437 of integer option settings are output, values which are an exact multiple of
8438 1024 or 1024x1024 are sometimes, but not always, printed using the letters K
8439 and M. The printing style is independent of the actual input format that was
8440 used.
8441 </para>
8442 </section>
8443 <section id="SECID49">
8444 <title>Octal integer values</title>
8445 <para>
8446 <indexterm role="concept">
8447 <primary>integer format</primary>
8448 </indexterm>
8449 <indexterm role="concept">
8450 <primary>format</primary>
8451 <secondary>octal integer</secondary>
8452 </indexterm>
8453 If an option&#x2019;s type is given as <quote>octal integer</quote>, its value is always
8454 interpreted as an octal number, whether or not it starts with the digit zero.
8455 Such options are always output in octal.
8456 </para>
8457 </section>
8458 <section id="SECID50">
8459 <title>Fixed point numbers</title>
8460 <para>
8461 <indexterm role="concept">
8462 <primary>fixed point configuration values</primary>
8463 </indexterm>
8464 <indexterm role="concept">
8465 <primary>format</primary>
8466 <secondary>fixed point</secondary>
8467 </indexterm>
8468 If an option&#x2019;s type is given as <quote>fixed-point</quote>, its value must be a decimal
8469 integer, optionally followed by a decimal point and up to three further digits.
8470 </para>
8471 </section>
8472 <section id="SECTtimeformat">
8473 <title>Time intervals</title>
8474 <para>
8475 <indexterm role="concept">
8476 <primary>time interval</primary>
8477 <secondary>specifying in configuration</secondary>
8478 </indexterm>
8479 <indexterm role="concept">
8480 <primary>format</primary>
8481 <secondary>time interval</secondary>
8482 </indexterm>
8483 A time interval is specified as a sequence of numbers, each followed by one of
8484 the following letters, with no intervening white space:
8485 </para>
8486 <informaltable frame="none">
8487 <tgroup cols="2" colsep="0" rowsep="0">
8488 <colspec colwidth="30pt" align="left"/>
8489 <colspec colwidth="254pt" align="left"/>
8490 <tbody>
8491 <row>
8492 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>s</option></entry>
8493 <entry>seconds</entry>
8494 </row>
8495 <row>
8496 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>m</option></entry>
8497 <entry>minutes</entry>
8498 </row>
8499 <row>
8500 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>h</option></entry>
8501 <entry>hours</entry>
8502 </row>
8503 <row>
8504 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>d</option></entry>
8505 <entry>days</entry>
8506 </row>
8507 <row>
8508 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>w</option></entry>
8509 <entry>weeks</entry>
8510 </row>
8511 </tbody>
8512 </tgroup>
8513 </informaltable>
8514 <para>
8515 For example, <quote>3h50m</quote> specifies 3 hours and 50 minutes. The values of time
8516 intervals are output in the same format. Exim does not restrict the values; it
8517 is perfectly acceptable, for example, to specify <quote>90m</quote> instead of <quote>1h30m</quote>.
8518 </para>
8519 </section>
8520 <section id="SECTstrings">
8521 <title>String values</title>
8522 <para>
8523 <indexterm role="concept">
8524 <primary>string</primary>
8525 <secondary>format of configuration values</secondary>
8526 </indexterm>
8527 <indexterm role="concept">
8528 <primary>format</primary>
8529 <secondary>string</secondary>
8530 </indexterm>
8531 If an option&#x2019;s type is specified as <quote>string</quote>, the value can be specified with
8532 or without double-quotes. If it does not start with a double-quote, the value
8533 consists of the remainder of the line plus any continuation lines, starting at
8534 the first character after any leading white space, with trailing white space
8535 removed, and with no interpretation of the characters in the string. Because
8536 Exim removes comment lines (those beginning with #) at an early stage, they can
8537 appear in the middle of a multi-line string. The following two settings are
8538 therefore equivalent:
8539 </para>
8540 <literallayout class="monospaced">
8541 trusted_users = uucp:mail
8542 trusted_users = uucp:\
8543                 # This comment line is ignored
8544                 mail
8545 </literallayout>
8546 <para>
8547 <indexterm role="concept">
8548 <primary>string</primary>
8549 <secondary>quoted</secondary>
8550 </indexterm>
8551 <indexterm role="concept">
8552 <primary>escape characters in quoted strings</primary>
8553 </indexterm>
8554 If a string does start with a double-quote, it must end with a closing
8555 double-quote, and any backslash characters other than those used for line
8556 continuation are interpreted as escape characters, as follows:
8557 </para>
8558 <informaltable frame="none">
8559 <tgroup cols="2" colsep="0" rowsep="0">
8560 <colspec colwidth="100pt" align="left"/>
8561 <colspec colwidth="254pt" align="left"/>
8562 <tbody>
8563 <row>
8564 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\\</literal></entry>
8565 <entry>single backslash</entry>
8566 </row>
8567 <row>
8568 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\n</literal></entry>
8569 <entry>newline</entry>
8570 </row>
8571 <row>
8572 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\r</literal></entry>
8573 <entry>carriage return</entry>
8574 </row>
8575 <row>
8576 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\t</literal></entry>
8577 <entry>tab</entry>
8578 </row>
8579 <row>
8580 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\</literal>&lt;<emphasis>octal digits</emphasis>&gt;</entry>
8581 <entry>up to 3 octal digits specify one character</entry>
8582 </row>
8583 <row>
8584 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>\x</literal>&lt;<emphasis>hex digits</emphasis>&gt;</entry>
8585 <entry>up to 2 hexadecimal digits specify one character</entry>
8586 </row>
8587 </tbody>
8588 </tgroup>
8589 </informaltable>
8590 <para>
8591 If a backslash is followed by some other character, including a double-quote
8592 character, that character replaces the pair.
8593 </para>
8594 <para>
8595 Quoting is necessary only if you want to make use of the backslash escapes to
8596 insert special characters, or if you need to specify a value with leading or
8597 trailing spaces. These cases are rare, so quoting is almost never needed in
8598 current versions of Exim. In versions of Exim before 3.14, quoting was required
8599 in order to continue lines, so you may come across older configuration files
8600 and examples that apparently quote unnecessarily.
8601 </para>
8602 </section>
8603 <section id="SECID51">
8604 <title>Expanded strings</title>
8605 <para>
8606 <indexterm role="concept">
8607 <primary>expansion</primary>
8608 <secondary>definition of</secondary>
8609 </indexterm>
8610 Some strings in the configuration file are subjected to <emphasis>string expansion</emphasis>,
8611 by which means various parts of the string may be changed according to the
8612 circumstances (see chapter <xref linkend="CHAPexpand"/>). The input syntax for such strings
8613 is as just described; in particular, the handling of backslashes in quoted
8614 strings is done as part of the input process, before expansion takes place.
8615 However, backslash is also an escape character for the expander, so any
8616 backslashes that are required for that reason must be doubled if they are
8617 within a quoted configuration string.
8618 </para>
8619 </section>
8620 <section id="SECID52">
8621 <title>User and group names</title>
8622 <para>
8623 <indexterm role="concept">
8624 <primary>user name</primary>
8625 <secondary>format of</secondary>
8626 </indexterm>
8627 <indexterm role="concept">
8628 <primary>format</primary>
8629 <secondary>user name</secondary>
8630 </indexterm>
8631 <indexterm role="concept">
8632 <primary>groups</primary>
8633 <secondary>name format</secondary>
8634 </indexterm>
8635 <indexterm role="concept">
8636 <primary>format</primary>
8637 <secondary>group name</secondary>
8638 </indexterm>
8639 User and group names are specified as strings, using the syntax described
8640 above, but the strings are interpreted specially. A user or group name must
8641 either consist entirely of digits, or be a name that can be looked up using the
8642 <function>getpwnam()</function> or <function>getgrnam()</function> function, as appropriate.
8643 </para>
8644 </section>
8645 <section id="SECTlistconstruct">
8646 <title>List construction</title>
8647 <para>
8648 <indexterm role="concept">
8649 <primary>list</primary>
8650 <secondary>syntax of in configuration</secondary>
8651 </indexterm>
8652 <indexterm role="concept">
8653 <primary>format</primary>
8654 <secondary>list item in configuration</secondary>
8655 </indexterm>
8656 <indexterm role="concept">
8657 <primary>string</primary>
8658 <secondary>list, definition of</secondary>
8659 </indexterm>
8660 The data for some configuration options is a list of items, with colon as the
8661 default separator. Many of these options are shown with type <quote>string list</quote> in
8662 the descriptions later in this document. Others are listed as <quote>domain list</quote>,
8663 <quote>host list</quote>, <quote>address list</quote>, or <quote>local part list</quote>. Syntactically, they
8664 are all the same; however, those other than <quote>string list</quote> are subject to
8665 particular kinds of interpretation, as described in chapter
8666 <xref linkend="CHAPdomhosaddlists"/>.
8667 </para>
8668 <para>
8669 In all these cases, the entire list is treated as a single string as far as the
8670 input syntax is concerned. The <option>trusted_users</option> setting in section
8671 <xref linkend="SECTstrings"/> above is an example. If a colon is actually needed in an item
8672 in a list, it must be entered as two colons. Leading and trailing white space
8673 on each item in a list is ignored. This makes it possible to include items that
8674 start with a colon, and in particular, certain forms of IPv6 address. For
8675 example, the list
8676 </para>
8677 <literallayout class="monospaced">
8678 local_interfaces = 127.0.0.1 : ::::1
8679 </literallayout>
8680 <para>
8681 contains two IP addresses, the IPv4 address 127.0.0.1 and the IPv6 address ::1.
8682 </para>
8683 <para>
8684 <emphasis role="bold">Note</emphasis>: Although leading and trailing white space is ignored in individual
8685 list items, it is not ignored when parsing the list. The spaces around the first
8686 colon in the example above are necessary. If they were not there, the list would
8687 be interpreted as the two items 127.0.0.1:: and 1.
8688 </para>
8689 </section>
8690 <section id="SECTlistsepchange">
8691 <title>Changing list separators</title>
8692 <para>
8693 <indexterm role="concept">
8694 <primary>list separator</primary>
8695 <secondary>changing</secondary>
8696 </indexterm>
8697 <indexterm role="concept">
8698 <primary>IPv6</primary>
8699 <secondary>addresses in lists</secondary>
8700 </indexterm>
8701 Doubling colons in IPv6 addresses is an unwelcome chore, so a mechanism was
8702 introduced to allow the separator character to be changed. If a list begins
8703 with a left angle bracket, followed by any punctuation character, that
8704 character is used instead of colon as the list separator. For example, the list
8705 above can be rewritten to use a semicolon separator like this:
8706 </para>
8707 <literallayout class="monospaced">
8708 local_interfaces = &lt;; 127.0.0.1 ; ::1
8709 </literallayout>
8710 <para>
8711 This facility applies to all lists, with the exception of the list in
8712 <option>log_file_path</option>. It is recommended that the use of non-colon separators be
8713 confined to circumstances where they really are needed.
8714 </para>
8715 <para>
8716 <indexterm role="concept">
8717 <primary>list separator</primary>
8718 <secondary>newline as</secondary>
8719 </indexterm>
8720 <indexterm role="concept">
8721 <primary>newline</primary>
8722 <secondary>as list separator</secondary>
8723 </indexterm>
8724 It is also possible to use newline and other control characters (those with
8725 code values less than 32, plus DEL) as separators in lists. Such separators
8726 must be provided literally at the time the list is processed. For options that
8727 are string-expanded, you can write the separator using a normal escape
8728 sequence. This will be processed by the expander before the string is
8729 interpreted as a list. For example, if a newline-separated list of domains is
8730 generated by a lookup, you can process it directly by a line such as this:
8731 </para>
8732 <literallayout class="monospaced">
8733 domains = &lt;\n ${lookup mysql{.....}}
8734 </literallayout>
8735 <para>
8736 This avoids having to change the list separator in such data. You are unlikely
8737 to want to use a control character as a separator in an option that is not
8738 expanded, because the value is literal text. However, it can be done by giving
8739 the value in quotes. For example:
8740 </para>
8741 <literallayout class="monospaced">
8742 local_interfaces = "&lt;\n 127.0.0.1 \n ::1"
8743 </literallayout>
8744 <para>
8745 Unlike printing character separators, which can be included in list items by
8746 doubling, it is not possible to include a control character as data when it is
8747 set as the separator. Two such characters in succession are interpreted as
8748 enclosing an empty list item.
8749 </para>
8750 </section>
8751 <section id="SECTempitelis">
8752 <title>Empty items in lists</title>
8753 <para>
8754 <indexterm role="concept">
8755 <primary>list</primary>
8756 <secondary>empty item in</secondary>
8757 </indexterm>
8758 An empty item at the end of a list is always ignored. In other words, trailing
8759 separator characters are ignored. Thus, the list in
8760 </para>
8761 <literallayout class="monospaced">
8762 senders = user@domain :
8763 </literallayout>
8764 <para>
8765 contains only a single item. If you want to include an empty string as one item
8766 in a list, it must not be the last item. For example, this list contains three
8767 items, the second of which is empty:
8768 </para>
8769 <literallayout class="monospaced">
8770 senders = user1@domain : : user2@domain
8771 </literallayout>
8772 <para>
8773 <emphasis role="bold">Note</emphasis>: There must be white space between the two colons, as otherwise they
8774 are interpreted as representing a single colon data character (and the list
8775 would then contain just one item). If you want to specify a list that contains
8776 just one, empty item, you can do it as in this example:
8777 </para>
8778 <literallayout class="monospaced">
8779 senders = :
8780 </literallayout>
8781 <para>
8782 In this case, the first item is empty, and the second is discarded because it
8783 is at the end of the list.
8784 </para>
8785 </section>
8786 <section id="SECTfordricon">
8787 <title>Format of driver configurations</title>
8788 <para>
8789 <indexterm role="concept">
8790 <primary>drivers</primary>
8791 <secondary>configuration format</secondary>
8792 </indexterm>
8793 There are separate parts in the configuration for defining routers, transports,
8794 and authenticators. In each part, you are defining a number of driver
8795 instances, each with its own set of options. Each driver instance is defined by
8796 a sequence of lines like this:
8797 </para>
8798 <literallayout>
8799 &lt;<emphasis>instance name</emphasis>&gt;:
8800   &lt;<emphasis>option</emphasis>&gt;
8801   ...
8802   &lt;<emphasis>option</emphasis>&gt;
8803 </literallayout>
8804 <para>
8805 In the following example, the instance name is <command>localuser</command>, and it is
8806 followed by three options settings:
8807 </para>
8808 <literallayout class="monospaced">
8809 localuser:
8810   driver = accept
8811   check_local_user
8812   transport = local_delivery
8813 </literallayout>
8814 <para>
8815 For each driver instance, you specify which Exim code module it uses &ndash; by the
8816 setting of the <option>driver</option> option &ndash; and (optionally) some configuration
8817 settings. For example, in the case of transports, if you want a transport to
8818 deliver with SMTP you would use the <command>smtp</command> driver; if you want to deliver to
8819 a local file you would use the <command>appendfile</command> driver. Each of the drivers is
8820 described in detail in its own separate chapter later in this manual.
8821 </para>
8822 <para>
8823 You can have several routers, transports, or authenticators that are based on
8824 the same underlying driver (each must have a different instance name).
8825 </para>
8826 <para>
8827 The order in which routers are defined is important, because addresses are
8828 passed to individual routers one by one, in order. The order in which
8829 transports are defined does not matter at all. The order in which
8830 authenticators are defined is used only when Exim, as a client, is searching
8831 them to find one that matches an authentication mechanism offered by the
8832 server.
8833 </para>
8834 <para>
8835 <indexterm role="concept">
8836 <primary>generic options</primary>
8837 </indexterm>
8838 <indexterm role="concept">
8839 <primary>options</primary>
8840 <secondary>generic &ndash; definition of</secondary>
8841 </indexterm>
8842 Within a driver instance definition, there are two kinds of option: <emphasis>generic</emphasis>
8843 and <emphasis>private</emphasis>. The generic options are those that apply to all drivers of the
8844 same type (that is, all routers, all transports or all authenticators). The
8845 <option>driver</option> option is a generic option that must appear in every definition.
8846 <indexterm role="concept">
8847 <primary>private options</primary>
8848 </indexterm>
8849 The private options are special for each driver, and none need appear, because
8850 they all have default values.
8851 </para>
8852 <para>
8853 The options may appear in any order, except that the <option>driver</option> option must
8854 precede any private options, since these depend on the particular driver. For
8855 this reason, it is recommended that <option>driver</option> always be the first option.
8856 </para>
8857 <para>
8858 Driver instance names, which are used for reference in log entries and
8859 elsewhere, can be any sequence of letters, digits, and underscores (starting
8860 with a letter) and must be unique among drivers of the same type. A router and
8861 a transport (for example) can each have the same name, but no two router
8862 instances can have the same name. The name of a driver instance should not be
8863 confused with the name of the underlying driver module. For example, the
8864 configuration lines:
8865 </para>
8866 <literallayout class="monospaced">
8867 remote_smtp:
8868   driver = smtp
8869 </literallayout>
8870 <para>
8871 create an instance of the <command>smtp</command> transport driver whose name is
8872 <command>remote_smtp</command>. The same driver code can be used more than once, with
8873 different instance names and different option settings each time. A second
8874 instance of the <command>smtp</command> transport, with different options, might be defined
8875 thus:
8876 </para>
8877 <literallayout class="monospaced">
8878 special_smtp:
8879   driver = smtp
8880   port = 1234
8881   command_timeout = 10s
8882 </literallayout>
8883 <para>
8884 The names <command>remote_smtp</command> and <command>special_smtp</command> would be used to reference
8885 these transport instances from routers, and these names would appear in log
8886 lines.
8887 </para>
8888 <para>
8889 Comment lines may be present in the middle of driver specifications. The full
8890 list of option settings for any particular driver instance, including all the
8891 defaulted values, can be extracted by making use of the <option>-bP</option> command line
8892 option.
8893 </para>
8894 </section>
8895 </chapter>
8896
8897 <chapter id="CHAPdefconfil">
8898 <title>The default configuration file</title>
8899 <para>
8900 <indexterm role="concept" id="IIDconfiwal" class="startofrange">
8901 <primary>configuration file</primary>
8902 <secondary>default <quote>walk through</quote></secondary>
8903 </indexterm>
8904 <indexterm role="concept">
8905 <primary>default</primary>
8906 <secondary>configuration file <quote>walk through</quote></secondary>
8907 </indexterm>
8908 The default configuration file supplied with Exim as <filename>src/configure.default</filename>
8909 is sufficient for a host with simple mail requirements. As an introduction to
8910 the way Exim is configured, this chapter <quote>walks through</quote> the default
8911 configuration, giving brief explanations of the settings. Detailed descriptions
8912 of the options are given in subsequent chapters. The default configuration file
8913 itself contains extensive comments about ways you might want to modify the
8914 initial settings. However, note that there are many options that are not
8915 mentioned at all in the default configuration.
8916 </para>
8917 <section id="SECTdefconfmacros">
8918 <title>Macros</title>
8919 <para>
8920 All macros should be defined before any options.
8921 </para>
8922 <para>
8923 One macro is specified, but commented out, in the default configuration:
8924 </para>
8925 <literallayout class="monospaced">
8926 # ROUTER_SMARTHOST=MAIL.HOSTNAME.FOR.CENTRAL.SERVER.EXAMPLE
8927 </literallayout>
8928 <para>
8929 If all off-site mail is expected to be delivered to a "smarthost", then set the
8930 hostname here and uncomment the macro.  This will affect which router is used
8931 later on.  If this is left commented out, then Exim will perform direct-to-MX
8932 deliveries using a <command>dnslookup</command> router.
8933 </para>
8934 <para>
8935 In addition to macros defined here, Exim includes a number of built-in macros
8936 to enable configuration to be guarded by a binary built with support for a
8937 given feature.  See section <xref linkend="SECTbuiltinmacros"/> for more details.
8938 </para>
8939 </section>
8940 <section id="SECTdefconfmain">
8941 <title>Main configuration settings</title>
8942 <para>
8943 The main (global) configuration option settings section must always come first
8944 in the file, after the macros.
8945 The first thing you&#x2019;ll see in the file, after some initial comments, is the line
8946 </para>
8947 <literallayout class="monospaced">
8948 # primary_hostname =
8949 </literallayout>
8950 <para>
8951 This is a commented-out setting of the <option>primary_hostname</option> option. Exim needs
8952 to know the official, fully qualified name of your host, and this is where you
8953 can specify it. However, in most cases you do not need to set this option. When
8954 it is unset, Exim uses the <function>uname()</function> system function to obtain the host name.
8955 </para>
8956 <para>
8957 The first three non-comment configuration lines are as follows:
8958 </para>
8959 <literallayout class="monospaced">
8960 domainlist local_domains    = @
8961 domainlist relay_to_domains =
8962 hostlist   relay_from_hosts = 127.0.0.1
8963 </literallayout>
8964 <para>
8965 These are not, in fact, option settings. They are definitions of two named
8966 domain lists and one named host list. Exim allows you to give names to lists of
8967 domains, hosts, and email addresses, in order to make it easier to manage the
8968 configuration file (see section <xref linkend="SECTnamedlists"/>).
8969 </para>
8970 <para>
8971 The first line defines a domain list called <emphasis>local_domains</emphasis>; this is used
8972 later in the configuration to identify domains that are to be delivered
8973 on the local host.
8974 </para>
8975 <para>
8976 <indexterm role="concept">
8977 <primary>@ in a domain list</primary>
8978 </indexterm>
8979 There is just one item in this list, the string <quote>@</quote>. This is a special form
8980 of entry which means <quote>the name of the local host</quote>. Thus, if the local host is
8981 called <emphasis>a.host.example</emphasis>, mail to <emphasis>any.user@a.host.example</emphasis> is expected to
8982 be delivered locally. Because the local host&#x2019;s name is referenced indirectly,
8983 the same configuration file can be used on different hosts.
8984 </para>
8985 <para>
8986 The second line defines a domain list called <emphasis>relay_to_domains</emphasis>, but the
8987 list itself is empty. Later in the configuration we will come to the part that
8988 controls mail relaying through the local host; it allows relaying to any
8989 domains in this list. By default, therefore, no relaying on the basis of a mail
8990 domain is permitted.
8991 </para>
8992 <para>
8993 The third line defines a host list called <emphasis>relay_from_hosts</emphasis>. This list is
8994 used later in the configuration to permit relaying from any host or IP address
8995 that matches the list. The default contains just the IP address of the IPv4
8996 loopback interface, which means that processes on the local host are able to
8997 submit mail for relaying by sending it over TCP/IP to that interface. No other
8998 hosts are permitted to submit messages for relaying.
8999 </para>
9000 <para>
9001 Just to be sure there&#x2019;s no misunderstanding: at this point in the configuration
9002 we aren&#x2019;t actually setting up any controls. We are just defining some domains
9003 and hosts that will be used in the controls that are specified later.
9004 </para>
9005 <para>
9006 The next two configuration lines are genuine option settings:
9007 </para>
9008 <literallayout class="monospaced">
9009 acl_smtp_rcpt = acl_check_rcpt
9010 acl_smtp_data = acl_check_data
9011 </literallayout>
9012 <para>
9013 These options specify <emphasis>Access Control Lists</emphasis> (ACLs) that are to be used
9014 during an incoming SMTP session for every recipient of a message (every RCPT
9015 command), and after the contents of the message have been received,
9016 respectively. The names of the lists are <emphasis>acl_check_rcpt</emphasis> and
9017 <emphasis>acl_check_data</emphasis>, and we will come to their definitions below, in the ACL
9018 section of the configuration. The RCPT ACL controls which recipients are
9019 accepted for an incoming message &ndash; if a configuration does not provide an ACL
9020 to check recipients, no SMTP mail can be accepted. The DATA ACL allows the
9021 contents of a message to be checked.
9022 </para>
9023 <para>
9024 Two commented-out option settings are next:
9025 </para>
9026 <literallayout class="monospaced">
9027 # av_scanner = clamd:/tmp/clamd
9028 # spamd_address = 127.0.0.1 783
9029 </literallayout>
9030 <para>
9031 These are example settings that can be used when Exim is compiled with the
9032 content-scanning extension. The first specifies the interface to the virus
9033 scanner, and the second specifies the interface to SpamAssassin. Further
9034 details are given in chapter <xref linkend="CHAPexiscan"/>.
9035 </para>
9036 <para>
9037 Three more commented-out option settings follow:
9038 </para>
9039 <literallayout class="monospaced">
9040 # tls_advertise_hosts = *
9041 # tls_certificate = /etc/ssl/exim.crt
9042 # tls_privatekey = /etc/ssl/exim.pem
9043 </literallayout>
9044 <para>
9045 These are example settings that can be used when Exim is compiled with
9046 support for TLS (aka SSL) as described in section <xref linkend="SECTinctlsssl"/>. The
9047 first one specifies the list of clients that are allowed to use TLS when
9048 connecting to this server; in this case, the wildcard means all clients. The
9049 other options specify where Exim should find its TLS certificate and private
9050 key, which together prove the server&#x2019;s identity to any clients that connect.
9051 More details are given in chapter <xref linkend="CHAPTLS"/>.
9052 </para>
9053 <para>
9054 Another two commented-out option settings follow:
9055 </para>
9056 <literallayout class="monospaced">
9057 # daemon_smtp_ports = 25 : 465 : 587
9058 # tls_on_connect_ports = 465
9059 </literallayout>
9060 <para>
9061 <indexterm role="concept">
9062 <primary>port</primary>
9063 <secondary>465 and 587</secondary>
9064 </indexterm>
9065 <indexterm role="concept">
9066 <primary>port</primary>
9067 <secondary>for message submission</secondary>
9068 </indexterm>
9069 <indexterm role="concept">
9070 <primary>message</primary>
9071 <secondary>submission, ports for</secondary>
9072 </indexterm>
9073 <indexterm role="concept">
9074 <primary>submissions protocol</primary>
9075 </indexterm>
9076 <indexterm role="concept">
9077 <primary>smtps protocol</primary>
9078 </indexterm>
9079 <indexterm role="concept">
9080 <primary>ssmtp protocol</primary>
9081 </indexterm>
9082 <indexterm role="concept">
9083 <primary>SMTP</primary>
9084 <secondary>submissions protocol</secondary>
9085 </indexterm>
9086 <indexterm role="concept">
9087 <primary>SMTP</primary>
9088 <secondary>ssmtp protocol</secondary>
9089 </indexterm>
9090 <indexterm role="concept">
9091 <primary>SMTP</primary>
9092 <secondary>smtps protocol</secondary>
9093 </indexterm>
9094 These options provide better support for roaming users who wish to use this
9095 server for message submission. They are not much use unless you have turned on
9096 TLS (as described in the previous paragraph) and authentication (about which
9097 more in section <xref linkend="SECTdefconfauth"/>).
9098 Mail submission from mail clients (MUAs) should be separate from inbound mail
9099 to your domain (MX delivery) for various good reasons (eg, ability to impose
9100 much saner TLS protocol and ciphersuite requirements without unintended
9101 consequences).
9102 RFC 6409 (previously 4409) specifies use of port 587 for SMTP Submission,
9103 which uses STARTTLS, so this is the <quote>submission</quote> port.
9104 RFC 8314 specifies use of port 465 as the <quote>submissions</quote> protocol,
9105 which should be used in preference to 587.
9106 You should also consider deploying SRV records to help clients find
9107 these ports.
9108 Older names for <quote>submissions</quote> are <quote>smtps</quote> and <quote>ssmtp</quote>.
9109 </para>
9110 <para>
9111 Two more commented-out options settings follow:
9112 </para>
9113 <literallayout class="monospaced">
9114 # qualify_domain =
9115 # qualify_recipient =
9116 </literallayout>
9117 <para>
9118 The first of these specifies a domain that Exim uses when it constructs a
9119 complete email address from a local login name. This is often needed when Exim
9120 receives a message from a local process. If you do not set <option>qualify_domain</option>,
9121 the value of <option>primary_hostname</option> is used. If you set both of these options,
9122 you can have different qualification domains for sender and recipient
9123 addresses. If you set only the first one, its value is used in both cases.
9124 </para>
9125 <para>
9126 <indexterm role="concept">
9127 <primary>domain literal</primary>
9128 <secondary>recognizing format</secondary>
9129 </indexterm>
9130 The following line must be uncommented if you want Exim to recognize
9131 addresses of the form <emphasis>user@[10.11.12.13]</emphasis> that is, with a <quote>domain literal</quote>
9132 (an IP address within square brackets) instead of a named domain.
9133 </para>
9134 <literallayout class="monospaced">
9135 # allow_domain_literals
9136 </literallayout>
9137 <para>
9138 The RFCs still require this form, but many people think that in the modern
9139 Internet it makes little sense to permit mail to be sent to specific hosts by
9140 quoting their IP addresses. This ancient format has been used by people who
9141 try to abuse hosts by using them for unwanted relaying. However, some
9142 people believe there are circumstances (for example, messages addressed to
9143 <emphasis>postmaster</emphasis>) where domain literals are still useful.
9144 </para>
9145 <para>
9146 The next configuration line is a kind of trigger guard:
9147 </para>
9148 <literallayout class="monospaced">
9149 never_users = root
9150 </literallayout>
9151 <para>
9152 It specifies that no delivery must ever be run as the root user. The normal
9153 convention is to set up <emphasis>root</emphasis> as an alias for the system administrator. This
9154 setting is a guard against slips in the configuration.
9155 The list of users specified by <option>never_users</option> is not, however, the complete
9156 list; the build-time configuration in <filename>Local/Makefile</filename> has an option called
9157 FIXED_NEVER_USERS specifying a list that cannot be overridden. The
9158 contents of <option>never_users</option> are added to this list. By default
9159 FIXED_NEVER_USERS also specifies root.
9160 </para>
9161 <para>
9162 When a remote host connects to Exim in order to send mail, the only information
9163 Exim has about the host&#x2019;s identity is its IP address. The next configuration
9164 line,
9165 </para>
9166 <literallayout class="monospaced">
9167 host_lookup = *
9168 </literallayout>
9169 <para>
9170 specifies that Exim should do a reverse DNS lookup on all incoming connections,
9171 in order to get a host name. This improves the quality of the logging
9172 information, but if you feel it is too expensive, you can remove it entirely,
9173 or restrict the lookup to hosts on <quote>nearby</quote> networks.
9174 Note that it is not always possible to find a host name from an IP address,
9175 because not all DNS reverse zones are maintained, and sometimes DNS servers are
9176 unreachable.
9177 </para>
9178 <para>
9179 The next two lines are concerned with <emphasis>ident</emphasis> callbacks, as defined by RFC
9180 1413 (hence their names):
9181 </para>
9182 <literallayout class="monospaced">
9183 rfc1413_hosts = *
9184 rfc1413_query_timeout = 0s
9185 </literallayout>
9186 <para>
9187 These settings cause Exim to avoid ident callbacks for all incoming SMTP calls.
9188 Few hosts offer RFC1413 service these days; calls have to be
9189 terminated by a timeout and this needlessly delays the startup
9190 of an incoming SMTP connection.
9191 If you have hosts for which you trust RFC1413 and need this
9192 information, you can change this.
9193 </para>
9194 <para>
9195 This line enables an efficiency SMTP option.  It is negotiated by clients
9196 and not expected to cause problems but can be disabled if needed.
9197 </para>
9198 <literallayout class="monospaced">
9199 prdr_enable = true
9200 </literallayout>
9201 <para>
9202 When Exim receives messages over SMTP connections, it expects all addresses to
9203 be fully qualified with a domain, as required by the SMTP definition. However,
9204 if you are running a server to which simple clients submit messages, you may
9205 find that they send unqualified addresses. The two commented-out options:
9206 </para>
9207 <literallayout class="monospaced">
9208 # sender_unqualified_hosts =
9209 # recipient_unqualified_hosts =
9210 </literallayout>
9211 <para>
9212 show how you can specify hosts that are permitted to send unqualified sender
9213 and recipient addresses, respectively.
9214 </para>
9215 <para>
9216 The <option>log_selector</option> option is used to increase the detail of logging
9217 over the default:
9218 </para>
9219 <literallayout class="monospaced">
9220 log_selector = +smtp_protocol_error +smtp_syntax_error \
9221                +tls_certificate_verified
9222 </literallayout>
9223 <para>
9224 The <option>percent_hack_domains</option> option is also commented out:
9225 </para>
9226 <literallayout class="monospaced">
9227 # percent_hack_domains =
9228 </literallayout>
9229 <para>
9230 It provides a list of domains for which the <quote>percent hack</quote> is to operate.
9231 This is an almost obsolete form of explicit email routing. If you do not know
9232 anything about it, you can safely ignore this topic.
9233 </para>
9234 <para>
9235 The next two settings in the main part of the default configuration are
9236 concerned with messages that have been <quote>frozen</quote> on Exim&#x2019;s queue. When a
9237 message is frozen, Exim no longer continues to try to deliver it. Freezing
9238 occurs when a bounce message encounters a permanent failure because the sender
9239 address of the original message that caused the bounce is invalid, so the
9240 bounce cannot be delivered. This is probably the most common case, but there
9241 are also other conditions that cause freezing, and frozen messages are not
9242 always bounce messages.
9243 </para>
9244 <literallayout class="monospaced">
9245 ignore_bounce_errors_after = 2d
9246 timeout_frozen_after = 7d
9247 </literallayout>
9248 <para>
9249 The first of these options specifies that failing bounce messages are to be
9250 discarded after 2 days in the queue. The second specifies that any frozen
9251 message (whether a bounce message or not) is to be timed out (and discarded)
9252 after a week. In this configuration, the first setting ensures that no failing
9253 bounce message ever lasts a week.
9254 </para>
9255 <para>
9256 Exim queues it&#x2019;s messages in a spool directory. If you expect to have
9257 large queues, you may consider using this option. It splits the spool
9258 directory into subdirectories to avoid file system degradation from
9259 many files in a single directory, resulting in better performance.
9260 Manual manipulation of queued messages becomes more complex (though fortunately
9261 not often needed).
9262 </para>
9263 <literallayout class="monospaced">
9264 # split_spool_directory = true
9265 </literallayout>
9266 <para>
9267 In an ideal world everybody follows the standards. For non-ASCII
9268 messages RFC 2047 is a standard, allowing a maximum line length of 76
9269 characters. Exim adheres that standard and won&#x2019;t process messages which
9270 violate this standard. (Even ${rfc2047:...} expansions will fail.)
9271 In particular, the Exim maintainers have had multiple reports of
9272 problems from Russian administrators of issues until they disable this
9273 check, because of some popular, yet buggy, mail composition software.
9274 </para>
9275 <literallayout class="monospaced">
9276 # check_rfc2047_length = false
9277 </literallayout>
9278 <para>
9279 If you need to be strictly RFC compliant you may wish to disable the
9280 8BITMIME advertisement. Use this, if you exchange mails with systems
9281 that are not 8-bit clean.
9282 </para>
9283 <literallayout class="monospaced">
9284 # accept_8bitmime = false
9285 </literallayout>
9286 <para>
9287 Libraries you use may depend on specific environment settings.  This
9288 imposes a security risk (e.g. PATH). There are two lists:
9289 <option>keep_environment</option> for the variables to import as they are, and
9290 <option>add_environment</option> for variables we want to set to a fixed value.
9291 Note that TZ is handled separately, by the <option>timezone</option> runtime
9292 option and by the TIMEZONE_DEFAULT buildtime option.
9293 </para>
9294 <literallayout class="monospaced">
9295 # keep_environment = ^LDAP
9296 # add_environment = PATH=/usr/bin::/bin
9297 </literallayout>
9298 </section>
9299 <section id="SECID54">
9300 <title>ACL configuration</title>
9301 <para>
9302 <indexterm role="concept">
9303 <primary>default</primary>
9304 <secondary>ACLs</secondary>
9305 </indexterm>
9306 <indexterm role="concept">
9307 <primary>access control lists (ACLs)</primary>
9308 <secondary>default configuration</secondary>
9309 </indexterm>
9310 In the default configuration, the ACL section follows the main configuration.
9311 It starts with the line
9312 </para>
9313 <literallayout class="monospaced">
9314 begin acl
9315 </literallayout>
9316 <para>
9317 and it contains the definitions of two ACLs, called <emphasis>acl_check_rcpt</emphasis> and
9318 <emphasis>acl_check_data</emphasis>, that were referenced in the settings of <option>acl_smtp_rcpt</option>
9319 and <option>acl_smtp_data</option> above.
9320 </para>
9321 <para>
9322 <indexterm role="concept">
9323 <primary>RCPT</primary>
9324 <secondary>ACL for</secondary>
9325 </indexterm>
9326 The first ACL is used for every RCPT command in an incoming SMTP message. Each
9327 RCPT command specifies one of the message&#x2019;s recipients. The ACL statements
9328 are considered in order, until the recipient address is either accepted or
9329 rejected. The RCPT command is then accepted or rejected, according to the
9330 result of the ACL processing.
9331 </para>
9332 <literallayout class="monospaced">
9333 acl_check_rcpt:
9334 </literallayout>
9335 <para>
9336 This line, consisting of a name terminated by a colon, marks the start of the
9337 ACL, and names it.
9338 </para>
9339 <literallayout class="monospaced">
9340 accept  hosts = :
9341 </literallayout>
9342 <para>
9343 This ACL statement accepts the recipient if the sending host matches the list.
9344 But what does that strange list mean? It doesn&#x2019;t actually contain any host
9345 names or IP addresses. The presence of the colon puts an empty item in the
9346 list; Exim matches this only if the incoming message did not come from a remote
9347 host, because in that case, the remote hostname is empty. The colon is
9348 important. Without it, the list itself is empty, and can never match anything.
9349 </para>
9350 <para>
9351 What this statement is doing is to accept unconditionally all recipients in
9352 messages that are submitted by SMTP from local processes using the standard
9353 input and output (that is, not using TCP/IP). A number of MUAs operate in this
9354 manner.
9355 </para>
9356 <literallayout class="monospaced">
9357 deny    domains       = +local_domains
9358         local_parts   = ^[.] : ^.*[@%!/|]
9359         message       = Restricted characters in address
9360
9361 deny    domains       = !+local_domains
9362         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
9363         message       = Restricted characters in address
9364 </literallayout>
9365 <para>
9366 These statements are concerned with local parts that contain any of the
9367 characters <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>, <quote>|</quote>, or dots in unusual places.
9368 Although these characters are entirely legal in local parts (in the case of
9369 <quote>@</quote> and leading dots, only if correctly quoted), they do not commonly occur
9370 in Internet mail addresses.
9371 </para>
9372 <para>
9373 The first three have in the past been associated with explicitly routed
9374 addresses (percent is still sometimes used &ndash; see the <option>percent_hack_domains</option>
9375 option). Addresses containing these characters are regularly tried by spammers
9376 in an attempt to bypass relaying restrictions, and also by open relay testing
9377 programs. Unless you really need them it is safest to reject these characters
9378 at this early stage. This configuration is heavy-handed in rejecting these
9379 characters for all messages it accepts from remote hosts. This is a deliberate
9380 policy of being as safe as possible.
9381 </para>
9382 <para>
9383 The first rule above is stricter, and is applied to messages that are addressed
9384 to one of the local domains handled by this host. This is implemented by the
9385 first condition, which restricts it to domains that are listed in the
9386 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
9387 reference to a named list. In this configuration, there is just one domain in
9388 <emphasis>local_domains</emphasis>, but in general there may be many.
9389 </para>
9390 <para>
9391 The second condition on the first statement uses two regular expressions to
9392 block local parts that begin with a dot or contain <quote>@</quote>, <quote>%</quote>, <quote>!</quote>, <quote>/</quote>,
9393 or <quote>|</quote>. If you have local accounts that include these characters, you will
9394 have to modify this rule.
9395 </para>
9396 <para>
9397 Empty components (two dots in a row) are not valid in RFC 2822, but Exim
9398 allows them because they have been encountered in practice. (Consider the
9399 common convention of local parts constructed as
9400 <quote><emphasis>first-initial.second-initial.family-name</emphasis></quote> when applied to someone like
9401 the author of Exim, who has no second initial.) However, a local part starting
9402 with a dot or containing <quote>/../</quote> can cause trouble if it is used as part of a
9403 filename (for example, for a mailing list). This is also true for local parts
9404 that contain slashes. A pipe symbol can also be troublesome if the local part
9405 is incorporated unthinkingly into a shell command line.
9406 </para>
9407 <para>
9408 The second rule above applies to all other domains, and is less strict. This
9409 allows your own users to send outgoing messages to sites that use slashes
9410 and vertical bars in their local parts. It blocks local parts that begin
9411 with a dot, slash, or vertical bar, but allows these characters within the
9412 local part. However, the sequence <quote>/../</quote> is barred. The use of <quote>@</quote>, <quote>%</quote>,
9413 and <quote>!</quote> is blocked, as before. The motivation here is to prevent your users
9414 (or your users&#x2019; viruses) from mounting certain kinds of attack on remote sites.
9415 </para>
9416 <literallayout class="monospaced">
9417 accept  local_parts   = postmaster
9418         domains       = +local_domains
9419 </literallayout>
9420 <para>
9421 This statement, which has two conditions, accepts an incoming address if the
9422 local part is <emphasis>postmaster</emphasis> and the domain is one of those listed in the
9423 <emphasis>local_domains</emphasis> domain list. The <quote>+</quote> character is used to indicate a
9424 reference to a named list. In this configuration, there is just one domain in
9425 <emphasis>local_domains</emphasis>, but in general there may be many.
9426 </para>
9427 <para>
9428 The presence of this statement means that mail to postmaster is never blocked
9429 by any of the subsequent tests. This can be helpful while sorting out problems
9430 in cases where the subsequent tests are incorrectly denying access.
9431 </para>
9432 <literallayout class="monospaced">
9433 require verify        = sender
9434 </literallayout>
9435 <para>
9436 This statement requires the sender address to be verified before any subsequent
9437 ACL statement can be used. If verification fails, the incoming recipient
9438 address is refused. Verification consists of trying to route the address, to
9439 see if a bounce message could be delivered to it. In the case of remote
9440 addresses, basic verification checks only the domain, but <emphasis>callouts</emphasis> can be
9441 used for more verification if required. Section <xref linkend="SECTaddressverification"/>
9442 discusses the details of address verification.
9443 </para>
9444 <literallayout class="monospaced">
9445 accept  hosts         = +relay_from_hosts
9446         control       = submission
9447 </literallayout>
9448 <para>
9449 This statement accepts the address if the message is coming from one of the
9450 hosts that are defined as being allowed to relay through this host. Recipient
9451 verification is omitted here, because in many cases the clients are dumb MUAs
9452 that do not cope well with SMTP error responses. For the same reason, the
9453 second line specifies <quote>submission mode</quote> for messages that are accepted. This
9454 is described in detail in section <xref linkend="SECTsubmodnon"/>; it causes Exim to fix
9455 messages that are deficient in some way, for example, because they lack a
9456 <emphasis>Date:</emphasis> header line. If you are actually relaying out from MTAs, you should
9457 probably add recipient verification here, and disable submission mode.
9458 </para>
9459 <literallayout class="monospaced">
9460 accept  authenticated = *
9461         control       = submission
9462 </literallayout>
9463 <para>
9464 This statement accepts the address if the client host has authenticated itself.
9465 Submission mode is again specified, on the grounds that such messages are most
9466 likely to come from MUAs. The default configuration does not define any
9467 authenticators, though it does include some nearly complete commented-out
9468 examples described in <xref linkend="SECTdefconfauth"/>. This means that no client can in
9469 fact authenticate until you complete the authenticator definitions.
9470 </para>
9471 <literallayout class="monospaced">
9472 require message = relay not permitted
9473         domains = +local_domains : +relay_to_domains
9474 </literallayout>
9475 <para>
9476 This statement rejects the address if its domain is neither a local domain nor
9477 one of the domains for which this host is a relay.
9478 </para>
9479 <literallayout class="monospaced">
9480 require verify = recipient
9481 </literallayout>
9482 <para>
9483 This statement requires the recipient address to be verified; if verification
9484 fails, the address is rejected.
9485 </para>
9486 <literallayout class="monospaced">
9487 # deny    dnslists    = black.list.example
9488 #         message     = rejected because $sender_host_address \
9489 #                       is in a black list at $dnslist_domain\n\
9490 #                       $dnslist_text
9491 #
9492 # warn    dnslists    = black.list.example
9493 #         add_header  = X-Warning: $sender_host_address is in \
9494 #                       a black list at $dnslist_domain
9495 #         log_message = found in $dnslist_domain
9496 </literallayout>
9497 <para>
9498 These commented-out lines are examples of how you could configure Exim to check
9499 sending hosts against a DNS black list. The first statement rejects messages
9500 from blacklisted hosts, whereas the second just inserts a warning header
9501 line.
9502 </para>
9503 <literallayout class="monospaced">
9504 # require verify = csa
9505 </literallayout>
9506 <para>
9507 This commented-out line is an example of how you could turn on client SMTP
9508 authorization (CSA) checking. Such checks do DNS lookups for special SRV
9509 records.
9510 </para>
9511 <literallayout class="monospaced">
9512 accept
9513 </literallayout>
9514 <para>
9515 The final statement in the first ACL unconditionally accepts any recipient
9516 address that has successfully passed all the previous tests.
9517 </para>
9518 <literallayout class="monospaced">
9519 acl_check_data:
9520 </literallayout>
9521 <para>
9522 This line marks the start of the second ACL, and names it. Most of the contents
9523 of this ACL are commented out:
9524 </para>
9525 <literallayout class="monospaced">
9526 # deny    malware   = *
9527 #         message   = This message contains a virus \
9528 #                     ($malware_name).
9529 </literallayout>
9530 <para>
9531 These lines are examples of how to arrange for messages to be scanned for
9532 viruses when Exim has been compiled with the content-scanning extension, and a
9533 suitable virus scanner is installed. If the message is found to contain a
9534 virus, it is rejected with the given custom error message.
9535 </para>
9536 <literallayout class="monospaced">
9537 # warn    spam      = nobody
9538 #         message   = X-Spam_score: $spam_score\n\
9539 #                     X-Spam_score_int: $spam_score_int\n\
9540 #                     X-Spam_bar: $spam_bar\n\
9541 #                     X-Spam_report: $spam_report
9542 </literallayout>
9543 <para>
9544 These lines are an example of how to arrange for messages to be scanned by
9545 SpamAssassin when Exim has been compiled with the content-scanning extension,
9546 and SpamAssassin has been installed. The SpamAssassin check is run with
9547 <literal>nobody</literal> as its user parameter, and the results are added to the message as a
9548 series of extra header line. In this case, the message is not rejected,
9549 whatever the spam score.
9550 </para>
9551 <literallayout class="monospaced">
9552 accept
9553 </literallayout>
9554 <para>
9555 This final line in the DATA ACL accepts the message unconditionally.
9556 </para>
9557 </section>
9558 <section id="SECID55">
9559 <title>Router configuration</title>
9560 <para>
9561 <indexterm role="concept">
9562 <primary>default</primary>
9563 <secondary>routers</secondary>
9564 </indexterm>
9565 <indexterm role="concept">
9566 <primary>routers</primary>
9567 <secondary>default</secondary>
9568 </indexterm>
9569 The router configuration comes next in the default configuration, introduced
9570 by the line
9571 </para>
9572 <literallayout class="monospaced">
9573 begin routers
9574 </literallayout>
9575 <para>
9576 Routers are the modules in Exim that make decisions about where to send
9577 messages. An address is passed to each router, in turn, until it is either
9578 accepted, or failed. This means that the order in which you define the routers
9579 matters. Each router is fully described in its own chapter later in this
9580 manual. Here we give only brief overviews.
9581 </para>
9582 <literallayout class="monospaced">
9583 # domain_literal:
9584 #   driver = ipliteral
9585 #   domains = !+local_domains
9586 #   transport = remote_smtp
9587 </literallayout>
9588 <para>
9589 <indexterm role="concept">
9590 <primary>domain literal</primary>
9591 <secondary>default router</secondary>
9592 </indexterm>
9593 This router is commented out because the majority of sites do not want to
9594 support domain literal addresses (those of the form <emphasis>user@[10.9.8.7]</emphasis>). If
9595 you uncomment this router, you also need to uncomment the setting of
9596 <option>allow_domain_literals</option> in the main part of the configuration.
9597 </para>
9598 <para>
9599 Which router is used next depends upon whether or not the ROUTER_SMARTHOST
9600 macro has been defined, per
9601 </para>
9602 <literallayout class="monospaced">
9603 .ifdef ROUTER_SMARTHOST
9604 smarthost:
9605 #...
9606 .else
9607 dnslookup:
9608 #...
9609 .endif
9610 </literallayout>
9611 <para>
9612 If ROUTER_SMARTHOST has been defined, either at the top of the file or on the
9613 command-line, then we route all non-local mail to that smarthost; otherwise, we&#x2019;ll
9614 perform DNS lookups for direct-to-MX lookup.  Any mail which is to a local domain will
9615 skip these routers because of the <option>domains</option> option.
9616 </para>
9617 <literallayout class="monospaced">
9618 smarthost:
9619   driver = manualroute
9620   domains = ! +local_domains
9621   transport = smarthost_smtp
9622   route_data = ROUTER_SMARTHOST
9623   ignore_target_hosts = &lt;; 0.0.0.0 ; 127.0.0.0/8 ; ::1
9624   no_more
9625 </literallayout>
9626 <para>
9627 This router only handles mail which is not to any local domains; this is
9628 specified by the line
9629 </para>
9630 <literallayout class="monospaced">
9631 domains = ! +local_domains
9632 </literallayout>
9633 <para>
9634 The <option>domains</option> option lists the domains to which this router applies, but the
9635 exclamation mark is a negation sign, so the router is used only for domains
9636 that are not in the domain list called <emphasis>local_domains</emphasis> (which was defined at
9637 the start of the configuration). The plus sign before <emphasis>local_domains</emphasis>
9638 indicates that it is referring to a named list. Addresses in other domains are
9639 passed on to the following routers.
9640 </para>
9641 <para>
9642 The name of the router driver is <command>manualroute</command> because we are manually
9643 specifying how mail should be routed onwards, instead of using DNS MX.
9644 While the name of this router instance is arbitrary, the <option>driver</option> option must
9645 be one of the driver modules that is in the Exim binary.
9646 </para>
9647 <para>
9648 With no pre-conditions other than <option>domains</option>, all mail for non-local domains
9649 will be handled by this router, and the <option>no_more</option> setting will ensure that no
9650 other routers will be used for messages matching the pre-conditions.  See
9651 <xref linkend="SECTrouprecon"/> for more on how the pre-conditions apply.  For messages which
9652 are handled by this router, we provide a hostname to deliver to in <option>route_data</option>
9653 and the macro supplies the value; the address is then queued for the
9654 <command>smarthost_smtp</command> transport.
9655 </para>
9656 <literallayout class="monospaced">
9657 dnslookup:
9658   driver = dnslookup
9659   domains = ! +local_domains
9660   transport = remote_smtp
9661   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
9662   no_more
9663 </literallayout>
9664 <para>
9665 The <option>domains</option> option behaves as per smarthost, above.
9666 </para>
9667 <para>
9668 The name of the router driver is <command>dnslookup</command>,
9669 and is specified by the <option>driver</option> option. Do not be confused by the fact that
9670 the name of this router instance is the same as the name of the driver. The
9671 instance name is arbitrary, but the name set in the <option>driver</option> option must be
9672 one of the driver modules that is in the Exim binary.
9673 </para>
9674 <para>
9675 The <command>dnslookup</command> router routes addresses by looking up their domains in the
9676 DNS in order to obtain a list of hosts to which the address is routed. If the
9677 router succeeds, the address is queued for the <command>remote_smtp</command> transport, as
9678 specified by the <option>transport</option> option. If the router does not find the domain
9679 in the DNS, no further routers are tried because of the <option>no_more</option> setting, so
9680 the address fails and is bounced.
9681 </para>
9682 <para>
9683 The <option>ignore_target_hosts</option> option specifies a list of IP addresses that are to
9684 be entirely ignored. This option is present because a number of cases have been
9685 encountered where MX records in the DNS point to host names
9686 whose IP addresses are 0.0.0.0 or are in the 127 subnet (typically 127.0.0.1).
9687 Completely ignoring these IP addresses causes Exim to fail to route the
9688 email address, so it bounces. Otherwise, Exim would log a routing problem, and
9689 continue to try to deliver the message periodically until the address timed
9690 out.
9691 </para>
9692 <literallayout class="monospaced">
9693 system_aliases:
9694   driver = redirect
9695   allow_fail
9696   allow_defer
9697   data = ${lookup{$local_part}lsearch{/etc/aliases}}
9698 # user = exim
9699   file_transport = address_file
9700   pipe_transport = address_pipe
9701 </literallayout>
9702 <para>
9703 Control reaches this and subsequent routers only for addresses in the local
9704 domains. This router checks to see whether the local part is defined as an
9705 alias in the <filename>/etc/aliases</filename> file, and if so, redirects it according to the
9706 data that it looks up from that file. If no data is found for the local part,
9707 the value of the <option>data</option> option is empty, causing the address to be passed to
9708 the next router.
9709 </para>
9710 <para>
9711 <filename>/etc/aliases</filename> is a conventional name for the system aliases file that is
9712 often used. That is why it is referenced by from the default configuration
9713 file. However, you can change this by setting SYSTEM_ALIASES_FILE in
9714 <filename>Local/Makefile</filename> before building Exim.
9715 </para>
9716 <literallayout class="monospaced">
9717 userforward:
9718   driver = redirect
9719   check_local_user
9720 # local_part_suffix = +* : -*
9721 # local_part_suffix_optional
9722   file = $home/.forward
9723 # allow_filter
9724   no_verify
9725   no_expn
9726   check_ancestor
9727   file_transport = address_file
9728   pipe_transport = address_pipe
9729   reply_transport = address_reply
9730 </literallayout>
9731 <para>
9732 This is the most complicated router in the default configuration. It is another
9733 redirection router, but this time it is looking for forwarding data set up by
9734 individual users. The <option>check_local_user</option> setting specifies a check that the
9735 local part of the address is the login name of a local user. If it is not, the
9736 router is skipped. The two commented options that follow <option>check_local_user</option>,
9737 namely:
9738 </para>
9739 <literallayout class="monospaced">
9740 # local_part_suffix = +* : -*
9741 # local_part_suffix_optional
9742 </literallayout>
9743 <para>
9744 <indexterm role="variable">
9745 <primary><varname>$local_part_suffix</varname></primary>
9746 </indexterm>
9747 show how you can specify the recognition of local part suffixes. If the first
9748 is uncommented, a suffix beginning with either a plus or a minus sign, followed
9749 by any sequence of characters, is removed from the local part and placed in the
9750 variable <varname>$local_part_suffix</varname>. The second suffix option specifies that the
9751 presence of a suffix in the local part is optional. When a suffix is present,
9752 the check for a local login uses the local part with the suffix removed.
9753 </para>
9754 <para>
9755 When a local user account is found, the file called <filename>.forward</filename> in the user&#x2019;s
9756 home directory is consulted. If it does not exist, or is empty, the router
9757 declines. Otherwise, the contents of <filename>.forward</filename> are interpreted as
9758 redirection data (see chapter <xref linkend="CHAPredirect"/> for more details).
9759 </para>
9760 <para>
9761 <indexterm role="concept">
9762 <primary>Sieve filter</primary>
9763 <secondary>enabling in default router</secondary>
9764 </indexterm>
9765 Traditional <filename>.forward</filename> files contain just a list of addresses, pipes, or
9766 files. Exim supports this by default. However, if <option>allow_filter</option> is set (it
9767 is commented out by default), the contents of the file are interpreted as a set
9768 of Exim or Sieve filtering instructions, provided the file begins with <quote>#Exim
9769 filter</quote> or <quote>#Sieve filter</quote>, respectively. User filtering is discussed in the
9770 separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>.
9771 </para>
9772 <para>
9773 The <option>no_verify</option> and <option>no_expn</option> options mean that this router is skipped when
9774 verifying addresses, or when running as a consequence of an SMTP EXPN command.
9775 There are two reasons for doing this:
9776 </para>
9777 <orderedlist numeration="arabic">
9778 <listitem>
9779 <para>
9780 Whether or not a local user has a <filename>.forward</filename> file is not really relevant when
9781 checking an address for validity; it makes sense not to waste resources doing
9782 unnecessary work.
9783 </para>
9784 </listitem>
9785 <listitem>
9786 <para>
9787 More importantly, when Exim is verifying addresses or handling an EXPN
9788 command during an SMTP session, it is running as the Exim user, not as root.
9789 The group is the Exim group, and no additional groups are set up.
9790 It may therefore not be possible for Exim to read users&#x2019; <filename>.forward</filename> files at
9791 this time.
9792 </para>
9793 </listitem>
9794 </orderedlist>
9795 <para>
9796 The setting of <option>check_ancestor</option> prevents the router from generating a new
9797 address that is the same as any previous address that was redirected. (This
9798 works round a problem concerning a bad interaction between aliasing and
9799 forwarding &ndash; see section <xref linkend="SECTredlocmai"/>).
9800 </para>
9801 <para>
9802 The final three option settings specify the transports that are to be used when
9803 forwarding generates a direct delivery to a file, or to a pipe, or sets up an
9804 auto-reply, respectively. For example, if a <filename>.forward</filename> file contains
9805 </para>
9806 <literallayout class="monospaced">
9807 a.nother@elsewhere.example, /home/spqr/archive
9808 </literallayout>
9809 <para>
9810 the delivery to <filename>/home/spqr/archive</filename> is done by running the <option>address_file</option>
9811 transport.
9812 </para>
9813 <literallayout class="monospaced">
9814 localuser:
9815   driver = accept
9816   check_local_user
9817 # local_part_suffix = +* : -*
9818 # local_part_suffix_optional
9819   transport = local_delivery
9820 </literallayout>
9821 <para>
9822 The final router sets up delivery into local mailboxes, provided that the local
9823 part is the name of a local login, by accepting the address and assigning it to
9824 the <command>local_delivery</command> transport. Otherwise, we have reached the end of the
9825 routers, so the address is bounced. The commented suffix settings fulfil the
9826 same purpose as they do for the <command>userforward</command> router.
9827 </para>
9828 </section>
9829 <section id="SECID56">
9830 <title>Transport configuration</title>
9831 <para>
9832 <indexterm role="concept">
9833 <primary>default</primary>
9834 <secondary>transports</secondary>
9835 </indexterm>
9836 <indexterm role="concept">
9837 <primary>transports</primary>
9838 <secondary>default</secondary>
9839 </indexterm>
9840 Transports define mechanisms for actually delivering messages. They operate
9841 only when referenced from routers, so the order in which they are defined does
9842 not matter. The transports section of the configuration starts with
9843 </para>
9844 <literallayout class="monospaced">
9845 begin transports
9846 </literallayout>
9847 <para>
9848 Two remote transports and four local transports are defined.
9849 </para>
9850 <literallayout class="monospaced">
9851 remote_smtp:
9852   driver = smtp
9853   message_size_limit = ${if &gt; {$max_received_linelength}{998} {1}{0}}
9854 .ifdef _HAVE_PRDR
9855   hosts_try_prdr = *
9856 .endif
9857 </literallayout>
9858 <para>
9859 This transport is used for delivering messages over SMTP connections.
9860 The list of remote hosts comes from the router.
9861 The <option>message_size_limit</option> usage is a hack to avoid sending on messages
9862 with over-long lines.
9863 </para>
9864 <para>
9865 The <option>hosts_try_prdr</option> option enables an efficiency SMTP option.  It is
9866 negotiated between client and server and not expected to cause problems
9867 but can be disabled if needed.  The built-in macro _HAVE_PRDR guards the
9868 use of the <option>hosts_try_prdr</option> configuration option.
9869 </para>
9870 <para>
9871 The other remote transport is used when delivering to a specific smarthost
9872 with whom there must be some kind of existing relationship, instead of the
9873 usual federated system.
9874 </para>
9875 <literallayout class="monospaced">
9876 smarthost_smtp:
9877   driver = smtp
9878   message_size_limit = ${if &gt; {$max_received_linelength}{998} {1}{0}}
9879   multi_domain
9880   #
9881 .ifdef _HAVE_TLS
9882   # Comment out any of these which you have to, then file a Support
9883   # request with your smarthost provider to get things fixed:
9884   hosts_require_tls = *
9885   tls_verify_hosts = *
9886   # As long as tls_verify_hosts is enabled, this this will have no effect,
9887   # but if you have to comment it out then this will at least log whether
9888   # you succeed or not:
9889   tls_try_verify_hosts = *
9890   #
9891   # The SNI name should match the name which we'll expect to verify;
9892   # many mail systems don't use SNI and this doesn't matter, but if it does,
9893   # we need to send a name which the remote site will recognize.
9894   # This _should_ be the name which the smarthost operators specified as
9895   # the hostname for sending your mail to.
9896   tls_sni = ROUTER_SMARTHOST
9897   #
9898 .ifdef _HAVE_OPENSSL
9899   tls_require_ciphers = HIGH:!aNULL:@STRENGTH
9900 .endif
9901 .ifdef _HAVE_GNUTLS
9902   tls_require_ciphers = SECURE192:-VERS-SSL3.0:-VERS-TLS1.0:-VERS-TLS1.1
9903 .endif
9904 .endif
9905 .ifdef _HAVE_PRDR
9906   hosts_try_prdr = *
9907 .endif
9908 </literallayout>
9909 <para>
9910 After the same <option>message_size_limit</option> hack, we then specify that this Transport
9911 can handle messages to multiple domains in one run.  The assumption here is
9912 that you&#x2019;re routing all non-local mail to the same place and that place is
9913 happy to take all messages from you as quickly as possible.
9914 All other options depend upon built-in macros; if Exim was built without TLS support
9915 then no other options are defined.
9916 If TLS is available, then we configure "stronger than default" TLS ciphersuites
9917 and versions using the <option>tls_require_ciphers</option> option, where the value to be
9918 used depends upon the library providing TLS.
9919 Beyond that, the options adopt the stance that you should have TLS support available
9920 from your smarthost on today&#x2019;s Internet, so we turn on requiring TLS for the
9921 mail to be delivered, and requiring that the certificate be valid, and match
9922 the expected hostname.  The <option>tls_sni</option> option can be used by service providers
9923 to select an appropriate certificate to present to you and here we re-use the
9924 ROUTER_SMARTHOST macro, because that is unaffected by CNAMEs present in DNS.
9925 You want to specify the hostname which you&#x2019;ll expect to validate for, and that
9926 should not be subject to insecure tampering via DNS results.
9927 </para>
9928 <para>
9929 For the <option>hosts_try_prdr</option> option see the previous transport.
9930 </para>
9931 <para>
9932 All other options are defaulted.
9933 </para>
9934 <literallayout class="monospaced">
9935 local_delivery:
9936   driver = appendfile
9937   file = /var/mail/$local_part_data
9938   delivery_date_add
9939   envelope_to_add
9940   return_path_add
9941 # group = mail
9942 # mode = 0660
9943 </literallayout>
9944 <para>
9945 This <command>appendfile</command> transport is used for local delivery to user mailboxes in
9946 traditional BSD mailbox format.
9947 </para>
9948 <para>
9949 We prefer to avoid using <varname>$local_part</varname> directly to define the mailbox filename,
9950 as it is provided by a potential bad actor.
9951 Instead we use <varname>$local_part_data</varname>,
9952 the result of looking up <varname>$local_part</varname> in the user database
9953 (done by using <option>check_local_user</option> in the the router).
9954 </para>
9955 <para>
9956 By default <command>appendfile</command> runs under the uid and gid of the
9957 local user, which requires the sticky bit to be set on the <filename>/var/mail</filename>
9958 directory. Some systems use the alternative approach of running mail deliveries
9959 under a particular group instead of using the sticky bit. The commented options
9960 show how this can be done.
9961 </para>
9962 <para>
9963 Exim adds three headers to the message as it delivers it: <emphasis>Delivery-date:</emphasis>,
9964 <emphasis>Envelope-to:</emphasis> and <emphasis>Return-path:</emphasis>. This action is requested by the three
9965 similarly-named options above.
9966 </para>
9967 <literallayout class="monospaced">
9968 address_pipe:
9969   driver = pipe
9970   return_output
9971 </literallayout>
9972 <para>
9973 This transport is used for handling deliveries to pipes that are generated by
9974 redirection (aliasing or users&#x2019; <filename>.forward</filename> files). The <option>return_output</option>
9975 option specifies that any output on stdout or stderr generated by the pipe is to
9976 be returned to the sender.
9977 </para>
9978 <literallayout class="monospaced">
9979 address_file:
9980   driver = appendfile
9981   delivery_date_add
9982   envelope_to_add
9983   return_path_add
9984 </literallayout>
9985 <para>
9986 This transport is used for handling deliveries to files that are generated by
9987 redirection. The name of the file is not specified in this instance of
9988 <command>appendfile</command>, because it comes from the <command>redirect</command> router.
9989 </para>
9990 <literallayout class="monospaced">
9991 address_reply:
9992   driver = autoreply
9993 </literallayout>
9994 <para>
9995 This transport is used for handling automatic replies generated by users&#x2019;
9996 filter files.
9997 </para>
9998 </section>
9999 <section id="SECID57">
10000 <title>Default retry rule</title>
10001 <para>
10002 <indexterm role="concept">
10003 <primary>retry</primary>
10004 <secondary>default rule</secondary>
10005 </indexterm>
10006 <indexterm role="concept">
10007 <primary>default</primary>
10008 <secondary>retry rule</secondary>
10009 </indexterm>
10010 The retry section of the configuration file contains rules which affect the way
10011 Exim retries deliveries that cannot be completed at the first attempt. It is
10012 introduced by the line
10013 </para>
10014 <literallayout class="monospaced">
10015 begin retry
10016 </literallayout>
10017 <para>
10018 In the default configuration, there is just one rule, which applies to all
10019 errors:
10020 </para>
10021 <literallayout class="monospaced">
10022 *   *   F,2h,15m; G,16h,1h,1.5; F,4d,6h
10023 </literallayout>
10024 <para>
10025 This causes any temporarily failing address to be retried every 15 minutes for
10026 2 hours, then at intervals starting at one hour and increasing by a factor of
10027 1.5 until 16 hours have passed, then every 6 hours up to 4 days. If an address
10028 is not delivered after 4 days of temporary failure, it is bounced. The time is
10029 measured from first failure, not from the time the message was received.
10030 </para>
10031 <para>
10032 If the retry section is removed from the configuration, or is empty (that is,
10033 if no retry rules are defined), Exim will not retry deliveries. This turns
10034 temporary errors into permanent errors.
10035 </para>
10036 </section>
10037 <section id="SECID58">
10038 <title>Rewriting configuration</title>
10039 <para>
10040 The rewriting section of the configuration, introduced by
10041 </para>
10042 <literallayout class="monospaced">
10043 begin rewrite
10044 </literallayout>
10045 <para>
10046 contains rules for rewriting addresses in messages as they arrive. There are no
10047 rewriting rules in the default configuration file.
10048 </para>
10049 </section>
10050 <section id="SECTdefconfauth">
10051 <title>Authenticators configuration</title>
10052 <para>
10053 <indexterm role="concept">
10054 <primary>AUTH</primary>
10055 <secondary>configuration</secondary>
10056 </indexterm>
10057 The authenticators section of the configuration, introduced by
10058 </para>
10059 <literallayout class="monospaced">
10060 begin authenticators
10061 </literallayout>
10062 <para>
10063 defines mechanisms for the use of the SMTP AUTH command. The default
10064 configuration file contains two commented-out example authenticators
10065 which support plaintext username/password authentication using the
10066 standard PLAIN mechanism and the traditional but non-standard LOGIN
10067 mechanism, with Exim acting as the server. PLAIN and LOGIN are enough
10068 to support most MUA software.
10069 </para>
10070 <para>
10071 The example PLAIN authenticator looks like this:
10072 </para>
10073 <literallayout class="monospaced">
10074 #PLAIN:
10075 #  driver                  = plaintext
10076 #  server_set_id           = $auth2
10077 #  server_prompts          = :
10078 #  server_condition        = Authentication is not yet configured
10079 #  server_advertise_condition = ${if def:tls_in_cipher }
10080 </literallayout>
10081 <para>
10082 And the example LOGIN authenticator looks like this:
10083 </para>
10084 <literallayout class="monospaced">
10085 #LOGIN:
10086 #  driver                  = plaintext
10087 #  server_set_id           = $auth1
10088 #  server_prompts          = &lt;| Username: | Password:
10089 #  server_condition        = Authentication is not yet configured
10090 #  server_advertise_condition = ${if def:tls_in_cipher }
10091 </literallayout>
10092 <para>
10093 The <option>server_set_id</option> option makes Exim remember the authenticated username
10094 in <varname>$authenticated_id</varname>, which can be used later in ACLs or routers. The
10095 <option>server_prompts</option> option configures the <command>plaintext</command> authenticator so
10096 that it implements the details of the specific authentication mechanism,
10097 i.e. PLAIN or LOGIN. The <option>server_advertise_condition</option> setting controls
10098 when Exim offers authentication to clients; in the examples, this is only
10099 when TLS or SSL has been started, so to enable the authenticators you also
10100 need to add support for TLS as described in section <xref linkend="SECTdefconfmain"/>.
10101 </para>
10102 <para>
10103 The <option>server_condition</option> setting defines how to verify that the username and
10104 password are correct. In the examples it just produces an error message.
10105 To make the authenticators work, you can use a string expansion
10106 expression like one of the examples in chapter <xref linkend="CHAPplaintext"/>.
10107 </para>
10108 <para>
10109 Beware that the sequence of the parameters to PLAIN and LOGIN differ; the
10110 usercode and password are in different positions.
10111 Chapter <xref linkend="CHAPplaintext"/> covers both.
10112 </para>
10113 <para>
10114 <indexterm role="concept" startref="IIDconfiwal" class="endofrange"/>
10115 </para>
10116 </section>
10117 </chapter>
10118
10119 <chapter id="CHAPregexp">
10120 <title>Regular expressions</title>
10121 <para>
10122 <indexterm role="concept">
10123 <primary>regular expressions</primary>
10124 <secondary>library</secondary>
10125 </indexterm>
10126 <indexterm role="concept">
10127 <primary>PCRE2</primary>
10128 </indexterm>
10129 Exim supports the use of regular expressions in many of its options. It
10130 uses the PCRE2 regular expression library; this provides regular expression
10131 matching that is compatible with Perl 5. The syntax and semantics of
10132 regular expressions is discussed in
10133 online Perl manpages, in
10134 many Perl reference books, and also in
10135 Jeffrey Friedl&#x2019;s <emphasis>Mastering Regular Expressions</emphasis>, which is published by
10136 O&#x2019;Reilly (see <emphasis role="bold"><ulink url="http://www.oreilly.com/catalog/regex2/">http://www.oreilly.com/catalog/regex2/</ulink></emphasis>).
10137 </para>
10138 <para>
10139 The documentation for the syntax and semantics of the regular expressions that
10140 are supported by PCRE2 is included in the PCRE2 distribution, and no further
10141 description is included here. The PCRE2 functions are called from Exim using
10142 the default option settings (that is, with no PCRE2 options set), except that
10143 the PCRE2_CASELESS option is set when the matching is required to be
10144 case-insensitive.
10145 </para>
10146 <para>
10147 In most cases, when a regular expression is required in an Exim configuration,
10148 it has to start with a circumflex, in order to distinguish it from plain text
10149 or an <quote>ends with</quote> wildcard. In this example of a configuration setting, the
10150 second item in the colon-separated list is a regular expression.
10151 </para>
10152 <literallayout class="monospaced">
10153 domains = a.b.c : ^\\d{3} : *.y.z : ...
10154 </literallayout>
10155 <para>
10156 The doubling of the backslash is required because of string expansion that
10157 precedes interpretation &ndash; see section <xref linkend="SECTlittext"/> for more discussion
10158 of this issue, and a way of avoiding the need for doubling backslashes. The
10159 regular expression that is eventually used in this example contains just one
10160 backslash. The circumflex is included in the regular expression, and has the
10161 normal effect of <quote>anchoring</quote> it to the start of the string that is being
10162 matched.
10163 </para>
10164 <para>
10165 There are, however, two cases where a circumflex is not required for the
10166 recognition of a regular expression: these are the <option>match</option> condition in a
10167 string expansion, and the <option>matches</option> condition in an Exim filter file. In
10168 these cases, the relevant string is always treated as a regular expression; if
10169 it does not start with a circumflex, the expression is not anchored, and can
10170 match anywhere in the subject string.
10171 </para>
10172 <para>
10173 In all cases, if you want a regular expression to match at the end of a string,
10174 you must code the $ metacharacter to indicate this. For example:
10175 </para>
10176 <literallayout class="monospaced">
10177 domains = ^\\d{3}\\.example
10178 </literallayout>
10179 <para>
10180 matches the domain <emphasis>123.example</emphasis>, but it also matches <emphasis>123.example.com</emphasis>.
10181 You need to use:
10182 </para>
10183 <literallayout class="monospaced">
10184 domains = ^\\d{3}\\.example\$
10185 </literallayout>
10186 <para>
10187 if you want <emphasis>example</emphasis> to be the top-level domain. The backslash before the
10188 $ is needed because string expansion also interprets dollar characters.
10189 </para>
10190 </chapter>
10191
10192 <chapter id="CHAPfdlookup">
10193 <title>File and database lookups</title>
10194 <para>
10195 <indexterm role="concept" id="IIDfidalo1" class="startofrange">
10196 <primary>file</primary>
10197 <secondary>lookups</secondary>
10198 </indexterm>
10199 <indexterm role="concept" id="IIDfidalo2" class="startofrange">
10200 <primary>database</primary>
10201 <secondary>lookups</secondary>
10202 </indexterm>
10203 <indexterm role="concept">
10204 <primary>lookup</primary>
10205 <secondary>description of</secondary>
10206 </indexterm>
10207 Exim can be configured to look up data in files or databases as it processes
10208 messages. Two different kinds of syntax are used:
10209 </para>
10210 <orderedlist numeration="arabic">
10211 <listitem>
10212 <para>
10213 A string that is to be expanded may contain explicit lookup requests. These
10214 cause parts of the string to be replaced by data that is obtained from the
10215 lookup. Lookups of this type are conditional expansion items. Different results
10216 can be defined for the cases of lookup success and failure. See chapter
10217 <xref linkend="CHAPexpand"/>, where string expansions are described in detail.
10218 The key for the lookup is <emphasis role="bold">specified</emphasis> as part of the string expansion.
10219 </para>
10220 </listitem>
10221 <listitem>
10222 <para>
10223 Lists of domains, hosts, and email addresses can contain lookup requests as a
10224 way of avoiding excessively long linear lists. In this case, the data that is
10225 returned by the lookup is often (but not always) discarded; whether the lookup
10226 succeeds or fails is what really counts. These kinds of list are described in
10227 chapter <xref linkend="CHAPdomhosaddlists"/>.
10228 The key for the lookup is <emphasis role="bold">implicit</emphasis>,
10229 given by the context in which the list is expanded.
10230 </para>
10231 </listitem>
10232 </orderedlist>
10233 <para>
10234 String expansions, lists, and lookups interact with each other in such a way
10235 that there is no order in which to describe any one of them that does not
10236 involve references to the others. Each of these three chapters makes more sense
10237 if you have read the other two first. If you are reading this for the first
10238 time, be aware that some of it will make a lot more sense after you have read
10239 chapters <xref linkend="CHAPdomhosaddlists"/> and <xref linkend="CHAPexpand"/>.
10240 </para>
10241 <section id="SECID60">
10242 <title>Examples of different lookup syntax</title>
10243 <para>
10244 It is easy to confuse the two different kinds of lookup, especially as the
10245 lists that may contain the second kind are always expanded before being
10246 processed as lists. Therefore, they may also contain lookups of the first kind.
10247 Be careful to distinguish between the following two examples:
10248 </para>
10249 <literallayout class="monospaced">
10250 domains = ${lookup{$sender_host_address}lsearch{/some/file}}
10251 domains = lsearch;/some/file
10252 </literallayout>
10253 <para>
10254 The first uses a string expansion, the result of which must be a domain list.
10255 </para>
10256 <para revisionflag="changed">
10257 The key for an expansion-style lookup must be given explicitly.
10258 </para>
10259 <para>
10260 No strings have been specified for a successful or a failing lookup; the
10261 defaults in this case are the looked-up data and an empty string, respectively.
10262 The expansion takes place before the string is processed as a list, and the
10263 file that is searched could contain lines like this:
10264 </para>
10265 <literallayout class="monospaced">
10266 192.168.3.4: domain1:domain2:...
10267 192.168.1.9: domain3:domain4:...
10268 </literallayout>
10269 <para>
10270 When the lookup succeeds, the result of the expansion is a list of domains (and
10271 possibly other types of item that are allowed in domain lists).
10272 <indexterm role="concept">
10273 <primary>tainted data</primary>
10274 <secondary>de-tainting</secondary>
10275 </indexterm>
10276 <indexterm role="concept">
10277 <primary>de-tainting</primary>
10278 <secondary>using a lookup expansion"</secondary>
10279 </indexterm>
10280 The result of the expansion is not tainted.
10281 </para>
10282 <para>
10283 In the second example, the lookup is a single item in a domain list. It causes
10284 Exim to use a lookup to see if the domain that is being processed can be found
10285 in the file.
10286 The file could contains lines like this:
10287 </para>
10288 <literallayout class="monospaced">
10289 domain1:
10290 domain2:
10291 </literallayout>
10292 <para>
10293 Any data that follows the keys is not relevant when checking that the domain
10294 matches the list item.
10295 </para>
10296 <para revisionflag="changed">
10297 The key for a list-style lookup is implicit, from the lookup context, if
10298 the lookup is a single-key type (see below).
10299 For query-style lookup types the key must be given explicitly.
10300 </para>
10301 <para>
10302 It is possible, though no doubt confusing, to use both kinds of lookup at once.
10303 Consider a file containing lines like this:
10304 </para>
10305 <literallayout class="monospaced">
10306 192.168.5.6: lsearch;/another/file
10307 </literallayout>
10308 <para>
10309 If the value of <varname>$sender_host_address</varname> is 192.168.5.6, expansion of the
10310 first <option>domains</option> setting above generates the second setting, which therefore
10311 causes a second lookup to occur.
10312 </para>
10313 <para>
10314 The lookup type may optionally be followed by a comma
10315 and a comma-separated list of options.
10316 Each option is a <quote>name=value</quote> pair.
10317 Whether an option is meaningful depends on the lookup type.
10318 </para>
10319 <para>
10320 All lookups support the option <quote>cache=no_rd</quote>.
10321 If this is given then the cache that Exim manages for lookup results
10322 is not checked before doing the lookup.
10323 The result of the lookup is still written to the cache.
10324 </para>
10325 <para>
10326 The rest of this chapter describes the different lookup types that are
10327 available. Any of them can be used in any part of the configuration where a
10328 lookup is permitted.
10329 </para>
10330 </section>
10331 <section id="SECID61">
10332 <title>Lookup types</title>
10333 <para>
10334 <indexterm role="concept">
10335 <primary>lookup</primary>
10336 <secondary>types of</secondary>
10337 </indexterm>
10338 <indexterm role="concept">
10339 <primary>single-key lookup</primary>
10340 <secondary>definition of</secondary>
10341 </indexterm>
10342 Two different types of data lookup are implemented:
10343 </para>
10344 <itemizedlist>
10345 <listitem>
10346 <para>
10347 The <emphasis>single-key</emphasis> type requires the specification of a file in which to look,
10348 and a single key to search for. The key must be a non-empty string for the
10349 lookup to succeed. The lookup type determines how the file is searched.
10350 <indexterm role="concept">
10351 <primary>tainted data</primary>
10352 <secondary>single-key lookups</secondary>
10353 </indexterm>
10354 The file string may not be tainted.
10355 </para>
10356 <para>
10357 <indexterm role="concept">
10358 <primary>tainted data</primary>
10359 <secondary>de-tainting</secondary>
10360 </indexterm>
10361 <indexterm role="concept">
10362 <primary>de-tainting</primary>
10363 <secondary>using a single-key lookup</secondary>
10364 </indexterm>
10365 All single-key lookups support the option <quote>ret=key</quote>.
10366 If this is given and the lookup
10367 (either underlying implementation or cached value)
10368 returns data, the result is replaced with a non-tainted
10369 version of the lookup key.
10370 </para>
10371 </listitem>
10372 <listitem>
10373 <para>
10374 <indexterm role="concept">
10375 <primary>query-style lookup</primary>
10376 <secondary>definition of</secondary>
10377 </indexterm>
10378 The <emphasis>query-style</emphasis> type accepts a generalized database query. No particular
10379 key value is assumed by Exim for query-style lookups. You can use whichever
10380 Exim variables you need to construct the database query.
10381 <indexterm role="concept">
10382 <primary>tainted data</primary>
10383 <secondary>quoting for lookups</secondary>
10384 </indexterm>
10385 </para>
10386 <para revisionflag="changed">
10387 If tainted data is used in the query then it should be quuted by
10388 using the <emphasis role="bold">${quote_</emphasis>&lt;<emphasis>lookup-type</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis> expansion operator
10389 appropriate for the lookup.
10390 </para>
10391 </listitem>
10392 </itemizedlist>
10393 <para>
10394 The code for each lookup type is in a separate source file that is included in
10395 the binary of Exim only if the corresponding compile-time option is set. The
10396 default settings in <filename>src/EDITME</filename> are:
10397 </para>
10398 <literallayout class="monospaced">
10399 LOOKUP_DBM=yes
10400 LOOKUP_LSEARCH=yes
10401 </literallayout>
10402 <para>
10403 which means that only linear searching and DBM lookups are included by default.
10404 For some types of lookup (e.g. SQL databases), you need to install appropriate
10405 libraries and header files before building Exim.
10406 </para>
10407 </section>
10408 <section id="SECTsinglekeylookups">
10409 <title>Single-key lookup types</title>
10410 <para>
10411 <indexterm role="concept">
10412 <primary>lookup</primary>
10413 <secondary>single-key types</secondary>
10414 </indexterm>
10415 <indexterm role="concept">
10416 <primary>single-key lookup</primary>
10417 <secondary>list of types</secondary>
10418 </indexterm>
10419 The following single-key lookup types are implemented:
10420 </para>
10421 <itemizedlist>
10422 <listitem>
10423 <para>
10424 <indexterm role="concept">
10425 <primary>cdb</primary>
10426 <secondary>description of</secondary>
10427 </indexterm>
10428 <indexterm role="concept">
10429 <primary>lookup</primary>
10430 <secondary>cdb</secondary>
10431 </indexterm>
10432 <indexterm role="concept">
10433 <primary>binary zero</primary>
10434 <secondary>in lookup key</secondary>
10435 </indexterm>
10436 <command>cdb</command>: The given file is searched as a Constant DataBase file, using the key
10437 string without a terminating binary zero. The cdb format is designed for
10438 indexed files that are read frequently and never updated, except by total
10439 re-creation. As such, it is particularly suitable for large files containing
10440 aliases or other indexed data referenced by an MTA. Information about cdb and
10441 tools for building the files can be found in several places:
10442 </para>
10443 <literallayout>
10444 <emphasis role="bold"><ulink url="https://cr.yp.to/cdb.html">https://cr.yp.to/cdb.html</ulink></emphasis>
10445 <emphasis role="bold"><ulink url="https://www.corpit.ru/mjt/tinycdb.html">https://www.corpit.ru/mjt/tinycdb.html</ulink></emphasis>
10446 <emphasis role="bold"><ulink url="https://packages.debian.org/stable/utils/freecdb">https://packages.debian.org/stable/utils/freecdb</ulink></emphasis>
10447 <emphasis role="bold"><ulink url="https://github.com/philpennock/cdbtools">https://github.com/philpennock/cdbtools</ulink></emphasis> (in Go)
10448 </literallayout>
10449 <para>
10450 A cdb distribution is not needed in order to build Exim with cdb support,
10451 because the code for reading cdb files is included directly in Exim itself.
10452 However, no means of building or testing cdb files is provided with Exim, so
10453 you need to obtain a cdb distribution in order to do this.
10454 </para>
10455 </listitem>
10456 <listitem>
10457 <para>
10458 <indexterm role="concept">
10459 <primary>DBM</primary>
10460 <secondary>lookup type</secondary>
10461 </indexterm>
10462 <indexterm role="concept">
10463 <primary>lookup</primary>
10464 <secondary>dbm</secondary>
10465 </indexterm>
10466 <indexterm role="concept">
10467 <primary>binary zero</primary>
10468 <secondary>in lookup key</secondary>
10469 </indexterm>
10470 <command>dbm</command>: Calls to DBM library functions are used to extract data from the given
10471 DBM file by looking up the record with the given key. A terminating binary
10472 zero is included in the key that is passed to the DBM library. See section
10473 <xref linkend="SECTdb"/> for a discussion of DBM libraries.
10474 </para>
10475 <para>
10476 <indexterm role="concept">
10477 <primary>Berkeley DB library</primary>
10478 <secondary>file format</secondary>
10479 </indexterm>
10480 For all versions of Berkeley DB, Exim uses the DB_HASH style of database
10481 when building DBM files using the <option>exim_dbmbuild</option> utility. However, when
10482 using Berkeley DB versions 3 or 4, it opens existing databases for reading with
10483 the DB_UNKNOWN option. This enables it to handle any of the types of database
10484 that the library supports, and can be useful for accessing DBM files created by
10485 other applications. (For earlier DB versions, DB_HASH is always used.)
10486 </para>
10487 </listitem>
10488 <listitem>
10489 <para>
10490 <indexterm role="concept">
10491 <primary>lookup</primary>
10492 <secondary>dbmjz</secondary>
10493 </indexterm>
10494 <indexterm role="concept">
10495 <primary>lookup</primary>
10496 <secondary>dbm &ndash; embedded NULs</secondary>
10497 </indexterm>
10498 <indexterm role="concept">
10499 <primary>sasldb2</primary>
10500 </indexterm>
10501 <indexterm role="concept">
10502 <primary>dbmjz lookup type</primary>
10503 </indexterm>
10504 <command>dbmjz</command>: This is the same as <command>dbm</command>, except that the lookup key is
10505 interpreted as an Exim list; the elements of the list are joined together with
10506 ASCII NUL characters to form the lookup key.  An example usage would be to
10507 authenticate incoming SMTP calls using the passwords from Cyrus SASL&#x2019;s
10508 <filename>/etc/sasldb2</filename> file with the <command>gsasl</command> authenticator or Exim&#x2019;s own
10509 <command>cram_md5</command> authenticator.
10510 </para>
10511 </listitem>
10512 <listitem>
10513 <para>
10514 <indexterm role="concept">
10515 <primary>lookup</primary>
10516 <secondary>dbmnz</secondary>
10517 </indexterm>
10518 <indexterm role="concept">
10519 <primary>lookup</primary>
10520 <secondary>dbm &ndash; terminating zero</secondary>
10521 </indexterm>
10522 <indexterm role="concept">
10523 <primary>binary zero</primary>
10524 <secondary>in lookup key</secondary>
10525 </indexterm>
10526 <indexterm role="concept">
10527 <primary>Courier</primary>
10528 </indexterm>
10529 <indexterm role="concept">
10530 <primary><filename>/etc/userdbshadow.dat</filename></primary>
10531 </indexterm>
10532 <indexterm role="concept">
10533 <primary>dbmnz lookup type</primary>
10534 </indexterm>
10535 <command>dbmnz</command>: This is the same as <command>dbm</command>, except that a terminating binary zero
10536 is not included in the key that is passed to the DBM library. You may need this
10537 if you want to look up data in files that are created by or shared with some
10538 other application that does not use terminating zeros. For example, you need to
10539 use <command>dbmnz</command> rather than <command>dbm</command> if you want to authenticate incoming SMTP
10540 calls using the passwords from Courier&#x2019;s <filename>/etc/userdbshadow.dat</filename> file. Exim&#x2019;s
10541 utility program for creating DBM files (<emphasis>exim_dbmbuild</emphasis>) includes the zeros
10542 by default, but has an option to omit them (see section <xref linkend="SECTdbmbuild"/>).
10543 </para>
10544 </listitem>
10545 <listitem>
10546 <para>
10547 <indexterm role="concept">
10548 <primary>lookup</primary>
10549 <secondary>dsearch</secondary>
10550 </indexterm>
10551 <indexterm role="concept">
10552 <primary>dsearch lookup type</primary>
10553 </indexterm>
10554 <command>dsearch</command>: The given file must be an
10555 absolute
10556 directory path; this is searched for an entry
10557 whose name is the key by calling the <function>lstat()</function> function.
10558 The key may not
10559 contain any forward slash characters.
10560 If <function>lstat()</function> succeeds then so does the lookup.
10561 <indexterm role="concept">
10562 <primary>tainted data</primary>
10563 <secondary>dsearch result</secondary>
10564 </indexterm>
10565 The result is regarded as untainted.
10566 </para>
10567 <para>
10568 Options for the lookup can be given by appending them after the word "dsearch",
10569 separated by a comma.  Options, if present, are a comma-separated list having
10570 each element starting with a tag name and an equals.
10571 </para>
10572 <para>
10573 Two options are supported, for the return value and for filtering match
10574 candidates.
10575 The "ret" option requests an alternate result value of
10576 the entire path for the entry. Example:
10577 </para>
10578 <literallayout class="monospaced">
10579 ${lookup {passwd} dsearch,ret=full {/etc}}
10580 </literallayout>
10581 <para>
10582 The default result is just the requested entry.
10583 The "filter" option requests that only directory entries of a given type
10584 are matched. The match value is one of "file", "dir" or "subdir" (the latter
10585 not matching "." or ".."). Example:
10586 </para>
10587 <literallayout class="monospaced">
10588 ${lookup {passwd} dsearch,filter=file {/etc}}
10589 </literallayout>
10590 <para>
10591 The default matching is for any entry type, including directories
10592 and symlinks.
10593 </para>
10594 <para>
10595 An example of how this
10596 lookup can be used to support virtual domains is given in section
10597 <xref linkend="SECTvirtualdomains"/>.
10598 </para>
10599 </listitem>
10600 <listitem>
10601 <para>
10602 <indexterm role="concept">
10603 <primary>lookup</primary>
10604 <secondary>iplsearch</secondary>
10605 </indexterm>
10606 <indexterm role="concept">
10607 <primary>iplsearch lookup type</primary>
10608 </indexterm>
10609 <command>iplsearch</command>: The given file is a text file containing keys and data. A key is
10610 terminated by a colon or white space or the end of the line. The keys in the
10611 file must be IP addresses, or IP addresses with CIDR masks. Keys that involve
10612 IPv6 addresses must be enclosed in quotes to prevent the first internal colon
10613 being interpreted as a key terminator. For example:
10614 </para>
10615 <literallayout class="monospaced">
10616 1.2.3.4:           data for 1.2.3.4
10617 192.168.0.0/16:    data for 192.168.0.0/16
10618 "abcd::cdab":      data for abcd::cdab
10619 "abcd:abcd::/32"   data for abcd:abcd::/32
10620 </literallayout>
10621 <para>
10622 The key for an <command>iplsearch</command> lookup must be an IP address (without a mask). The
10623 file is searched linearly, using the CIDR masks where present, until a matching
10624 key is found. The first key that matches is used; there is no attempt to find a
10625 <quote>best</quote> match. Apart from the way the keys are matched, the processing for
10626 <command>iplsearch</command> is the same as for <command>lsearch</command>.
10627 </para>
10628 <para>
10629 <emphasis role="bold">Warning 1</emphasis>: Unlike most other single-key lookup types, a file of data for
10630 <command>iplsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10631 lookup types support only literal keys.
10632 </para>
10633 <para>
10634 <emphasis role="bold">Warning 2</emphasis>: In a host list, you must always use <command>net-iplsearch</command> so that
10635 the implicit key is the host&#x2019;s IP address rather than its name (see section
10636 <xref linkend="SECThoslispatsikey"/>).
10637 </para>
10638 <para>
10639 <emphasis role="bold">Warning 3</emphasis>: Do not use an IPv4-mapped IPv6 address for a key; use the
10640 IPv4, in dotted-quad form. (Exim converts IPv4-mapped IPv6 addresses to this
10641 notation before executing the lookup.)
10642 </para>
10643 <para>
10644 One option is supported, "ret=full", to request the return of the entire line
10645 rather than omitting the key portion.
10646 Note however that the key portion will have been de-quoted.
10647 </para>
10648 </listitem>
10649 <listitem>
10650 <para>
10651 <indexterm role="concept">
10652 <primary>lookup</primary>
10653 <secondary>json</secondary>
10654 </indexterm>
10655 <indexterm role="concept">
10656 <primary>json</primary>
10657 <secondary>lookup type</secondary>
10658 </indexterm>
10659 <indexterm role="concept">
10660 <primary>JSON</primary>
10661 <secondary>expansions</secondary>
10662 </indexterm>
10663 <command>json</command>: The given file is a text file with a JSON structure.
10664 An element of the structure is extracted, defined by the search key.
10665 The key is a list of subelement selectors
10666 (colon-separated by default but changeable in the usual way)
10667 which are applied in turn to select smaller and smaller portions
10668 of the JSON structure.
10669 If a selector is numeric, it must apply to a JSON array; the (zero-based)
10670 nunbered array element is selected.
10671 Otherwise it must apply to a JSON object; the named element is selected.
10672 The final resulting element can be a simple JSON type or a JSON object
10673 or array; for the latter two a string-representation of the JSON
10674 is returned.
10675 For elements of type string, the returned value is de-quoted.
10676 </para>
10677 </listitem>
10678 <listitem>
10679 <para>
10680 <indexterm role="concept">
10681 <primary>LMDB</primary>
10682 </indexterm>
10683 <indexterm role="concept">
10684 <primary>lookup</primary>
10685 <secondary>lmdb</secondary>
10686 </indexterm>
10687 <indexterm role="concept">
10688 <primary>database</primary>
10689 <secondary>lmdb</secondary>
10690 </indexterm>
10691 <command>lmdb</command>: The given file is an LMDB database.
10692 LMDB is a memory-mapped key-value store,
10693 with API modeled loosely on that of BerkeleyDB.
10694 See <emphasis role="bold"><ulink url="https://symas.com/products/lightning-memory-mapped-database/">https://symas.com/products/lightning-memory-mapped-database/</ulink></emphasis>
10695 for the feature set and operation modes.
10696 </para>
10697 <para>
10698 Exim provides read-only access via the LMDB C library.
10699 The library can be obtained from <emphasis role="bold"><ulink url="https://github.com/LMDB/lmdb">https://github.com/LMDB/lmdb</ulink></emphasis>
10700 or your operating system package repository.
10701 To enable LMDB support in Exim set LOOKUP_LMDB=yes in <filename>Local/Makefile</filename>.
10702 </para>
10703 <para>
10704 You will need to separately create the LMDB database file,
10705 possibly using the <quote>mdb_load</quote> utility.
10706 </para>
10707 </listitem>
10708 <listitem>
10709 <para>
10710 <indexterm role="concept">
10711 <primary>linear search</primary>
10712 </indexterm>
10713 <indexterm role="concept">
10714 <primary>lookup</primary>
10715 <secondary>lsearch</secondary>
10716 </indexterm>
10717 <indexterm role="concept">
10718 <primary>lsearch lookup type</primary>
10719 </indexterm>
10720 <indexterm role="concept">
10721 <primary>case sensitivity</primary>
10722 <secondary>in lsearch lookup</secondary>
10723 </indexterm>
10724 <command>lsearch</command>: The given file is a text file that is searched linearly for a
10725 line beginning with the search key, terminated by a colon or white space or the
10726 end of the line. The search is case-insensitive; that is, upper and lower case
10727 letters are treated as the same. The first occurrence of the key that is found
10728 in the file is used.
10729 </para>
10730 <para>
10731 White space between the key and the colon is permitted. The remainder of the
10732 line, with leading and trailing white space removed, is the data. This can be
10733 continued onto subsequent lines by starting them with any amount of white
10734 space, but only a single space character is included in the data at such a
10735 junction. If the data begins with a colon, the key must be terminated by a
10736 colon, for example:
10737 </para>
10738 <literallayout class="monospaced">
10739 baduser:  :fail:
10740 </literallayout>
10741 <para>
10742 Empty lines and lines beginning with # are ignored, even if they occur in the
10743 middle of an item. This is the traditional textual format of alias files. Note
10744 that the keys in an <command>lsearch</command> file are literal strings. There is no
10745 wildcarding of any kind.
10746 </para>
10747 <para>
10748 <indexterm role="concept">
10749 <primary>lookup</primary>
10750 <secondary>lsearch &ndash; colons in keys</secondary>
10751 </indexterm>
10752 <indexterm role="concept">
10753 <primary>white space</primary>
10754 <secondary>in lsearch key</secondary>
10755 </indexterm>
10756 In most <command>lsearch</command> files, keys are not required to contain colons or #
10757 characters, or white space. However, if you need this feature, it is available.
10758 If a key begins with a doublequote character, it is terminated only by a
10759 matching quote (or end of line), and the normal escaping rules apply to its
10760 contents (see section <xref linkend="SECTstrings"/>). An optional colon is permitted after
10761 quoted keys (exactly as for unquoted keys). There is no special handling of
10762 quotes for the data part of an <command>lsearch</command> line.
10763 </para>
10764 </listitem>
10765 <listitem>
10766 <para>
10767 <indexterm role="concept">
10768 <primary>NIS lookup type</primary>
10769 </indexterm>
10770 <indexterm role="concept">
10771 <primary>lookup</primary>
10772 <secondary>NIS</secondary>
10773 </indexterm>
10774 <indexterm role="concept">
10775 <primary>binary zero</primary>
10776 <secondary>in lookup key</secondary>
10777 </indexterm>
10778 <command>nis</command>: The given file is the name of a NIS map, and a NIS lookup is done with
10779 the given key, without a terminating binary zero. There is a variant called
10780 <command>nis0</command> which does include the terminating binary zero in the key. This is
10781 reportedly needed for Sun-style alias files. Exim does not recognize NIS
10782 aliases; the full map names must be used.
10783 </para>
10784 </listitem>
10785 <listitem>
10786 <para>
10787 <indexterm role="concept">
10788 <primary>wildlsearch lookup type</primary>
10789 </indexterm>
10790 <indexterm role="concept">
10791 <primary>lookup</primary>
10792 <secondary>wildlsearch</secondary>
10793 </indexterm>
10794 <indexterm role="concept">
10795 <primary>nwildlsearch lookup type</primary>
10796 </indexterm>
10797 <indexterm role="concept">
10798 <primary>lookup</primary>
10799 <secondary>nwildlsearch</secondary>
10800 </indexterm>
10801 <command>wildlsearch</command> or <command>nwildlsearch</command>: These search a file linearly, like
10802 <command>lsearch</command>, but instead of being interpreted as a literal string, each key in
10803 the file may be wildcarded. The difference between these two lookup types is
10804 that for <command>wildlsearch</command>, each key in the file is string-expanded before being
10805 used, whereas for <command>nwildlsearch</command>, no expansion takes place.
10806 </para>
10807 <para>
10808 <indexterm role="concept">
10809 <primary>case sensitivity</primary>
10810 <secondary>in (n)wildlsearch lookup</secondary>
10811 </indexterm>
10812 Like <command>lsearch</command>, the testing is done case-insensitively. However, keys in the
10813 file that are regular expressions can be made case-sensitive by the use of
10814 <literal>(-i)</literal> within the pattern. The following forms of wildcard are recognized:
10815 </para>
10816 <orderedlist numeration="arabic">
10817 <listitem>
10818 <para>
10819 The string may begin with an asterisk to mean <quote>ends with</quote>. For example:
10820 </para>
10821 <literallayout class="monospaced">
10822     *.a.b.c       data for anything.a.b.c
10823     *fish         data for anythingfish
10824 </literallayout>
10825 </listitem>
10826 <listitem>
10827 <para>
10828 The string may begin with a circumflex to indicate a regular expression. For
10829 example, for <command>wildlsearch</command>:
10830 </para>
10831 <literallayout class="monospaced">
10832     ^\N\d+\.a\.b\N    data for &lt;digits&gt;.a.b
10833 </literallayout>
10834 <para>
10835 Note the use of <literal>\N</literal> to disable expansion of the contents of the regular
10836 expression. If you are using <command>nwildlsearch</command>, where the keys are not
10837 string-expanded, the equivalent entry is:
10838 </para>
10839 <literallayout class="monospaced">
10840     ^\d+\.a\.b        data for &lt;digits&gt;.a.b
10841 </literallayout>
10842 <para>
10843 The case-insensitive flag is set at the start of compiling the regular
10844 expression, but it can be turned off by using <literal>(-i)</literal> at an appropriate point.
10845 For example, to make the entire pattern case-sensitive:
10846 </para>
10847 <literallayout class="monospaced">
10848     ^(?-i)\d+\.a\.b        data for &lt;digits&gt;.a.b
10849 </literallayout>
10850 <para>
10851 If the regular expression contains white space or colon characters, you must
10852 either quote it (see <command>lsearch</command> above), or represent these characters in other
10853 ways. For example, <literal>\s</literal> can be used for white space and <literal>\x3A</literal> for a
10854 colon. This may be easier than quoting, because if you quote, you have to
10855 escape all the backslashes inside the quotes.
10856 </para>
10857 <para>
10858 <emphasis role="bold">Note</emphasis>: It is not possible to capture substrings in a regular expression
10859 match for later use, because the results of all lookups are cached. If a lookup
10860 is repeated, the result is taken from the cache, and no actual pattern matching
10861 takes place. The values of all the numeric variables are unset after a
10862 <command>(n)wildlsearch</command> match.
10863 </para>
10864 </listitem>
10865 <listitem>
10866 <para>
10867 Although I cannot see it being of much use, the general matching function that
10868 is used to implement <command>(n)wildlsearch</command> means that the string may begin with a
10869 lookup name terminated by a semicolon, and followed by lookup data. For
10870 example:
10871 </para>
10872 <literallayout class="monospaced">
10873     cdb;/some/file  data for keys that match the file
10874 </literallayout>
10875 <para>
10876 The data that is obtained from the nested lookup is discarded.
10877 </para>
10878 </listitem>
10879 </orderedlist>
10880 <para>
10881 Keys that do not match any of these patterns are interpreted literally. The
10882 continuation rules for the data are the same as for <command>lsearch</command>, and keys may
10883 be followed by optional colons.
10884 </para>
10885 <para>
10886 <emphasis role="bold">Warning</emphasis>: Unlike most other single-key lookup types, a file of data for
10887 <command>(n)wildlsearch</command> can <emphasis>not</emphasis> be turned into a DBM or cdb file, because those
10888 lookup types support only literal keys.
10889 </para>
10890 </listitem>
10891 <listitem>
10892 <para>
10893 <indexterm role="concept">
10894 <primary>spf lookup type</primary>
10895 </indexterm>
10896 <indexterm role="concept">
10897 <primary>lookup</primary>
10898 <secondary>spf</secondary>
10899 </indexterm>
10900 <command>spf</command>: If Exim is built with SPF support, manual lookups can be done
10901 (as opposed to the standard ACL condition method).
10902 For details see section <xref linkend="SECSPF"/>.
10903 </para>
10904 </listitem>
10905 </itemizedlist>
10906 </section>
10907 <section id="SECTquerystylelookups">
10908 <title>Query-style lookup types</title>
10909 <para>
10910 <indexterm role="concept">
10911 <primary>lookup</primary>
10912 <secondary>query-style types</secondary>
10913 </indexterm>
10914 <indexterm role="concept">
10915 <primary>query-style lookup</primary>
10916 <secondary>list of types</secondary>
10917 </indexterm>
10918 The supported query-style lookup types are listed below. Further details about
10919 many of them are given in later sections.
10920 </para>
10921 <itemizedlist>
10922 <listitem>
10923 <para>
10924 <indexterm role="concept">
10925 <primary>DNS</primary>
10926 <secondary>as a lookup type</secondary>
10927 </indexterm>
10928 <indexterm role="concept">
10929 <primary>lookup</primary>
10930 <secondary>DNS</secondary>
10931 </indexterm>
10932 <command>dnsdb</command>: This does a DNS search for one or more records whose domain names
10933 are given in the supplied query. The resulting data is the contents of the
10934 records. See section <xref linkend="SECTdnsdb"/>.
10935 </para>
10936 </listitem>
10937 <listitem>
10938 <para>
10939 <indexterm role="concept">
10940 <primary>InterBase lookup type</primary>
10941 </indexterm>
10942 <indexterm role="concept">
10943 <primary>lookup</primary>
10944 <secondary>InterBase</secondary>
10945 </indexterm>
10946 <command>ibase</command>: This does a lookup in an InterBase database.
10947 </para>
10948 </listitem>
10949 <listitem>
10950 <para>
10951 <indexterm role="concept">
10952 <primary>LDAP</primary>
10953 <secondary>lookup type</secondary>
10954 </indexterm>
10955 <indexterm role="concept">
10956 <primary>lookup</primary>
10957 <secondary>LDAP</secondary>
10958 </indexterm>
10959 <command>ldap</command>: This does an LDAP lookup using a query in the form of a URL, and
10960 returns attributes from a single entry. There is a variant called <command>ldapm</command>
10961 that permits values from multiple entries to be returned. A third variant
10962 called <command>ldapdn</command> returns the Distinguished Name of a single entry instead of
10963 any attribute values. See section <xref linkend="SECTldap"/>.
10964 </para>
10965 </listitem>
10966 <listitem>
10967 <para>
10968 <indexterm role="concept">
10969 <primary>MySQL</primary>
10970 <secondary>lookup type</secondary>
10971 </indexterm>
10972 <indexterm role="concept">
10973 <primary>lookup</primary>
10974 <secondary>MySQL</secondary>
10975 </indexterm>
10976 <command>mysql</command>: The format of the query is an SQL statement that is passed to a
10977 MySQL database. See section <xref linkend="SECTsql"/>.
10978 </para>
10979 </listitem>
10980 <listitem>
10981 <para>
10982 <indexterm role="concept">
10983 <primary>NIS+ lookup type</primary>
10984 </indexterm>
10985 <indexterm role="concept">
10986 <primary>lookup</primary>
10987 <secondary>NIS+</secondary>
10988 </indexterm>
10989 <command>nisplus</command>: This does a NIS+ lookup using a query that can specify the name of
10990 the field to be returned. See section <xref linkend="SECTnisplus"/>.
10991 </para>
10992 </listitem>
10993 <listitem>
10994 <para>
10995 <indexterm role="concept">
10996 <primary>Oracle</primary>
10997 <secondary>lookup type</secondary>
10998 </indexterm>
10999 <indexterm role="concept">
11000 <primary>lookup</primary>
11001 <secondary>Oracle</secondary>
11002 </indexterm>
11003 <command>oracle</command>: The format of the query is an SQL statement that is passed to an
11004 Oracle database. See section <xref linkend="SECTsql"/>.
11005 </para>
11006 </listitem>
11007 <listitem>
11008 <para>
11009 <indexterm role="concept">
11010 <primary>lookup</primary>
11011 <secondary>passwd</secondary>
11012 </indexterm>
11013 <indexterm role="concept">
11014 <primary>passwd lookup type</primary>
11015 </indexterm>
11016 <indexterm role="concept">
11017 <primary><filename>/etc/passwd</filename></primary>
11018 </indexterm>
11019 <command>passwd</command> is a query-style lookup with queries that are just user names. The
11020 lookup calls <function>getpwnam()</function> to interrogate the system password data, and on
11021 success, the result string is the same as you would get from an <command>lsearch</command>
11022 lookup on a traditional <filename>/etc/passwd file</filename>, though with <literal>*</literal> for the
11023 password value. For example:
11024 </para>
11025 <literallayout class="monospaced">
11026 *:42:42:King Rat:/home/kr:/bin/bash
11027 </literallayout>
11028 </listitem>
11029 <listitem>
11030 <para>
11031 <indexterm role="concept">
11032 <primary>PostgreSQL lookup type</primary>
11033 </indexterm>
11034 <indexterm role="concept">
11035 <primary>lookup</primary>
11036 <secondary>PostgreSQL</secondary>
11037 </indexterm>
11038 <command>pgsql</command>: The format of the query is an SQL statement that is passed to a
11039 PostgreSQL database. See section <xref linkend="SECTsql"/>.
11040 </para>
11041 </listitem>
11042 <listitem>
11043 <para>
11044 <indexterm role="concept">
11045 <primary>Redis lookup type</primary>
11046 </indexterm>
11047 <indexterm role="concept">
11048 <primary>lookup</primary>
11049 <secondary>Redis</secondary>
11050 </indexterm>
11051 <command>redis</command>: The format of the query is either a simple get or simple set,
11052 passed to a Redis database. See section <xref linkend="SECTsql"/>.
11053 </para>
11054 </listitem>
11055 <listitem>
11056 <para>
11057 <indexterm role="concept">
11058 <primary>sqlite lookup type</primary>
11059 </indexterm>
11060 <indexterm role="concept">
11061 <primary>lookup</primary>
11062 <secondary>sqlite</secondary>
11063 </indexterm>
11064 <command>sqlite</command>: The format of the query is
11065 an SQL statement that is passed to an SQLite database. See section <xref linkend="SECTsqlite"/>.
11066 </para>
11067 </listitem>
11068 <listitem>
11069 <para>
11070 <command>testdb</command>: This is a lookup type that is used for testing Exim. It is
11071 not likely to be useful in normal operation.
11072 </para>
11073 </listitem>
11074 <listitem>
11075 <para>
11076 <indexterm role="concept">
11077 <primary>whoson lookup type</primary>
11078 </indexterm>
11079 <indexterm role="concept">
11080 <primary>lookup</primary>
11081 <secondary>whoson</secondary>
11082 </indexterm>
11083 <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
11084 allows a server to check whether a particular (dynamically allocated) IP
11085 address is currently allocated to a known (trusted) user and, optionally, to
11086 obtain the identity of the said user. For SMTP servers, <emphasis>Whoson</emphasis> was popular
11087 at one time for <quote>POP before SMTP</quote> authentication, but that approach has been
11088 superseded by SMTP authentication. In Exim, <emphasis>Whoson</emphasis> can be used to implement
11089 <quote>POP before SMTP</quote> checking using ACL statements such as
11090 </para>
11091 <literallayout class="monospaced">
11092 require condition = \
11093   ${lookup whoson {$sender_host_address}{yes}{no}}
11094 </literallayout>
11095 <para>
11096 The query consists of a single IP address. The value returned is the name of
11097 the authenticated user, which is stored in the variable <varname>$value</varname>. However, in
11098 this example, the data in <varname>$value</varname> is not used; the result of the lookup is
11099 one of the fixed strings <quote>yes</quote> or <quote>no</quote>.
11100 </para>
11101 </listitem>
11102 </itemizedlist>
11103 </section>
11104 <section id="SECID63">
11105 <title>Temporary errors in lookups</title>
11106 <para>
11107 <indexterm role="concept">
11108 <primary>lookup</primary>
11109 <secondary>temporary error in</secondary>
11110 </indexterm>
11111 Lookup functions can return temporary error codes if the lookup cannot be
11112 completed. For example, an SQL or LDAP database might be unavailable. For this
11113 reason, it is not advisable to use a lookup that might do this for critical
11114 options such as a list of local domains.
11115 </para>
11116 <para>
11117 When a lookup cannot be completed in a router or transport, delivery
11118 of the message (to the relevant address) is deferred, as for any other
11119 temporary error. In other circumstances Exim may assume the lookup has failed,
11120 or may give up altogether.
11121 </para>
11122 </section>
11123 <section id="SECTdefaultvaluelookups">
11124 <title>Default values in single-key lookups</title>
11125 <para>
11126 <indexterm role="concept">
11127 <primary>wildcard lookups</primary>
11128 </indexterm>
11129 <indexterm role="concept">
11130 <primary>lookup</primary>
11131 <secondary>default values</secondary>
11132 </indexterm>
11133 <indexterm role="concept">
11134 <primary>lookup</primary>
11135 <secondary>wildcard</secondary>
11136 </indexterm>
11137 <indexterm role="concept">
11138 <primary>lookup</primary>
11139 <secondary>* added to type</secondary>
11140 </indexterm>
11141 <indexterm role="concept">
11142 <primary>default</primary>
11143 <secondary>in single-key lookups</secondary>
11144 </indexterm>
11145 In this context, a <quote>default value</quote> is a value specified by the administrator
11146 that is to be used if a lookup fails.
11147 </para>
11148 <para>
11149 <emphasis role="bold">Note:</emphasis> This section applies only to single-key lookups. For query-style
11150 lookups, the facilities of the query language must be used. An attempt to
11151 specify a default for a query-style lookup provokes an error.
11152 </para>
11153 <para>
11154 If <quote>*</quote> is added to a single-key lookup type (for example, <option>lsearch*</option>)
11155 and the initial lookup fails, the key <quote>*</quote> is looked up in the file to
11156 provide a default value. See also the section on partial matching below.
11157 </para>
11158 <para>
11159 <indexterm role="concept">
11160 <primary>*@ with single-key lookup</primary>
11161 </indexterm>
11162 <indexterm role="concept">
11163 <primary>lookup</primary>
11164 <secondary>*@ added to type</secondary>
11165 </indexterm>
11166 <indexterm role="concept">
11167 <primary>alias file</primary>
11168 <secondary>per-domain default</secondary>
11169 </indexterm>
11170 Alternatively, if <quote>*@</quote> is added to a single-key lookup type (for example
11171 <option>dbm*@</option>) then, if the initial lookup fails and the key contains an @
11172 character, a second lookup is done with everything before the last @ replaced
11173 by *. This makes it possible to provide per-domain defaults in alias files
11174 that include the domains in the keys. If the second lookup fails (or doesn&#x2019;t
11175 take place because there is no @ in the key), <quote>*</quote> is looked up.
11176 For example, a <command>redirect</command> router might contain:
11177 </para>
11178 <literallayout class="monospaced">
11179 data = ${lookup{$local_part@$domain}lsearch*@{/etc/mix-aliases}}
11180 </literallayout>
11181 <para>
11182 Suppose the address that is being processed is <emphasis>jane@eyre.example</emphasis>. Exim
11183 looks up these keys, in this order:
11184 </para>
11185 <literallayout class="monospaced">
11186 jane@eyre.example
11187 *@eyre.example
11188 *
11189 </literallayout>
11190 <para>
11191 The data is taken from whichever key it finds first. <emphasis role="bold">Note</emphasis>: In an
11192 <command>lsearch</command> file, this does not mean the first of these keys in the file. A
11193 complete scan is done for each key, and only if it is not found at all does
11194 Exim move on to try the next key.
11195 </para>
11196 </section>
11197 <section id="SECTpartiallookup">
11198 <title>Partial matching in single-key lookups</title>
11199 <para>
11200 <indexterm role="concept">
11201 <primary>partial matching</primary>
11202 </indexterm>
11203 <indexterm role="concept">
11204 <primary>wildcard lookups</primary>
11205 </indexterm>
11206 <indexterm role="concept">
11207 <primary>lookup</primary>
11208 <secondary>partial matching</secondary>
11209 </indexterm>
11210 <indexterm role="concept">
11211 <primary>lookup</primary>
11212 <secondary>wildcard</secondary>
11213 </indexterm>
11214 <indexterm role="concept">
11215 <primary>asterisk</primary>
11216 <secondary>in search type</secondary>
11217 </indexterm>
11218 The normal operation of a single-key lookup is to search the file for an exact
11219 match with the given key. However, in a number of situations where domains are
11220 being looked up, it is useful to be able to do partial matching. In this case,
11221 information in the file that has a key starting with <quote>*.</quote> is matched by any
11222 domain that ends with the components that follow the full stop. For example, if
11223 a key in a DBM file is
11224 </para>
11225 <literallayout class="monospaced">
11226 *.dates.fict.example
11227 </literallayout>
11228 <para>
11229 then when partial matching is enabled this is matched by (amongst others)
11230 <emphasis>2001.dates.fict.example</emphasis> and <emphasis>1984.dates.fict.example</emphasis>. It is also matched
11231 by <emphasis>dates.fict.example</emphasis>, if that does not appear as a separate key in the
11232 file.
11233 </para>
11234 <para>
11235 <emphasis role="bold">Note</emphasis>: Partial matching is not available for query-style lookups. It is
11236 also not available for any lookup items in address lists (see section
11237 <xref linkend="SECTaddresslist"/>).
11238 </para>
11239 <para>
11240 Partial matching is implemented by doing a series of separate lookups using
11241 keys constructed by modifying the original subject key. This means that it can
11242 be used with any of the single-key lookup types, provided that
11243 partial matching keys
11244 beginning with a special prefix (default <quote>*.</quote>) are included in the data file.
11245 Keys in the file that do not begin with the prefix are matched only by
11246 unmodified subject keys when partial matching is in use.
11247 </para>
11248 <para>
11249 Partial matching is requested by adding the string <quote>partial-</quote> to the front of
11250 the name of a single-key lookup type, for example, <option>partial-dbm</option>. When this
11251 is done, the subject key is first looked up unmodified; if that fails, <quote>*.</quote>
11252 is added at the start of the subject key, and it is looked up again. If that
11253 fails, further lookups are tried with dot-separated components removed from the
11254 start of the subject key, one-by-one, and <quote>*.</quote> added on the front of what
11255 remains.
11256 </para>
11257 <para>
11258 A minimum number of two non-* components are required. This can be adjusted
11259 by including a number before the hyphen in the search type. For example,
11260 <option>partial3-lsearch</option> specifies a minimum of three non-* components in the
11261 modified keys. Omitting the number is equivalent to <quote>partial2-</quote>. If the
11262 subject key is <emphasis>2250.dates.fict.example</emphasis> then the following keys are looked
11263 up when the minimum number of non-* components is two:
11264 </para>
11265 <literallayout class="monospaced">
11266 2250.dates.fict.example
11267 *.2250.dates.fict.example
11268 *.dates.fict.example
11269 *.fict.example
11270 </literallayout>
11271 <para>
11272 As soon as one key in the sequence is successfully looked up, the lookup
11273 finishes.
11274 </para>
11275 <para>
11276 <indexterm role="concept">
11277 <primary>lookup</primary>
11278 <secondary>partial matching &ndash; changing prefix</secondary>
11279 </indexterm>
11280 <indexterm role="concept">
11281 <primary>prefix</primary>
11282 <secondary>for partial matching</secondary>
11283 </indexterm>
11284 The use of <quote>*.</quote> as the partial matching prefix is a default that can be
11285 changed. The motivation for this feature is to allow Exim to operate with file
11286 formats that are used by other MTAs. A different prefix can be supplied in
11287 parentheses instead of the hyphen after <quote>partial</quote>. For example:
11288 </para>
11289 <literallayout class="monospaced">
11290 domains = partial(.)lsearch;/some/file
11291 </literallayout>
11292 <para>
11293 In this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
11294 <literal>a.b.c</literal>, <literal>.a.b.c</literal>, and <literal>.b.c</literal> (the default minimum of 2 non-wild
11295 components is unchanged). The prefix may consist of any punctuation characters
11296 other than a closing parenthesis. It may be empty, for example:
11297 </para>
11298 <literallayout class="monospaced">
11299 domains = partial1()cdb;/some/file
11300 </literallayout>
11301 <para>
11302 For this example, if the domain is <emphasis>a.b.c</emphasis>, the sequence of lookups is
11303 <literal>a.b.c</literal>, <literal>b.c</literal>, and <literal>c</literal>.
11304 </para>
11305 <para>
11306 If <quote>partial0</quote> is specified, what happens at the end (when the lookup with
11307 just one non-wild component has failed, and the original key is shortened right
11308 down to the null string) depends on the prefix:
11309 </para>
11310 <itemizedlist>
11311 <listitem>
11312 <para>
11313 If the prefix has zero length, the whole lookup fails.
11314 </para>
11315 </listitem>
11316 <listitem>
11317 <para>
11318 If the prefix has length 1, a lookup for just the prefix is done. For
11319 example, the final lookup for <quote>partial0(.)</quote> is for <literal>.</literal> alone.
11320 </para>
11321 </listitem>
11322 <listitem>
11323 <para>
11324 Otherwise, if the prefix ends in a dot, the dot is removed, and the
11325 remainder is looked up. With the default prefix, therefore, the final lookup is
11326 for <quote>*</quote> on its own.
11327 </para>
11328 </listitem>
11329 <listitem>
11330 <para>
11331 Otherwise, the whole prefix is looked up.
11332 </para>
11333 </listitem>
11334 </itemizedlist>
11335 <para>
11336 If the search type ends in <quote>*</quote> or <quote>*@</quote> (see section
11337 <xref linkend="SECTdefaultvaluelookups"/> above), the search for an ultimate default that
11338 this implies happens after all partial lookups have failed. If <quote>partial0</quote> is
11339 specified, adding <quote>*</quote> to the search type has no effect with the default
11340 prefix, because the <quote>*</quote> key is already included in the sequence of partial
11341 lookups. However, there might be a use for lookup types such as
11342 <quote>partial0(.)lsearch*</quote>.
11343 </para>
11344 <para>
11345 The use of <quote>*</quote> in lookup partial matching differs from its use as a wildcard
11346 in domain lists and the like. Partial matching works only in terms of
11347 dot-separated components; a key such as <literal>*fict.example</literal>
11348 in a database file is useless, because the asterisk in a partial matching
11349 subject key is always followed by a dot.
11350 </para>
11351 </section>
11352 <section id="SECID64">
11353 <title>Lookup caching</title>
11354 <para>
11355 <indexterm role="concept">
11356 <primary>lookup</primary>
11357 <secondary>caching</secondary>
11358 </indexterm>
11359 <indexterm role="concept">
11360 <primary>caching</primary>
11361 <secondary>lookup data</secondary>
11362 </indexterm>
11363 Exim caches all lookup results in order to avoid needless repetition of
11364 lookups. However, because (apart from the daemon) Exim operates as a collection
11365 of independent, short-lived processes, this caching applies only within a
11366 single Exim process. There is no inter-process lookup caching facility.
11367 </para>
11368 <para>
11369 If an option <quote>cache=no_rd</quote> is used on the lookup then
11370 the cache is only written to, cached data is not used for the operation
11371 and a real lookup is done.
11372 </para>
11373 <para>
11374 For single-key lookups, Exim keeps the relevant files open in case there is
11375 another lookup that needs them. In some types of configuration this can lead to
11376 many files being kept open for messages with many recipients. To avoid hitting
11377 the operating system limit on the number of simultaneously open files, Exim
11378 closes the least recently used file when it needs to open more files than its
11379 own internal limit, which can be changed via the <option>lookup_open_max</option> option.
11380 </para>
11381 <para>
11382 The single-key lookup files are closed and the lookup caches are flushed at
11383 strategic points during delivery &ndash; for example, after all routing is
11384 complete.
11385 </para>
11386 </section>
11387 <section id="SECID65">
11388 <title>Quoting lookup data</title>
11389 <para>
11390 <indexterm role="concept">
11391 <primary>lookup</primary>
11392 <secondary>quoting</secondary>
11393 </indexterm>
11394 <indexterm role="concept">
11395 <primary>quoting</primary>
11396 <secondary>in lookups</secondary>
11397 </indexterm>
11398 When data from an incoming message is included in a query-style lookup, there
11399 is the possibility of special characters in the data messing up the syntax of
11400 the query. For example, a NIS+ query that contains
11401 </para>
11402 <literallayout class="monospaced">
11403 [name=$local_part]
11404 </literallayout>
11405 <para>
11406 will be broken if the local part happens to contain a closing square bracket.
11407 For NIS+, data can be enclosed in double quotes like this:
11408 </para>
11409 <literallayout class="monospaced">
11410 [name="$local_part"]
11411 </literallayout>
11412 <para>
11413 but this still leaves the problem of a double quote in the data. The rule for
11414 NIS+ is that double quotes must be doubled. Other lookup types have different
11415 rules, and to cope with the differing requirements, an expansion operator
11416 of the following form is provided:
11417 </para>
11418 <literallayout class="monospaced">
11419 ${quote_&lt;lookup-type&gt;:&lt;string&gt;}
11420 </literallayout>
11421 <para>
11422 For example, the safest way to write the NIS+ query is
11423 </para>
11424 <literallayout class="monospaced">
11425 [name="${quote_nisplus:$local_part}"]
11426 </literallayout>
11427 <para>
11428 See chapter <xref linkend="CHAPexpand"/> for full coverage of string expansions. The quote
11429 operator can be used for all lookup types, but has no effect for single-key
11430 lookups, since no quoting is ever needed in their key strings.
11431 </para>
11432 </section>
11433 <section id="SECTdnsdb">
11434 <title>More about dnsdb</title>
11435 <para>
11436 <indexterm role="concept">
11437 <primary>dnsdb lookup</primary>
11438 </indexterm>
11439 <indexterm role="concept">
11440 <primary>lookup</primary>
11441 <secondary>dnsdb</secondary>
11442 </indexterm>
11443 <indexterm role="concept">
11444 <primary>DNS</primary>
11445 <secondary>as a lookup type</secondary>
11446 </indexterm>
11447 The <command>dnsdb</command> lookup type uses the DNS as its database. A simple query consists
11448 of a record type and a domain name, separated by an equals sign. For example,
11449 an expansion string could contain:
11450 </para>
11451 <literallayout class="monospaced">
11452 ${lookup dnsdb{mx=a.b.example}{$value}fail}
11453 </literallayout>
11454 <para>
11455 If the lookup succeeds, the result is placed in <varname>$value</varname>, which in this case
11456 is used on its own as the result. If the lookup does not succeed, the
11457 <literal>fail</literal> keyword causes a <emphasis>forced expansion failure</emphasis> &ndash; see section
11458 <xref linkend="SECTforexpfai"/> for an explanation of what this means.
11459 </para>
11460 <para>
11461 The supported DNS record types are A, CNAME, MX, NS, PTR, SOA, SPF, SRV, TLSA
11462 and TXT, and, when Exim is compiled with IPv6 support, AAAA.
11463 If no type is given, TXT is assumed.
11464 </para>
11465 <para>
11466 For any record type, if multiple records are found, the data is returned as a
11467 concatenation, with newline as the default separator. The order, of course,
11468 depends on the DNS resolver. You can specify a different separator character
11469 between multiple records by putting a right angle-bracket followed immediately
11470 by the new separator at the start of the query. For example:
11471 </para>
11472 <literallayout class="monospaced">
11473 ${lookup dnsdb{&gt;: a=host1.example}}
11474 </literallayout>
11475 <para>
11476 It is permitted to specify a space as the separator character. Further
11477 white space is ignored.
11478 For lookup types that return multiple fields per record,
11479 an alternate field separator can be specified using a comma after the main
11480 separator character, followed immediately by the field separator.
11481 </para>
11482 <para>
11483 <indexterm role="concept">
11484 <primary>PTR record</primary>
11485 <secondary>in <command>dnsdb</command> lookup</secondary>
11486 </indexterm>
11487 When the type is PTR,
11488 the data can be an IP address, written as normal; inversion and the addition of
11489 <option>in-addr.arpa</option> or <option>ip6.arpa</option> happens automatically. For example:
11490 </para>
11491 <literallayout class="monospaced">
11492 ${lookup dnsdb{ptr=192.168.4.5}{$value}fail}
11493 </literallayout>
11494 <para>
11495 If the data for a PTR record is not a syntactically valid IP address, it is not
11496 altered and nothing is added.
11497 </para>
11498 <para>
11499 <indexterm role="concept">
11500 <primary>MX record</primary>
11501 <secondary>in <command>dnsdb</command> lookup</secondary>
11502 </indexterm>
11503 <indexterm role="concept">
11504 <primary>SRV record</primary>
11505 <secondary>in <command>dnsdb</command> lookup</secondary>
11506 </indexterm>
11507 For an MX lookup, both the preference value and the host name are returned for
11508 each record, separated by a space. For an SRV lookup, the priority, weight,
11509 port, and host name are returned for each record, separated by spaces.
11510 The field separator can be modified as above.
11511 </para>
11512 <para>
11513 <indexterm role="concept">
11514 <primary>TXT record</primary>
11515 <secondary>in <command>dnsdb</command> lookup</secondary>
11516 </indexterm>
11517 <indexterm role="concept">
11518 <primary>SPF record</primary>
11519 <secondary>in <command>dnsdb</command> lookup</secondary>
11520 </indexterm>
11521 For TXT records with multiple items of data, only the first item is returned,
11522 unless a field separator is specified.
11523 To concatenate items without a separator, use a semicolon instead.
11524 For SPF records the
11525 default behaviour is to concatenate multiple items without using a separator.
11526 </para>
11527 <literallayout class="monospaced">
11528 ${lookup dnsdb{&gt;\n,: txt=a.b.example}}
11529 ${lookup dnsdb{&gt;\n; txt=a.b.example}}
11530 ${lookup dnsdb{spf=example.org}}
11531 </literallayout>
11532 <para>
11533 It is permitted to specify a space as the separator character. Further
11534 white space is ignored.
11535 </para>
11536 <para>
11537 <indexterm role="concept">
11538 <primary>SOA record</primary>
11539 <secondary>in <command>dnsdb</command> lookup</secondary>
11540 </indexterm>
11541 For an SOA lookup, while no result is obtained the lookup is redone with
11542 successively more leading components dropped from the given domain.
11543 Only the primary-nameserver field is returned unless a field separator is
11544 specified.
11545 </para>
11546 <literallayout class="monospaced">
11547 ${lookup dnsdb{&gt;:,; soa=a.b.example.com}}
11548 </literallayout>
11549 </section>
11550 <section id="SECTdnsdb_mod">
11551 <title>Dnsdb lookup modifiers</title>
11552 <para>
11553 <indexterm role="concept">
11554 <primary>dnsdb modifiers</primary>
11555 </indexterm>
11556 <indexterm role="concept">
11557 <primary>modifiers</primary>
11558 <secondary>dnsdb</secondary>
11559 </indexterm>
11560 <indexterm role="concept">
11561 <primary>options</primary>
11562 <secondary>dnsdb</secondary>
11563 </indexterm>
11564 Modifiers for <command>dnsdb</command> lookups are given by optional keywords,
11565 each followed by a comma,
11566 that may appear before the record type.
11567 </para>
11568 <para>
11569 The <command>dnsdb</command> lookup fails only if all the DNS lookups fail. If there is a
11570 temporary DNS error for any of them, the behaviour is controlled by
11571 a defer-option modifier.
11572 The possible keywords are
11573 <quote>defer_strict</quote>, <quote>defer_never</quote>, and <quote>defer_lax</quote>.
11574 With <quote>strict</quote> behaviour, any temporary DNS error causes the
11575 whole lookup to defer. With <quote>never</quote> behaviour, a temporary DNS error is
11576 ignored, and the behaviour is as if the DNS lookup failed to find anything.
11577 With <quote>lax</quote> behaviour, all the queries are attempted, but a temporary DNS
11578 error causes the whole lookup to defer only if none of the other lookups
11579 succeed. The default is <quote>lax</quote>, so the following lookups are equivalent:
11580 </para>
11581 <literallayout class="monospaced">
11582 ${lookup dnsdb{defer_lax,a=one.host.com:two.host.com}}
11583 ${lookup dnsdb{a=one.host.com:two.host.com}}
11584 </literallayout>
11585 <para>
11586 Thus, in the default case, as long as at least one of the DNS lookups
11587 yields some data, the lookup succeeds.
11588 </para>
11589 <para>
11590 <indexterm role="concept">
11591 <primary>DNSSEC</primary>
11592 <secondary>dns lookup</secondary>
11593 </indexterm>
11594 Use of <command>DNSSEC</command> is controlled by a dnssec modifier.
11595 The possible keywords are
11596 <quote>dnssec_strict</quote>, <quote>dnssec_lax</quote>, and <quote>dnssec_never</quote>.
11597 With <quote>strict</quote> or <quote>lax</quote> DNSSEC information is requested
11598 with the lookup.
11599 With <quote>strict</quote> a response from the DNS resolver that
11600 is not labelled as authenticated data
11601 is treated as equivalent to a temporary DNS error.
11602 The default is <quote>lax</quote>.
11603 </para>
11604 <para>
11605 See also the <varname>$lookup_dnssec_authenticated</varname> variable.
11606 </para>
11607 <para>
11608 <indexterm role="concept">
11609 <primary>timeout</primary>
11610 <secondary>dns lookup</secondary>
11611 </indexterm>
11612 <indexterm role="concept">
11613 <primary>DNS</primary>
11614 <secondary>timeout</secondary>
11615 </indexterm>
11616 Timeout for the dnsdb lookup can be controlled by a retrans modifier.
11617 The form is <quote>retrans_VAL</quote> where VAL is an Exim time specification
11618 (e.g. <quote>5s</quote>).
11619 The default value is set by the main configuration option <option>dns_retrans</option>.
11620 </para>
11621 <para>
11622 Retries for the dnsdb lookup can be controlled by a retry modifier.
11623 The form if <quote>retry_VAL</quote> where VAL is an integer.
11624 The default count is set by the main configuration option <option>dns_retry</option>.
11625 </para>
11626 <para>
11627 <indexterm role="concept">
11628 <primary>caching</primary>
11629 <secondary>of dns lookup</secondary>
11630 </indexterm>
11631 <indexterm role="concept">
11632 <primary>TTL</primary>
11633 <secondary>of dns lookup</secondary>
11634 </indexterm>
11635 <indexterm role="concept">
11636 <primary>DNS</primary>
11637 <secondary>TTL</secondary>
11638 </indexterm>
11639 Dnsdb lookup results are cached within a single process (and its children).
11640 The cache entry lifetime is limited to the smallest time-to-live (TTL)
11641 value of the set of returned DNS records.
11642 </para>
11643 </section>
11644 <section id="SECID66">
11645 <title>Pseudo dnsdb record types</title>
11646 <para>
11647 <indexterm role="concept">
11648 <primary>MX record</primary>
11649 <secondary>in <command>dnsdb</command> lookup</secondary>
11650 </indexterm>
11651 By default, both the preference value and the host name are returned for
11652 each MX record, separated by a space. If you want only host names, you can use
11653 the pseudo-type MXH:
11654 </para>
11655 <literallayout class="monospaced">
11656 ${lookup dnsdb{mxh=a.b.example}}
11657 </literallayout>
11658 <para>
11659 In this case, the preference values are omitted, and just the host names are
11660 returned.
11661 </para>
11662 <para>
11663 <indexterm role="concept">
11664 <primary>name server for enclosing domain</primary>
11665 </indexterm>
11666 Another pseudo-type is ZNS (for <quote>zone NS</quote>). It performs a lookup for NS
11667 records on the given domain, but if none are found, it removes the first
11668 component of the domain name, and tries again. This process continues until NS
11669 records are found or there are no more components left (or there is a DNS
11670 error). In other words, it may return the name servers for a top-level domain,
11671 but it never returns the root name servers. If there are no NS records for the
11672 top-level domain, the lookup fails. Consider these examples:
11673 </para>
11674 <literallayout class="monospaced">
11675 ${lookup dnsdb{zns=xxx.quercite.com}}
11676 ${lookup dnsdb{zns=xxx.edu}}
11677 </literallayout>
11678 <para>
11679 Assuming that in each case there are no NS records for the full domain name,
11680 the first returns the name servers for <option>quercite.com</option>, and the second returns
11681 the name servers for <option>edu</option>.
11682 </para>
11683 <para>
11684 You should be careful about how you use this lookup because, unless the
11685 top-level domain does not exist, the lookup always returns some host names. The
11686 sort of use to which this might be put is for seeing if the name servers for a
11687 given domain are on a blacklist. You can probably assume that the name servers
11688 for the high-level domains such as <option>com</option> or <option>co.uk</option> are not going to be on
11689 such a list.
11690 </para>
11691 <para>
11692 <indexterm role="concept">
11693 <primary>CSA</primary>
11694 <secondary>in <command>dnsdb</command> lookup</secondary>
11695 </indexterm>
11696 A third pseudo-type is CSA (Client SMTP Authorization). This looks up SRV
11697 records according to the CSA rules, which are described in section
11698 <xref linkend="SECTverifyCSA"/>. Although <command>dnsdb</command> supports SRV lookups directly, this is
11699 not sufficient because of the extra parent domain search behaviour of CSA. The
11700 result of a successful lookup such as:
11701 </para>
11702 <literallayout class="monospaced">
11703 ${lookup dnsdb {csa=$sender_helo_name}}
11704 </literallayout>
11705 <para>
11706 has two space-separated fields: an authorization code and a target host name.
11707 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
11708 authorization required but absent, or <quote>?</quote> for unknown.
11709 </para>
11710 <para>
11711 <indexterm role="concept">
11712 <primary>A+</primary>
11713 <secondary>in <command>dnsdb</command> lookup</secondary>
11714 </indexterm>
11715 The pseudo-type A+ performs an AAAA
11716 and then an A lookup.  All results are returned; defer processing
11717 (see below) is handled separately for each lookup.  Example:
11718 </para>
11719 <literallayout class="monospaced">
11720 ${lookup dnsdb {&gt;; a+=$sender_helo_name}}
11721 </literallayout>
11722 </section>
11723 <section id="SECID67">
11724 <title>Multiple dnsdb lookups</title>
11725 <para>
11726 In the previous sections, <command>dnsdb</command> lookups for a single domain are described.
11727 However, you can specify a list of domains or IP addresses in a single
11728 <command>dnsdb</command> lookup. The list is specified in the normal Exim way, with colon as
11729 the default separator, but with the ability to change this. For example:
11730 </para>
11731 <literallayout class="monospaced">
11732 ${lookup dnsdb{one.domain.com:two.domain.com}}
11733 ${lookup dnsdb{a=one.host.com:two.host.com}}
11734 ${lookup dnsdb{ptr = &lt;; 1.2.3.4 ; 4.5.6.8}}
11735 </literallayout>
11736 <para>
11737 In order to retain backwards compatibility, there is one special case: if
11738 the lookup type is PTR and no change of separator is specified, Exim looks
11739 to see if the rest of the string is precisely one IPv6 address. In this
11740 case, it does not treat it as a list.
11741 </para>
11742 <para>
11743 The data from each lookup is concatenated, with newline separators by default,
11744 in the same way that multiple DNS records for a single item are handled. A
11745 different separator can be specified, as described above.
11746 </para>
11747 </section>
11748 <section id="SECTldap">
11749 <title>More about LDAP</title>
11750 <para>
11751 <indexterm role="concept">
11752 <primary>LDAP</primary>
11753 <secondary>lookup, more about</secondary>
11754 </indexterm>
11755 <indexterm role="concept">
11756 <primary>lookup</primary>
11757 <secondary>LDAP</secondary>
11758 </indexterm>
11759 <indexterm role="concept">
11760 <primary>Solaris</primary>
11761 <secondary>LDAP</secondary>
11762 </indexterm>
11763 The original LDAP implementation came from the University of Michigan; this has
11764 become <quote>Open LDAP</quote>, and there are now two different releases. Another
11765 implementation comes from Netscape, and Solaris 7 and subsequent releases
11766 contain inbuilt LDAP support. Unfortunately, though these are all compatible at
11767 the lookup function level, their error handling is different. For this reason
11768 it is necessary to set a compile-time variable when building Exim with LDAP, to
11769 indicate which LDAP library is in use. One of the following should appear in
11770 your <filename>Local/Makefile</filename>:
11771 </para>
11772 <literallayout class="monospaced">
11773 LDAP_LIB_TYPE=UMICHIGAN
11774 LDAP_LIB_TYPE=OPENLDAP1
11775 LDAP_LIB_TYPE=OPENLDAP2
11776 LDAP_LIB_TYPE=NETSCAPE
11777 LDAP_LIB_TYPE=SOLARIS
11778 </literallayout>
11779 <para>
11780 If LDAP_LIB_TYPE is not set, Exim assumes <literal>OPENLDAP1</literal>, which has the
11781 same interface as the University of Michigan version.
11782 </para>
11783 <para>
11784 There are three LDAP lookup types in Exim. These behave slightly differently in
11785 the way they handle the results of a query:
11786 </para>
11787 <itemizedlist>
11788 <listitem>
11789 <para>
11790 <command>ldap</command> requires the result to contain just one entry; if there are more, it
11791 gives an error.
11792 </para>
11793 </listitem>
11794 <listitem>
11795 <para>
11796 <command>ldapdn</command> also requires the result to contain just one entry, but it is the
11797 Distinguished Name that is returned rather than any attribute values.
11798 </para>
11799 </listitem>
11800 <listitem>
11801 <para>
11802 <command>ldapm</command> permits the result to contain more than one entry; the attributes
11803 from all of them are returned.
11804 </para>
11805 </listitem>
11806 </itemizedlist>
11807 <para>
11808 For <command>ldap</command> and <command>ldapm</command>, if a query finds only entries with no attributes,
11809 Exim behaves as if the entry did not exist, and the lookup fails. The format of
11810 the data returned by a successful lookup is described in the next section.
11811 First we explain how LDAP queries are coded.
11812 </para>
11813 </section>
11814 <section id="SECTforldaque">
11815 <title>Format of LDAP queries</title>
11816 <para>
11817 <indexterm role="concept">
11818 <primary>LDAP</primary>
11819 <secondary>query format</secondary>
11820 </indexterm>
11821 An LDAP query takes the form of a URL as defined in RFC 2255. For example, in
11822 the configuration of a <command>redirect</command> router one might have this setting:
11823 </para>
11824 <literallayout class="monospaced">
11825 data = ${lookup ldap \
11826   {ldap:///cn=$local_part,o=University%20of%20Cambridge,\
11827   c=UK?mailbox?base?}}
11828 </literallayout>
11829 <para>
11830 <indexterm role="concept">
11831 <primary>LDAP</primary>
11832 <secondary>with TLS</secondary>
11833 </indexterm>
11834 The URL may begin with <literal>ldap</literal> or <literal>ldaps</literal> if your LDAP library supports
11835 secure (encrypted) LDAP connections. The second of these ensures that an
11836 encrypted TLS connection is used.
11837 </para>
11838 <para>
11839 With sufficiently modern LDAP libraries, Exim supports forcing TLS over regular
11840 LDAP connections, rather than the SSL-on-connect <literal>ldaps</literal>.
11841 See the <option>ldap_start_tls</option> option.
11842 </para>
11843 <para>
11844 Starting with Exim 4.83, the initialization of LDAP with TLS is more tightly
11845 controlled. Every part of the TLS configuration can be configured by settings in
11846 <filename>exim.conf</filename>. Depending on the version of the client libraries installed on
11847 your system, some of the initialization may have required setting options in
11848 <filename>/etc/ldap.conf</filename> or <filename>~/.ldaprc</filename> to get TLS working with self-signed
11849 certificates. This revealed a nuance where the current UID that exim was
11850 running as could affect which config files it read. With Exim 4.83, these
11851 methods become optional, only taking effect if not specifically set in
11852 <filename>exim.conf</filename>.
11853 </para>
11854 </section>
11855 <section id="SECID68">
11856 <title>LDAP quoting</title>
11857 <para>
11858 <indexterm role="concept">
11859 <primary>LDAP</primary>
11860 <secondary>quoting</secondary>
11861 </indexterm>
11862 Two levels of quoting are required in LDAP queries, the first for LDAP itself
11863 and the second because the LDAP query is represented as a URL. Furthermore,
11864 within an LDAP query, two different kinds of quoting are required. For this
11865 reason, there are two different LDAP-specific quoting operators.
11866 </para>
11867 <para>
11868 The <option>quote_ldap</option> operator is designed for use on strings that are part of
11869 filter specifications. Conceptually, it first does the following conversions on
11870 the string:
11871 </para>
11872 <literallayout class="monospaced">
11873 *   =&gt;   \2A
11874 (   =&gt;   \28
11875 )   =&gt;   \29
11876 \   =&gt;   \5C
11877 </literallayout>
11878 <para>
11879 in accordance with RFC 2254. The resulting string is then quoted according
11880 to the rules for URLs, that is, all non-alphanumeric characters except
11881 </para>
11882 <literallayout class="monospaced">
11883 ! $ ' - . _ ( ) * +
11884 </literallayout>
11885 <para>
11886 are converted to their hex values, preceded by a percent sign. For example:
11887 </para>
11888 <literallayout class="monospaced">
11889 ${quote_ldap: a(bc)*, a&lt;yz&gt;; }
11890 </literallayout>
11891 <para>
11892 yields
11893 </para>
11894 <literallayout class="monospaced">
11895 %20a%5C28bc%5C29%5C2A%2C%20a%3Cyz%3E%3B%20
11896 </literallayout>
11897 <para>
11898 Removing the URL quoting, this is (with a leading and a trailing space):
11899 </para>
11900 <literallayout class="monospaced">
11901 a\28bc\29\2A, a&lt;yz&gt;;
11902 </literallayout>
11903 <para>
11904 The <option>quote_ldap_dn</option> operator is designed for use on strings that are part of
11905 base DN specifications in queries. Conceptually, it first converts the string
11906 by inserting a backslash in front of any of the following characters:
11907 </para>
11908 <literallayout class="monospaced">
11909 , + " \ &lt; &gt; ;
11910 </literallayout>
11911 <para>
11912 It also inserts a backslash before any leading spaces or # characters, and
11913 before any trailing spaces. (These rules are in RFC 2253.) The resulting string
11914 is then quoted according to the rules for URLs. For example:
11915 </para>
11916 <literallayout class="monospaced">
11917 ${quote_ldap_dn: a(bc)*, a&lt;yz&gt;; }
11918 </literallayout>
11919 <para>
11920 yields
11921 </para>
11922 <literallayout class="monospaced">
11923 %5C%20a(bc)*%5C%2C%20a%5C%3Cyz%5C%3E%5C%3B%5C%20
11924 </literallayout>
11925 <para>
11926 Removing the URL quoting, this is (with a trailing space):
11927 </para>
11928 <literallayout class="monospaced">
11929 \ a(bc)*\, a\&lt;yz\&gt;\;\
11930 </literallayout>
11931 <para>
11932 There are some further comments about quoting in the section on LDAP
11933 authentication below.
11934 </para>
11935 </section>
11936 <section id="SECID69">
11937 <title>LDAP connections</title>
11938 <para>
11939 <indexterm role="concept">
11940 <primary>LDAP</primary>
11941 <secondary>connections</secondary>
11942 </indexterm>
11943 The connection to an LDAP server may either be over TCP/IP, or, when OpenLDAP
11944 is in use, via a Unix domain socket. The example given above does not specify
11945 an LDAP server. A server that is reached by TCP/IP can be specified in a query
11946 by starting it with
11947 </para>
11948 <literallayout class="monospaced">
11949 ldap://&lt;hostname&gt;:&lt;port&gt;/...
11950 </literallayout>
11951 <para>
11952 If the port (and preceding colon) are omitted, the standard LDAP port (389) is
11953 used. When no server is specified in a query, a list of default servers is
11954 taken from the <option>ldap_default_servers</option> configuration option. This supplies a
11955 colon-separated list of servers which are tried in turn until one successfully
11956 handles a query, or there is a serious error. Successful handling either
11957 returns the requested data, or indicates that it does not exist. Serious errors
11958 are syntactical, or multiple values when only a single value is expected.
11959 Errors which cause the next server to be tried are connection failures, bind
11960 failures, and timeouts.
11961 </para>
11962 <para>
11963 For each server name in the list, a port number can be given. The standard way
11964 of specifying a host and port is to use a colon separator (RFC 1738). Because
11965 <option>ldap_default_servers</option> is a colon-separated list, such colons have to be
11966 doubled. For example
11967 </para>
11968 <literallayout class="monospaced">
11969 ldap_default_servers = ldap1.example.com::145:ldap2.example.com
11970 </literallayout>
11971 <para>
11972 If <option>ldap_default_servers</option> is unset, a URL with no server name is passed
11973 to the LDAP library with no server name, and the library&#x2019;s default (normally
11974 the local host) is used.
11975 </para>
11976 <para>
11977 If you are using the OpenLDAP library, you can connect to an LDAP server using
11978 a Unix domain socket instead of a TCP/IP connection. This is specified by using
11979 <literal>ldapi</literal> instead of <literal>ldap</literal> in LDAP queries. What follows here applies only
11980 to OpenLDAP. If Exim is compiled with a different LDAP library, this feature is
11981 not available.
11982 </para>
11983 <para>
11984 For this type of connection, instead of a host name for the server, a pathname
11985 for the socket is required, and the port number is not relevant. The pathname
11986 can be specified either as an item in <option>ldap_default_servers</option>, or inline in
11987 the query. In the former case, you can have settings such as
11988 </para>
11989 <literallayout class="monospaced">
11990 ldap_default_servers = /tmp/ldap.sock : backup.ldap.your.domain
11991 </literallayout>
11992 <para>
11993 When the pathname is given in the query, you have to escape the slashes as
11994 <literal>%2F</literal> to fit in with the LDAP URL syntax. For example:
11995 </para>
11996 <literallayout class="monospaced">
11997 ${lookup ldap {ldapi://%2Ftmp%2Fldap.sock/o=...
11998 </literallayout>
11999 <para>
12000 When Exim processes an LDAP lookup and finds that the <quote>hostname</quote> is really
12001 a pathname, it uses the Unix domain socket code, even if the query actually
12002 specifies <literal>ldap</literal> or <literal>ldaps</literal>. In particular, no encryption is used for a
12003 socket connection. This behaviour means that you can use a setting of
12004 <option>ldap_default_servers</option> such as in the example above with traditional <literal>ldap</literal>
12005 or <literal>ldaps</literal> queries, and it will work. First, Exim tries a connection via
12006 the Unix domain socket; if that fails, it tries a TCP/IP connection to the
12007 backup host.
12008 </para>
12009 <para>
12010 If an explicit <literal>ldapi</literal> type is given in a query when a host name is
12011 specified, an error is diagnosed. However, if there are more items in
12012 <option>ldap_default_servers</option>, they are tried. In other words:
12013 </para>
12014 <itemizedlist>
12015 <listitem>
12016 <para>
12017 Using a pathname with <literal>ldap</literal> or <literal>ldaps</literal> forces the use of the Unix domain
12018 interface.
12019 </para>
12020 </listitem>
12021 <listitem>
12022 <para>
12023 Using <literal>ldapi</literal> with a host name causes an error.
12024 </para>
12025 </listitem>
12026 </itemizedlist>
12027 <para>
12028 Using <literal>ldapi</literal> with no host or path in the query, and no setting of
12029 <option>ldap_default_servers</option>, does whatever the library does by default.
12030 </para>
12031 </section>
12032 <section id="SECID70">
12033 <title>LDAP authentication and control information</title>
12034 <para>
12035 <indexterm role="concept">
12036 <primary>LDAP</primary>
12037 <secondary>authentication</secondary>
12038 </indexterm>
12039 The LDAP URL syntax provides no way of passing authentication and other control
12040 information to the server. To make this possible, the URL in an LDAP query may
12041 be preceded by any number of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; settings, separated by
12042 spaces. If a value contains spaces it must be enclosed in double quotes, and
12043 when double quotes are used, backslash is interpreted in the usual way inside
12044 them. The following names are recognized:
12045 </para>
12046 <informaltable frame="none">
12047 <tgroup cols="2" colsep="0" rowsep="0">
12048 <colspec colwidth="1pt" align="left"/>
12049 <colspec colwidth="1pt" align="left"/>
12050 <tbody>
12051 <row>
12052 <entry>&nbsp;&nbsp;&nbsp;&nbsp;DEREFERENCE</entry>
12053 <entry>set the dereferencing parameter</entry>
12054 </row>
12055 <row>
12056 <entry>&nbsp;&nbsp;&nbsp;&nbsp;NETTIME</entry>
12057 <entry>set a timeout for a network operation</entry>
12058 </row>
12059 <row>
12060 <entry>&nbsp;&nbsp;&nbsp;&nbsp;USER</entry>
12061 <entry>set the DN, for authenticating the LDAP bind</entry>
12062 </row>
12063 <row>
12064 <entry>&nbsp;&nbsp;&nbsp;&nbsp;PASS</entry>
12065 <entry>set the password, likewise</entry>
12066 </row>
12067 <row>
12068 <entry>&nbsp;&nbsp;&nbsp;&nbsp;REFERRALS</entry>
12069 <entry>set the referrals parameter</entry>
12070 </row>
12071 <row>
12072 <entry>&nbsp;&nbsp;&nbsp;&nbsp;SERVERS</entry>
12073 <entry>set alternate server list for this query only</entry>
12074 </row>
12075 <row>
12076 <entry>&nbsp;&nbsp;&nbsp;&nbsp;SIZE</entry>
12077 <entry>set the limit for the number of entries returned</entry>
12078 </row>
12079 <row>
12080 <entry>&nbsp;&nbsp;&nbsp;&nbsp;TIME</entry>
12081 <entry>set the maximum waiting time for a query</entry>
12082 </row>
12083 </tbody>
12084 </tgroup>
12085 </informaltable>
12086 <para>
12087 The value of the DEREFERENCE parameter must be one of the words <quote>never</quote>,
12088 <quote>searching</quote>, <quote>finding</quote>, or <quote>always</quote>. The value of the REFERRALS parameter
12089 must be <quote>follow</quote> (the default) or <quote>nofollow</quote>. The latter stops the LDAP
12090 library from trying to follow referrals issued by the LDAP server.
12091 </para>
12092 <para>
12093 <indexterm role="concept">
12094 <primary>LDAP</primary>
12095 <secondary>timeout</secondary>
12096 </indexterm>
12097 <indexterm role="concept">
12098 <primary>timeout</primary>
12099 <secondary>LDAP lookup</secondary>
12100 </indexterm>
12101 The name CONNECT is an obsolete name for NETTIME, retained for
12102 backwards compatibility. This timeout (specified as a number of seconds) is
12103 enforced from the client end for operations that can be carried out over a
12104 network. Specifically, it applies to network connections and calls to the
12105 <emphasis>ldap_result()</emphasis> function. If the value is greater than zero, it is used if
12106 LDAP_OPT_NETWORK_TIMEOUT is defined in the LDAP headers (OpenLDAP), or
12107 if LDAP_X_OPT_CONNECT_TIMEOUT is defined in the LDAP headers (Netscape
12108 SDK 4.1). A value of zero forces an explicit setting of <quote>no timeout</quote> for
12109 Netscape SDK; for OpenLDAP no action is taken.
12110 </para>
12111 <para>
12112 The TIME parameter (also a number of seconds) is passed to the server to
12113 set a server-side limit on the time taken to complete a search.
12114 </para>
12115 <para>
12116 The SERVERS parameter allows you to specify an alternate list of ldap servers
12117 to use for an individual lookup.  The global <option>ldap_default_servers</option> option provides a
12118 default list of ldap servers, and a single lookup can specify a single ldap
12119 server to use.  But when you need to do a lookup with a list of servers that is
12120 different than the default list (maybe different order, maybe a completely
12121 different set of servers), the SERVERS parameter allows you to specify this
12122 alternate list (colon-separated).
12123 </para>
12124 <para>
12125 Here is an example of an LDAP query in an Exim lookup that uses some of these
12126 values. This is a single line, folded to fit on the page:
12127 </para>
12128 <literallayout class="monospaced">
12129 ${lookup ldap
12130   {user="cn=manager,o=University of Cambridge,c=UK" pass=secret
12131   ldap:///o=University%20of%20Cambridge,c=UK?sn?sub?(cn=foo)}
12132   {$value}fail}
12133 </literallayout>
12134 <para>
12135 The encoding of spaces as <literal>%20</literal> is a URL thing which should not be done for
12136 any of the auxiliary data. Exim configuration settings that include lookups
12137 which contain password information should be preceded by <quote>hide</quote> to prevent
12138 non-admin users from using the <option>-bP</option> option to see their values.
12139 </para>
12140 <para>
12141 The auxiliary data items may be given in any order. The default is no
12142 connection timeout (the system timeout is used), no user or password, no limit
12143 on the number of entries returned, and no time limit on queries.
12144 </para>
12145 <para>
12146 When a DN is quoted in the USER= setting for LDAP authentication, Exim
12147 removes any URL quoting that it may contain before passing it LDAP. Apparently
12148 some libraries do this for themselves, but some do not. Removing the URL
12149 quoting has two advantages:
12150 </para>
12151 <itemizedlist>
12152 <listitem>
12153 <para>
12154 It makes it possible to use the same <option>quote_ldap_dn</option> expansion for USER=
12155 DNs as with DNs inside actual queries.
12156 </para>
12157 </listitem>
12158 <listitem>
12159 <para>
12160 It permits spaces inside USER= DNs.
12161 </para>
12162 </listitem>
12163 </itemizedlist>
12164 <para>
12165 For example, a setting such as
12166 </para>
12167 <literallayout class="monospaced">
12168 USER=cn=${quote_ldap_dn:$1}
12169 </literallayout>
12170 <para>
12171 should work even if <varname>$1</varname> contains spaces.
12172 </para>
12173 <para>
12174 Expanded data for the PASS= value should be quoted using the <option>quote</option>
12175 expansion operator, rather than the LDAP quote operators. The only reason this
12176 field needs quoting is to ensure that it conforms to the Exim syntax, which
12177 does not allow unquoted spaces. For example:
12178 </para>
12179 <literallayout class="monospaced">
12180 PASS=${quote:$3}
12181 </literallayout>
12182 <para>
12183 The LDAP authentication mechanism can be used to check passwords as part of
12184 SMTP authentication. See the <option>ldapauth</option> expansion string condition in chapter
12185 <xref linkend="CHAPexpand"/>.
12186 </para>
12187 </section>
12188 <section id="SECID71">
12189 <title>Format of data returned by LDAP</title>
12190 <para>
12191 <indexterm role="concept">
12192 <primary>LDAP</primary>
12193 <secondary>returned data formats</secondary>
12194 </indexterm>
12195 The <command>ldapdn</command> lookup type returns the Distinguished Name from a single entry
12196 as a sequence of values, for example
12197 </para>
12198 <literallayout class="monospaced">
12199 cn=manager,o=University of Cambridge,c=UK
12200 </literallayout>
12201 <para>
12202 The <command>ldap</command> lookup type generates an error if more than one entry matches the
12203 search filter, whereas <command>ldapm</command> permits this case, and inserts a newline in
12204 the result between the data from different entries. It is possible for multiple
12205 values to be returned for both <command>ldap</command> and <command>ldapm</command>, but in the former case
12206 you know that whatever values are returned all came from a single entry in the
12207 directory.
12208 </para>
12209 <para>
12210 In the common case where you specify a single attribute in your LDAP query, the
12211 result is not quoted, and does not contain the attribute name. If the attribute
12212 has multiple values, they are separated by commas. Any comma that is
12213 part of an attribute&#x2019;s value is doubled.
12214 </para>
12215 <para>
12216 If you specify multiple attributes, the result contains space-separated, quoted
12217 strings, each preceded by the attribute name and an equals sign. Within the
12218 quotes, the quote character, backslash, and newline are escaped with
12219 backslashes, and commas are used to separate multiple values for the attribute.
12220 Any commas in attribute values are doubled
12221 (permitting treatment of the values as a comma-separated list).
12222 Apart from the escaping, the string within quotes takes the same form as the
12223 output when a single attribute is requested. Specifying no attributes is the
12224 same as specifying all of an entry&#x2019;s attributes.
12225 </para>
12226 <para>
12227 Here are some examples of the output format. The first line of each pair is an
12228 LDAP query, and the second is the data that is returned. The attribute called
12229 <option>attr1</option> has two values, one of them with an embedded comma, whereas
12230 <option>attr2</option> has only one value. Both attributes are derived from <option>attr</option>
12231 (they have SUP <option>attr</option> in their schema definitions).
12232 </para>
12233 <literallayout class="monospaced">
12234 ldap:///o=base?attr1?sub?(uid=fred)
12235 value1.1,value1,,2
12236
12237 ldap:///o=base?attr2?sub?(uid=fred)
12238 value two
12239
12240 ldap:///o=base?attr?sub?(uid=fred)
12241 value1.1,value1,,2,value two
12242
12243 ldap:///o=base?attr1,attr2?sub?(uid=fred)
12244 attr1="value1.1,value1,,2" attr2="value two"
12245
12246 ldap:///o=base??sub?(uid=fred)
12247 objectClass="top" attr1="value1.1,value1,,2" attr2="value two"
12248 </literallayout>
12249 <para>
12250 You can
12251 make use of Exim&#x2019;s <option>-be</option> option to run expansion tests and thereby check the
12252 results of LDAP lookups.
12253 The <option>extract</option> operator in string expansions can be used to pick out
12254 individual fields from data that consists of <emphasis>key</emphasis>=<emphasis>value</emphasis> pairs.
12255 The <option>listextract</option> operator should be used to pick out individual values
12256 of attributes, even when only a single value is expected.
12257 The doubling of embedded commas allows you to use the returned data as a
12258 comma separated list (using the "&lt;," syntax for changing the input list separator).
12259 </para>
12260 </section>
12261 <section id="SECTnisplus">
12262 <title>More about NIS+</title>
12263 <para>
12264 <indexterm role="concept">
12265 <primary>NIS+ lookup type</primary>
12266 </indexterm>
12267 <indexterm role="concept">
12268 <primary>lookup</primary>
12269 <secondary>NIS+</secondary>
12270 </indexterm>
12271 NIS+ queries consist of a NIS+ <emphasis>indexed name</emphasis> followed by an optional colon
12272 and field name. If this is given, the result of a successful query is the
12273 contents of the named field; otherwise the result consists of a concatenation
12274 of <emphasis>field-name=field-value</emphasis> pairs, separated by spaces. Empty values and
12275 values containing spaces are quoted. For example, the query
12276 </para>
12277 <literallayout class="monospaced">
12278 [name=mg1456],passwd.org_dir
12279 </literallayout>
12280 <para>
12281 might return the string
12282 </para>
12283 <literallayout class="monospaced">
12284 name=mg1456 passwd="" uid=999 gid=999 gcos="Martin Guerre"
12285 home=/home/mg1456 shell=/bin/bash shadow=""
12286 </literallayout>
12287 <para>
12288 (split over two lines here to fit on the page), whereas
12289 </para>
12290 <literallayout class="monospaced">
12291 [name=mg1456],passwd.org_dir:gcos
12292 </literallayout>
12293 <para>
12294 would just return
12295 </para>
12296 <literallayout class="monospaced">
12297 Martin Guerre
12298 </literallayout>
12299 <para>
12300 with no quotes. A NIS+ lookup fails if NIS+ returns more than one table entry
12301 for the given indexed key. The effect of the <option>quote_nisplus</option> expansion
12302 operator is to double any quote characters within the text.
12303 </para>
12304 </section>
12305 <section id="SECTsql">
12306 <title>SQL lookups</title>
12307 <para>
12308 <indexterm role="concept">
12309 <primary>SQL lookup types</primary>
12310 </indexterm>
12311 <indexterm role="concept">
12312 <primary>MySQL</primary>
12313 <secondary>lookup type</secondary>
12314 </indexterm>
12315 <indexterm role="concept">
12316 <primary>PostgreSQL lookup type</primary>
12317 </indexterm>
12318 <indexterm role="concept">
12319 <primary>lookup</primary>
12320 <secondary>MySQL</secondary>
12321 </indexterm>
12322 <indexterm role="concept">
12323 <primary>lookup</primary>
12324 <secondary>PostgreSQL</secondary>
12325 </indexterm>
12326 <indexterm role="concept">
12327 <primary>Oracle</primary>
12328 <secondary>lookup type</secondary>
12329 </indexterm>
12330 <indexterm role="concept">
12331 <primary>lookup</primary>
12332 <secondary>Oracle</secondary>
12333 </indexterm>
12334 <indexterm role="concept">
12335 <primary>InterBase lookup type</primary>
12336 </indexterm>
12337 <indexterm role="concept">
12338 <primary>lookup</primary>
12339 <secondary>InterBase</secondary>
12340 </indexterm>
12341 <indexterm role="concept">
12342 <primary>Redis lookup type</primary>
12343 </indexterm>
12344 <indexterm role="concept">
12345 <primary>lookup</primary>
12346 <secondary>Redis</secondary>
12347 </indexterm>
12348 Exim can support lookups in InterBase, MySQL, Oracle, PostgreSQL, Redis,
12349 and SQLite
12350 databases. Queries for these databases contain SQL statements, so an example
12351 might be
12352 </para>
12353 <literallayout class="monospaced">
12354 ${lookup mysql{select mailbox from users where id='userx'}\
12355   {$value}fail}
12356 </literallayout>
12357 <para>
12358 If the result of the query contains more than one field, the data for each
12359 field in the row is returned, preceded by its name, so the result of
12360 </para>
12361 <literallayout class="monospaced">
12362 ${lookup pgsql{select home,name from users where id='userx'}\
12363   {$value}}
12364 </literallayout>
12365 <para>
12366 might be
12367 </para>
12368 <literallayout class="monospaced">
12369 home=/home/userx name="Mister X"
12370 </literallayout>
12371 <para>
12372 Empty values and values containing spaces are double quoted, with embedded
12373 quotes escaped by a backslash. If the result of the query contains just one
12374 field, the value is passed back verbatim, without a field name, for example:
12375 </para>
12376 <literallayout class="monospaced">
12377 Mister X
12378 </literallayout>
12379 <para>
12380 If the result of the query yields more than one row, it is all concatenated,
12381 with a newline between the data for each row.
12382 </para>
12383 </section>
12384 <section id="SECID72">
12385 <title>More about MySQL, PostgreSQL, Oracle, InterBase, and Redis</title>
12386 <para>
12387 <indexterm role="concept">
12388 <primary>MySQL</primary>
12389 <secondary>lookup type</secondary>
12390 </indexterm>
12391 <indexterm role="concept">
12392 <primary>PostgreSQL lookup type</primary>
12393 </indexterm>
12394 <indexterm role="concept">
12395 <primary>lookup</primary>
12396 <secondary>MySQL</secondary>
12397 </indexterm>
12398 <indexterm role="concept">
12399 <primary>lookup</primary>
12400 <secondary>PostgreSQL</secondary>
12401 </indexterm>
12402 <indexterm role="concept">
12403 <primary>Oracle</primary>
12404 <secondary>lookup type</secondary>
12405 </indexterm>
12406 <indexterm role="concept">
12407 <primary>lookup</primary>
12408 <secondary>Oracle</secondary>
12409 </indexterm>
12410 <indexterm role="concept">
12411 <primary>InterBase lookup type</primary>
12412 </indexterm>
12413 <indexterm role="concept">
12414 <primary>lookup</primary>
12415 <secondary>InterBase</secondary>
12416 </indexterm>
12417 <indexterm role="concept">
12418 <primary>Redis lookup type</primary>
12419 </indexterm>
12420 <indexterm role="concept">
12421 <primary>lookup</primary>
12422 <secondary>Redis</secondary>
12423 </indexterm>
12424 If any MySQL, PostgreSQL, Oracle, InterBase or Redis lookups are used, the
12425 <option>mysql_servers</option>, <option>pgsql_servers</option>, <option>oracle_servers</option>, <option>ibase_servers</option>,
12426 or <option>redis_servers</option>
12427 option (as appropriate) must be set to a colon-separated list of server
12428 information.
12429 <indexterm role="option">
12430 <primary><option>mysql_servers</option></primary>
12431 </indexterm>
12432 <indexterm role="option">
12433 <primary><option>pgsql_servers</option></primary>
12434 </indexterm>
12435 <indexterm role="option">
12436 <primary><option>oracle_servers</option></primary>
12437 </indexterm>
12438 <indexterm role="option">
12439 <primary><option>ibase_servers</option></primary>
12440 </indexterm>
12441 <indexterm role="option">
12442 <primary><option>redis_servers</option></primary>
12443 </indexterm>
12444 (For MySQL and PostgreSQL, the global option need not be set if all
12445 queries contain their own server information &ndash; see section
12446 <xref linkend="SECTspeserque"/>.)
12447 For all but Redis
12448 each item in the list is a slash-separated list of four
12449 items: host name, database name, user name, and password. In the case of
12450 Oracle, the host name field is used for the <quote>service name</quote>, and the database
12451 name field is not used and should be empty. For example:
12452 </para>
12453 <literallayout class="monospaced">
12454 hide oracle_servers = oracle.plc.example//userx/abcdwxyz
12455 </literallayout>
12456 <para>
12457 Because password data is sensitive, you should always precede the setting with
12458 <quote>hide</quote>, to prevent non-admin users from obtaining the setting via the <option>-bP</option>
12459 option. Here is an example where two MySQL servers are listed:
12460 </para>
12461 <literallayout class="monospaced">
12462 hide mysql_servers = localhost/users/root/secret:\
12463                      otherhost/users/root/othersecret
12464 </literallayout>
12465 <para>
12466 For MySQL and PostgreSQL, a host may be specified as &lt;<emphasis>name</emphasis>&gt;:&lt;<emphasis>port</emphasis>&gt; but
12467 because this is a colon-separated list, the colon has to be doubled. For each
12468 query, these parameter groups are tried in order until a connection is made and
12469 a query is successfully processed. The result of a query may be that no data is
12470 found, but that is still a successful query. In other words, the list of
12471 servers provides a backup facility, not a list of different places to look.
12472 </para>
12473 <para>
12474 For Redis the global option need not be specified if all queries contain their
12475 own server information &ndash; see section <xref linkend="SECTspeserque"/>.
12476 If specified, the option must be set to a colon-separated list of server
12477 information.
12478 Each item in the list is a slash-separated list of three items:
12479 host, database number, and password.
12480 </para>
12481 <orderedlist numeration="arabic">
12482 <listitem>
12483 <para>
12484 The host is required and may be either an IPv4 address and optional
12485 port number (separated by a colon, which needs doubling due to the
12486 higher-level list), or a Unix socket pathname enclosed in parentheses
12487 </para>
12488 </listitem>
12489 <listitem>
12490 <para>
12491 The database number is optional; if present that number is selected in the backend
12492 </para>
12493 </listitem>
12494 <listitem>
12495 <para>
12496 The password is optional; if present it is used to authenticate to the backend
12497 </para>
12498 </listitem>
12499 </orderedlist>
12500 <para>
12501 The <option>quote_mysql</option>, <option>quote_pgsql</option>, and <option>quote_oracle</option> expansion operators
12502 convert newline, tab, carriage return, and backspace to \n, \t, \r, and \b
12503 respectively, and the characters single-quote, double-quote, and backslash
12504 itself are escaped with backslashes.
12505 </para>
12506 <para>
12507 The <option>quote_redis</option> expansion operator
12508 escapes whitespace and backslash characters with a backslash.
12509 </para>
12510 </section>
12511 <section id="SECTspeserque">
12512 <title>Specifying the server in the query</title>
12513 <para>
12514 For MySQL, PostgreSQL and Redis lookups (but not currently for Oracle and InterBase),
12515 it is possible to specify a list of servers with an individual query. This is
12516 done by appending a comma-separated option to the query type:
12517 </para>
12518 <literallayout>
12519 <literal>,servers=</literal><emphasis>server1:server2:server3:...</emphasis>
12520 </literallayout>
12521 <para>
12522 Each item in the list may take one of two forms:
12523 </para>
12524 <orderedlist numeration="arabic">
12525 <listitem>
12526 <para>
12527 If it contains no slashes it is assumed to be just a host name. The appropriate
12528 global option (<option>mysql_servers</option> or <option>pgsql_servers</option>) is searched for a host
12529 of the same name, and the remaining parameters (database, user, password) are
12530 taken from there.
12531 </para>
12532 </listitem>
12533 <listitem>
12534 <para>
12535 If it contains any slashes, it is taken as a complete parameter set.
12536 </para>
12537 </listitem>
12538 </orderedlist>
12539 <para>
12540 The list of servers is used in exactly the same way as the global list.
12541 Once a connection to a server has happened and a query has been
12542 successfully executed, processing of the lookup ceases.
12543 </para>
12544 <para>
12545 This feature is intended for use in master/slave situations where updates
12546 are occurring and you want to update the master rather than a slave. If the
12547 master is in the list as a backup for reading, you might have a global setting
12548 like this:
12549 </para>
12550 <literallayout class="monospaced">
12551 mysql_servers = slave1/db/name/pw:\
12552                 slave2/db/name/pw:\
12553                 master/db/name/pw
12554 </literallayout>
12555 <para>
12556 In an updating lookup, you could then write:
12557 </para>
12558 <literallayout class="monospaced">
12559 ${lookup mysql,servers=master {UPDATE ...} }
12560 </literallayout>
12561 <para>
12562 That query would then be sent only to the master server. If, on the other hand,
12563 the master is not to be used for reading, and so is not present in the global
12564 option, you can still update it by a query of this form:
12565 </para>
12566 <literallayout class="monospaced">
12567 ${lookup pgsql,servers=master/db/name/pw {UPDATE ...} }
12568 </literallayout>
12569 <para>
12570 An older syntax places the servers specification before the query,
12571 semicolon separated:
12572 </para>
12573 <literallayout class="monospaced">
12574 ${lookup mysql{servers=master; UPDATE ...} }
12575 </literallayout>
12576 <para>
12577 The new version avoids potential issues with tainted
12578 arguments in the query, for explicit expansion.
12579 <emphasis role="bold">Note</emphasis>: server specifications in list-style lookups are still problematic.
12580 </para>
12581 </section>
12582 <section id="SECID73">
12583 <title>Special MySQL features</title>
12584 <para>
12585 For MySQL, an empty host name or the use of <quote>localhost</quote> in <option>mysql_servers</option>
12586 causes a connection to the server on the local host by means of a Unix domain
12587 socket. An alternate socket can be specified in parentheses.
12588 An option group name for MySQL option files can be specified in square brackets;
12589 the default value is <quote>exim</quote>.
12590 The full syntax of each item in <option>mysql_servers</option> is:
12591 </para>
12592 <literallayout>
12593 &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;
12594 </literallayout>
12595 <para>
12596 Any of the four sub-parts of the first field can be omitted. For normal use on
12597 the local host it can be left blank or set to just <quote>localhost</quote>.
12598 </para>
12599 <para>
12600 No database need be supplied &ndash; but if it is absent here, it must be given in
12601 the queries.
12602 </para>
12603 <para>
12604 If a MySQL query is issued that does not request any data (an insert, update,
12605 or delete command), the result of the lookup is the number of rows affected.
12606 </para>
12607 <para>
12608 <emphasis role="bold">Warning</emphasis>: This can be misleading. If an update does not actually change
12609 anything (for example, setting a field to the value it already has), the result
12610 is zero because no rows are affected.
12611 </para>
12612 </section>
12613 <section id="SECID74">
12614 <title>Special PostgreSQL features</title>
12615 <para>
12616 PostgreSQL lookups can also use Unix domain socket connections to the database.
12617 This is usually faster and costs less CPU time than a TCP/IP connection.
12618 However it can be used only if the mail server runs on the same machine as the
12619 database server. A configuration line for PostgreSQL via Unix domain sockets
12620 looks like this:
12621 </para>
12622 <literallayout class="monospaced">
12623 hide pgsql_servers = (/tmp/.s.PGSQL.5432)/db/user/password : ...
12624 </literallayout>
12625 <para>
12626 In other words, instead of supplying a host name, a path to the socket is
12627 given. The path name is enclosed in parentheses so that its slashes aren&#x2019;t
12628 visually confused with the delimiters for the other server parameters.
12629 </para>
12630 <para>
12631 If a PostgreSQL query is issued that does not request any data (an insert,
12632 update, or delete command), the result of the lookup is the number of rows
12633 affected.
12634 </para>
12635 </section>
12636 <section id="SECTsqlite">
12637 <title>More about SQLite</title>
12638 <para>
12639 <indexterm role="concept">
12640 <primary>lookup</primary>
12641 <secondary>SQLite</secondary>
12642 </indexterm>
12643 <indexterm role="concept">
12644 <primary>sqlite lookup type</primary>
12645 </indexterm>
12646 SQLite is different to the other SQL lookups because a filename is required in
12647 addition to the SQL query. An SQLite database is a single file, and there is no
12648 daemon as in the other SQL databases.
12649 </para>
12650 <para>
12651 <indexterm role="option">
12652 <primary><option>sqlite_dbfile</option></primary>
12653 </indexterm>
12654 There are two ways of
12655 specifying the file.
12656 The first is is by using the <option>sqlite_dbfile</option> main option.
12657 The second, which allows separate files for each query,
12658 is to use an option appended, comma-separated, to the <quote>sqlite</quote>
12659 lookup type word.  The option is the word <quote>file</quote>, then an equals,
12660 then the filename.
12661 The filename in this case cannot contain whitespace or open-brace charachters.
12662 </para>
12663 <para>
12664 A deprecated method is available, prefixing the query with the filename
12665 separated by white space.
12666 This means that
12667 <indexterm role="concept">
12668 <primary>tainted data</primary>
12669 <secondary>sqlite file</secondary>
12670 </indexterm>
12671 the query cannot use any tainted values, as that taints
12672 the entire query including the filename - resulting in a refusal to open
12673 the file.
12674 </para>
12675 <para>
12676 In all the above cases the filename must be an absolute path.
12677 </para>
12678 <para>
12679 Here is a lookup expansion example:
12680 </para>
12681 <literallayout class="monospaced">
12682 sqlite_dbfile = /some/thing/sqlitedb
12683 ...
12684 ${lookup sqlite {select name from aliases where id='userx';}}
12685 </literallayout>
12686 <para>
12687 In a list, the syntax is similar. For example:
12688 </para>
12689 <literallayout class="monospaced">
12690 domainlist relay_to_domains = sqlite;\
12691    select * from relays where ip='$sender_host_address';
12692 </literallayout>
12693 <para>
12694 The only character affected by the <option>quote_sqlite</option> operator is a single
12695 quote, which it doubles.
12696 </para>
12697 <para>
12698 <indexterm role="concept">
12699 <primary>timeout</primary>
12700 <secondary>SQLite</secondary>
12701 </indexterm>
12702 <indexterm role="concept">
12703 <primary>sqlite</primary>
12704 <secondary>lookup timeout</secondary>
12705 </indexterm>
12706 The SQLite library handles multiple simultaneous accesses to the database
12707 internally. Multiple readers are permitted, but only one process can
12708 update at once. Attempts to access the database while it is being updated
12709 are rejected after a timeout period, during which the SQLite library
12710 waits for the lock to be released. In Exim, the default timeout is set
12711 to 5 seconds, but it can be changed by means of the <option>sqlite_lock_timeout</option>
12712 option.
12713 </para>
12714 </section>
12715 <section id="SECTredis">
12716 <title>More about Redis</title>
12717 <para>
12718 <indexterm role="concept">
12719 <primary>lookup</primary>
12720 <secondary>Redis</secondary>
12721 </indexterm>
12722 <indexterm role="concept">
12723 <primary>redis lookup type</primary>
12724 </indexterm>
12725 Redis is a non-SQL database. Commands are simple get and set.
12726 Examples:
12727 </para>
12728 <literallayout class="monospaced">
12729 ${lookup redis{set keyname ${quote_redis:objvalue plus}}}
12730 ${lookup redis{get keyname}}
12731 </literallayout>
12732 <para>
12733 As of release 4.91, "lightweight" support for Redis Cluster is available.
12734 Requires <option>redis_servers</option> list to contain all the servers in the cluster, all
12735 of which must be reachable from the running exim instance. If the cluster has
12736 master/slave replication, the list must contain all the master and slave
12737 servers.
12738 </para>
12739 <para>
12740 When the Redis Cluster returns a "MOVED" response to a query, Exim does not
12741 immediately follow the redirection but treats the response as a DEFER, moving on
12742 to the next server in the <option>redis_servers</option> list until the correct server is
12743 reached.
12744 </para>
12745 <para>
12746 <indexterm role="concept" startref="IIDfidalo1" class="endofrange"/>
12747 <indexterm role="concept" startref="IIDfidalo2" class="endofrange"/>
12748 </para>
12749 </section>
12750 </chapter>
12751
12752 <chapter id="CHAPdomhosaddlists">
12753 <title>Domain, host, address, and local part lists</title>
12754 <titleabbrev>Domain, host, and address lists</titleabbrev>
12755 <para>
12756 <indexterm role="concept" id="IIDdohoadli" class="startofrange">
12757 <primary>lists of domains; hosts; etc.</primary>
12758 </indexterm>
12759 A number of Exim configuration options contain lists of domains, hosts,
12760 email addresses, or local parts. For example, the <option>hold_domains</option> option
12761 contains a list of domains whose delivery is currently suspended. These lists
12762 are also used as data in ACL statements (see chapter <xref linkend="CHAPACL"/>), and as
12763 arguments to expansion conditions such as <option>match_domain</option>.
12764 </para>
12765 <para>
12766 Each item in one of these lists is a pattern to be matched against a domain,
12767 host, email address, or local part, respectively. In the sections below, the
12768 different types of pattern for each case are described, but first we cover some
12769 general facilities that apply to all four kinds of list.
12770 </para>
12771 <para>
12772 Note that other parts of Exim use a <emphasis>string list</emphasis> which does not
12773 support all the complexity available in
12774 domain, host, address and local part lists.
12775 </para>
12776 <section id="SECTlistexpand">
12777 <title>Expansion of lists</title>
12778 <para>
12779 <indexterm role="concept">
12780 <primary>expansion</primary>
12781 <secondary>of lists</secondary>
12782 </indexterm>
12783 Each list is expanded as a single string before it is used.
12784 </para>
12785 <para>
12786 <emphasis>Exception: the router headers_remove option, where list-item
12787 splitting is done before string-expansion.</emphasis>
12788 </para>
12789 <para>
12790 The result of
12791 expansion must be a list, possibly containing empty items, which is split up
12792 into separate items for matching. By default, colon is the separator character,
12793 but this can be varied if necessary. See sections <xref linkend="SECTlistconstruct"/> and
12794 <xref linkend="SECTempitelis"/> for details of the list syntax; the second of these
12795 discusses the way to specify empty list items.
12796 </para>
12797 <para>
12798 If the string expansion is forced to fail, Exim behaves as if the item it is
12799 testing (domain, host, address, or local part) is not in the list. Other
12800 expansion failures cause temporary errors.
12801 </para>
12802 <para>
12803 If an item in a list is a regular expression, backslashes, dollars and possibly
12804 other special characters in the expression must be protected against
12805 misinterpretation by the string expander. The easiest way to do this is to use
12806 the <literal>\N</literal> expansion feature to indicate that the contents of the regular
12807 expression should not be expanded. For example, in an ACL you might have:
12808 </para>
12809 <literallayout class="monospaced">
12810 deny senders = \N^\d{8}\w@.*\.baddomain\.example$\N : \
12811                ${lookup{$domain}lsearch{/badsenders/bydomain}}
12812 </literallayout>
12813 <para>
12814 The first item is a regular expression that is protected from expansion by
12815 <literal>\N</literal>, whereas the second uses the expansion to obtain a list of unwanted
12816 senders based on the receiving domain.
12817 </para>
12818 </section>
12819 <section id="SECID76">
12820 <title>Negated items in lists</title>
12821 <para>
12822 <indexterm role="concept">
12823 <primary>list</primary>
12824 <secondary>negation</secondary>
12825 </indexterm>
12826 <indexterm role="concept">
12827 <primary>negation</primary>
12828 <secondary>in lists</secondary>
12829 </indexterm>
12830 Items in a list may be positive or negative. Negative items are indicated by a
12831 leading exclamation mark, which may be followed by optional white space. A list
12832 defines a set of items (domains, etc). When Exim processes one of these lists,
12833 it is trying to find out whether a domain, host, address, or local part
12834 (respectively) is in the set that is defined by the list. It works like this:
12835 </para>
12836 <para>
12837 The list is scanned from left to right. If a positive item is matched, the
12838 subject that is being checked is in the set; if a negative item is matched, the
12839 subject is not in the set. If the end of the list is reached without the
12840 subject having matched any of the patterns, it is in the set if the last item
12841 was a negative one, but not if it was a positive one. For example, the list in
12842 </para>
12843 <literallayout class="monospaced">
12844 domainlist relay_to_domains = !a.b.c : *.b.c
12845 </literallayout>
12846 <para>
12847 matches any domain ending in <emphasis>.b.c</emphasis> except for <emphasis>a.b.c</emphasis>. Domains that match
12848 neither <emphasis>a.b.c</emphasis> nor <emphasis>*.b.c</emphasis> do not match, because the last item in the
12849 list is positive. However, if the setting were
12850 </para>
12851 <literallayout class="monospaced">
12852 domainlist relay_to_domains = !a.b.c
12853 </literallayout>
12854 <para>
12855 then all domains other than <emphasis>a.b.c</emphasis> would match because the last item in the
12856 list is negative. In other words, a list that ends with a negative item behaves
12857 as if it had an extra item <literal>:*</literal> on the end.
12858 </para>
12859 <para>
12860 Another way of thinking about positive and negative items in lists is to read
12861 the connector as <quote>or</quote> after a positive item and as <quote>and</quote> after a negative
12862 item.
12863 </para>
12864 </section>
12865 <section id="SECTfilnamlis">
12866 <title>File names in lists</title>
12867 <para>
12868 <indexterm role="concept">
12869 <primary>list</primary>
12870 <secondary>filename in</secondary>
12871 </indexterm>
12872 If an item in a domain, host, address, or local part list is an absolute
12873 filename (beginning with a slash character), each line of the file is read and
12874 processed as if it were an independent item in the list, except that further
12875 filenames are not allowed,
12876 and no expansion of the data from the file takes place.
12877 Empty lines in the file are ignored, and the file may also contain comment
12878 lines:
12879 </para>
12880 <itemizedlist>
12881 <listitem>
12882 <para>
12883 For domain and host lists, if a # character appears anywhere in a line of the
12884 file, it and all following characters are ignored.
12885 </para>
12886 </listitem>
12887 <listitem>
12888 <para>
12889 Because local parts may legitimately contain # characters, a comment in an
12890 address list or local part list file is recognized only if # is preceded by
12891 white space or the start of the line. For example:
12892 </para>
12893 <literallayout class="monospaced">
12894 not#comment@x.y.z   # but this is a comment
12895 </literallayout>
12896 </listitem>
12897 </itemizedlist>
12898 <para>
12899 Putting a filename in a list has the same effect as inserting each line of the
12900 file as an item in the list (blank lines and comments excepted). However, there
12901 is one important difference: the file is read each time the list is processed,
12902 so if its contents vary over time, Exim&#x2019;s behaviour changes.
12903 </para>
12904 <para>
12905 If a filename is preceded by an exclamation mark, the sense of any match
12906 within the file is inverted. For example, if
12907 </para>
12908 <literallayout class="monospaced">
12909 hold_domains = !/etc/nohold-domains
12910 </literallayout>
12911 <para>
12912 and the file contains the lines
12913 </para>
12914 <literallayout class="monospaced">
12915 !a.b.c
12916 *.b.c
12917 </literallayout>
12918 <para>
12919 then <emphasis>a.b.c</emphasis> is in the set of domains defined by <option>hold_domains</option>, whereas
12920 any domain matching <literal>*.b.c</literal> is not.
12921 </para>
12922 </section>
12923 <section id="SECID77">
12924 <title>An lsearch file is not an out-of-line list</title>
12925 <para>
12926 As will be described in the sections that follow, lookups can be used in lists
12927 to provide indexed methods of checking list membership. There has been some
12928 confusion about the way <command>lsearch</command> lookups work in lists. Because
12929 an <command>lsearch</command> file contains plain text and is scanned sequentially, it is
12930 sometimes thought that it is allowed to contain wild cards and other kinds of
12931 non-constant pattern. This is not the case. The keys in an <command>lsearch</command> file are
12932 always fixed strings, just as for any other single-key lookup type.
12933 </para>
12934 <para>
12935 If you want to use a file to contain wild-card patterns that form part of a
12936 list, just give the filename on its own, without a search type, as described
12937 in the previous section. You could also use the <command>wildlsearch</command> or
12938 <command>nwildlsearch</command>, but there is no advantage in doing this.
12939 </para>
12940 </section>
12941 <section id="SECTlistresults">
12942 <title>Results of list checking</title>
12943 <para>
12944 The primary result of doing a list check is a truth value.
12945 In some contexts additional information is stored
12946 about the list element that matched:
12947 </para>
12948 <variablelist>
12949 <varlistentry>
12950 <term>hosts</term>
12951 <listitem>
12952 <para>
12953 A <option>hosts</option> ACL condition
12954 will store a result in the <varname>$host_data</varname> variable.
12955 </para>
12956 </listitem></varlistentry>
12957 <varlistentry>
12958 <term>local_parts</term>
12959 <listitem>
12960 <para>
12961 A <option>local_parts</option> router option or <option>local_parts</option> ACL condition
12962 will store a result in the <varname>$local_part_data</varname> variable.
12963 </para>
12964 </listitem></varlistentry>
12965 <varlistentry>
12966 <term>domains</term>
12967 <listitem>
12968 <para>
12969 A <option>domains</option> router option or <option>domains</option> ACL condition
12970 will store a result in the <varname>$domain_data</varname> variable.
12971 </para>
12972 </listitem></varlistentry>
12973 <varlistentry>
12974 <term>senders</term>
12975 <listitem>
12976 <para>
12977 A <option>senders</option> router option or <option>senders</option> ACL condition
12978 will store a result in the <varname>$sender_data</varname> variable.
12979 </para>
12980 </listitem></varlistentry>
12981 <varlistentry>
12982 <term>recipients</term>
12983 <listitem>
12984 <para>
12985 A <option>recipients</option> ACL condition
12986 will store a result in the <varname>$recipient_data</varname> variable.
12987 </para>
12988 </listitem></varlistentry>
12989 </variablelist>
12990 <para>
12991 The detail of the additional information depends on the
12992 type of match and is given below as the <emphasis role="bold">value</emphasis> information.
12993 </para>
12994 </section>
12995 <section id="SECTnamedlists">
12996 <title>Named lists</title>
12997 <para>
12998 <indexterm role="concept">
12999 <primary>named lists</primary>
13000 </indexterm>
13001 <indexterm role="concept">
13002 <primary>list</primary>
13003 <secondary>named</secondary>
13004 </indexterm>
13005 A list of domains, hosts, email addresses, or local parts can be given a name
13006 which is then used to refer to the list elsewhere in the configuration. This is
13007 particularly convenient if the same list is required in several different
13008 places. It also allows lists to be given meaningful names, which can improve
13009 the readability of the configuration. For example, it is conventional to define
13010 a domain list called <emphasis>local_domains</emphasis> for all the domains that are handled
13011 locally on a host, using a configuration line such as
13012 </para>
13013 <literallayout class="monospaced">
13014 domainlist local_domains = localhost:my.dom.example
13015 </literallayout>
13016 <para>
13017 Named lists are referenced by giving their name preceded by a plus sign, so,
13018 for example, a router that is intended to handle local domains would be
13019 configured with the line
13020 </para>
13021 <literallayout class="monospaced">
13022 domains = +local_domains
13023 </literallayout>
13024 <para>
13025 The first router in a configuration is often one that handles all domains
13026 except the local ones, using a configuration with a negated item like this:
13027 </para>
13028 <literallayout class="monospaced">
13029 dnslookup:
13030   driver = dnslookup
13031   domains = ! +local_domains
13032   transport = remote_smtp
13033   no_more
13034 </literallayout>
13035 <para>
13036 The four kinds of named list are created by configuration lines starting with
13037 the words <option>domainlist</option>, <option>hostlist</option>, <option>addresslist</option>, or <option>localpartlist</option>,
13038 respectively. Then there follows the name that you are defining, followed by an
13039 equals sign and the list itself. For example:
13040 </para>
13041 <literallayout class="monospaced">
13042 hostlist    relay_from_hosts = 192.168.23.0/24 : my.friend.example
13043 addresslist bad_senders = cdb;/etc/badsenders
13044 </literallayout>
13045 <para>
13046 A named list may refer to other named lists:
13047 </para>
13048 <literallayout class="monospaced">
13049 domainlist  dom1 = first.example : second.example
13050 domainlist  dom2 = +dom1 : third.example
13051 domainlist  dom3 = fourth.example : +dom2 : fifth.example
13052 </literallayout>
13053 <para>
13054 <emphasis role="bold">Warning</emphasis>: If the last item in a referenced list is a negative one, the
13055 effect may not be what you intended, because the negation does not propagate
13056 out to the higher level. For example, consider:
13057 </para>
13058 <literallayout class="monospaced">
13059 domainlist  dom1 = !a.b
13060 domainlist  dom2 = +dom1 : *.b
13061 </literallayout>
13062 <para>
13063 The second list specifies <quote>either in the <option>dom1</option> list or <emphasis>*.b</emphasis></quote>. The first
13064 list specifies just <quote>not <emphasis>a.b</emphasis></quote>, so the domain <emphasis>x.y</emphasis> matches it. That
13065 means it matches the second list as well. The effect is not the same as
13066 </para>
13067 <literallayout class="monospaced">
13068 domainlist  dom2 = !a.b : *.b
13069 </literallayout>
13070 <para>
13071 where <emphasis>x.y</emphasis> does not match. It&#x2019;s best to avoid negation altogether in
13072 referenced lists if you can.
13073 </para>
13074 <para>
13075 <indexterm role="concept">
13076 <primary>hiding named list values</primary>
13077 </indexterm>
13078 <indexterm role="concept">
13079 <primary>named lists</primary>
13080 <secondary>hiding value of</secondary>
13081 </indexterm>
13082 Some named list definitions may contain sensitive data, for example, passwords for
13083 accessing databases. To stop non-admin users from using the <option>-bP</option> command
13084 line option to read these values, you can precede the definition with the
13085 word <quote>hide</quote>. For example:
13086 </para>
13087 <literallayout class="monospaced">
13088 hide domainlist filter_for_domains = ldap;PASS=secret ldap::/// ...
13089 </literallayout>
13090 <para>
13091 Named lists may have a performance advantage. When Exim is routing an
13092 address or checking an incoming message, it caches the result of tests on named
13093 lists. So, if you have a setting such as
13094 </para>
13095 <literallayout class="monospaced">
13096 domains = +local_domains
13097 </literallayout>
13098 <para>
13099 on several of your routers
13100 or in several ACL statements,
13101 the actual test is done only for the first one. However, the caching works only
13102 if there are no expansions within the list itself or any sublists that it
13103 references. In other words, caching happens only for lists that are known to be
13104 the same each time they are referenced.
13105 </para>
13106 <para>
13107 By default, there may be up to 16 named lists of each type. This limit can be
13108 extended by changing a compile-time variable. The use of domain and host lists
13109 is recommended for concepts such as local domains, relay domains, and relay
13110 hosts. The default configuration is set up like this.
13111 </para>
13112 </section>
13113 <section id="SECID78">
13114 <title>Named lists compared with macros</title>
13115 <para>
13116 <indexterm role="concept">
13117 <primary>list</primary>
13118 <secondary>named compared with macro</secondary>
13119 </indexterm>
13120 <indexterm role="concept">
13121 <primary>macro</primary>
13122 <secondary>compared with named list</secondary>
13123 </indexterm>
13124 At first sight, named lists might seem to be no different from macros in the
13125 configuration file. However, macros are just textual substitutions. If you
13126 write
13127 </para>
13128 <literallayout class="monospaced">
13129 ALIST = host1 : host2
13130 auth_advertise_hosts = !ALIST
13131 </literallayout>
13132 <para>
13133 it probably won&#x2019;t do what you want, because that is exactly the same as
13134 </para>
13135 <literallayout class="monospaced">
13136 auth_advertise_hosts = !host1 : host2
13137 </literallayout>
13138 <para>
13139 Notice that the second host name is not negated. However, if you use a host
13140 list, and write
13141 </para>
13142 <literallayout class="monospaced">
13143 hostlist alist = host1 : host2
13144 auth_advertise_hosts = ! +alist
13145 </literallayout>
13146 <para>
13147 the negation applies to the whole list, and so that is equivalent to
13148 </para>
13149 <literallayout class="monospaced">
13150 auth_advertise_hosts = !host1 : !host2
13151 </literallayout>
13152 </section>
13153 <section id="SECID79">
13154 <title>Named list caching</title>
13155 <para>
13156 <indexterm role="concept">
13157 <primary>list</primary>
13158 <secondary>caching of named</secondary>
13159 </indexterm>
13160 <indexterm role="concept">
13161 <primary>caching</primary>
13162 <secondary>named lists</secondary>
13163 </indexterm>
13164 While processing a message, Exim caches the result of checking a named list if
13165 it is sure that the list is the same each time. In practice, this means that
13166 the cache operates only if the list contains no $ characters, which guarantees
13167 that it will not change when it is expanded. Sometimes, however, you may have
13168 an expanded list that you know will be the same each time within a given
13169 message. For example:
13170 </para>
13171 <literallayout class="monospaced">
13172 domainlist special_domains = \
13173            ${lookup{$sender_host_address}cdb{/some/file}}
13174 </literallayout>
13175 <para>
13176 This provides a list of domains that depends only on the sending host&#x2019;s IP
13177 address. If this domain list is referenced a number of times (for example,
13178 in several ACL lines, or in several routers) the result of the check is not
13179 cached by default, because Exim does not know that it is going to be the
13180 same list each time.
13181 </para>
13182 <para>
13183 By appending <literal>_cache</literal> to <literal>domainlist</literal> you can tell Exim to go ahead and
13184 cache the result anyway. For example:
13185 </para>
13186 <literallayout class="monospaced">
13187 domainlist_cache special_domains = ${lookup{...
13188 </literallayout>
13189 <para>
13190 If you do this, you should be absolutely sure that caching is going to do
13191 the right thing in all cases. When in doubt, leave it out.
13192 </para>
13193 </section>
13194 <section id="SECTdomainlist">
13195 <title>Domain lists</title>
13196 <para>
13197 <indexterm role="concept">
13198 <primary>domain list</primary>
13199 <secondary>patterns for</secondary>
13200 </indexterm>
13201 <indexterm role="concept">
13202 <primary>list</primary>
13203 <secondary>domain list</secondary>
13204 </indexterm>
13205 Domain lists contain patterns that are to be matched against a mail domain.
13206 The following types of item may appear in domain lists:
13207 </para>
13208 <itemizedlist>
13209 <listitem>
13210 <para>
13211 <indexterm role="concept">
13212 <primary>primary host name</primary>
13213 </indexterm>
13214 <indexterm role="concept">
13215 <primary>host name</primary>
13216 <secondary>matched in domain list</secondary>
13217 </indexterm>
13218 <indexterm role="option">
13219 <primary><option>primary_hostname</option></primary>
13220 </indexterm>
13221 <indexterm role="concept">
13222 <primary>domain list</primary>
13223 <secondary>matching primary host name</secondary>
13224 </indexterm>
13225 <indexterm role="concept">
13226 <primary>@ in a domain list</primary>
13227 </indexterm>
13228 If a pattern consists of a single @ character, it matches the local host name,
13229 as set by the <option>primary_hostname</option> option (or defaulted). This makes it
13230 possible to use the same configuration file on several different hosts that
13231 differ only in their names.
13232 </para>
13233 <para>
13234 The value for a match will be the primary host name.
13235 </para>
13236 </listitem>
13237 <listitem>
13238 <para>
13239 <indexterm role="concept">
13240 <primary>@[] in a domain list</primary>
13241 </indexterm>
13242 <indexterm role="concept">
13243 <primary>domain list</primary>
13244 <secondary>matching local IP interfaces</secondary>
13245 </indexterm>
13246 <indexterm role="concept">
13247 <primary>domain literal</primary>
13248 </indexterm>
13249 If a pattern consists of the string <literal>@[]</literal> it matches an IP address enclosed
13250 in square brackets (as in an email address that contains a domain literal), but
13251 only if that IP address is recognized as local for email routing purposes. The
13252 <option>local_interfaces</option> and <option>extra_local_interfaces</option> options can be used to
13253 control which of a host&#x2019;s several IP addresses are treated as local.
13254 In today&#x2019;s Internet, the use of domain literals is controversial;
13255 see the <option>allow_domain_literals</option> main option.
13256 </para>
13257 <para>
13258 The value for a match will be the string <literal>@[]</literal>.
13259 </para>
13260 </listitem>
13261 <listitem>
13262 <para>
13263 <indexterm role="concept">
13264 <primary>@mx_any</primary>
13265 </indexterm>
13266 <indexterm role="concept">
13267 <primary>@mx_primary</primary>
13268 </indexterm>
13269 <indexterm role="concept">
13270 <primary>@mx_secondary</primary>
13271 </indexterm>
13272 <indexterm role="concept">
13273 <primary>domain list</primary>
13274 <secondary>matching MX pointers to local host</secondary>
13275 </indexterm>
13276 If a pattern consists of the string <literal>@mx_any</literal> it matches any domain that
13277 has an MX record pointing to the local host or to any host that is listed in
13278 <indexterm role="option">
13279 <primary><option>hosts_treat_as_local</option></primary>
13280 </indexterm>
13281 <option>hosts_treat_as_local</option>. The items <literal>@mx_primary</literal> and <literal>@mx_secondary</literal>
13282 are similar, except that the first matches only when a primary MX target is the
13283 local host, and the second only when no primary MX target is the local host,
13284 but a secondary MX target is. <quote>Primary</quote> means an MX record with the lowest
13285 preference value &ndash; there may of course be more than one of them.
13286 </para>
13287 <para>
13288 The MX lookup that takes place when matching a pattern of this type is
13289 performed with the resolver options for widening names turned off. Thus, for
13290 example, a single-component domain will <emphasis>not</emphasis> be expanded by adding the
13291 resolver&#x2019;s default domain. See the <option>qualify_single</option> and <option>search_parents</option>
13292 options of the <command>dnslookup</command> router for a discussion of domain widening.
13293 </para>
13294 <para>
13295 Sometimes you may want to ignore certain IP addresses when using one of these
13296 patterns. You can specify this by following the pattern with <literal>/ignore=</literal>&lt;<emphasis>ip
13297 list</emphasis>&gt;, where &lt;<emphasis>ip list</emphasis>&gt; is a list of IP addresses. These addresses are
13298 ignored when processing the pattern (compare the <option>ignore_target_hosts</option> option
13299 on a router). For example:
13300 </para>
13301 <literallayout class="monospaced">
13302 domains = @mx_any/ignore=127.0.0.1
13303 </literallayout>
13304 <para>
13305 This example matches any domain that has an MX record pointing to one of
13306 the local host&#x2019;s IP addresses other than 127.0.0.1.
13307 </para>
13308 <para>
13309 The list of IP addresses is in fact processed by the same code that processes
13310 host lists, so it may contain CIDR-coded network specifications and it may also
13311 contain negative items.
13312 </para>
13313 <para>
13314 Because the list of IP addresses is a sublist within a domain list, you have to
13315 be careful about delimiters if there is more than one address. Like any other
13316 list, the default delimiter can be changed. Thus, you might have:
13317 </para>
13318 <literallayout class="monospaced">
13319 domains = @mx_any/ignore=&lt;;127.0.0.1;0.0.0.0 : \
13320           an.other.domain : ...
13321 </literallayout>
13322 <para>
13323 so that the sublist uses semicolons for delimiters. When IPv6 addresses are
13324 involved, it is easiest to change the delimiter for the main list as well:
13325 </para>
13326 <literallayout class="monospaced">
13327 domains = &lt;? @mx_any/ignore=&lt;;127.0.0.1;::1 ? \
13328           an.other.domain ? ...
13329 </literallayout>
13330 <para>
13331 The value for a match will be the list element string (starting <literal>@mx_</literal>).
13332 </para>
13333 </listitem>
13334 <listitem>
13335 <para>
13336 <indexterm role="concept">
13337 <primary>asterisk</primary>
13338 <secondary>in domain list</secondary>
13339 </indexterm>
13340 <indexterm role="concept">
13341 <primary>domain list</primary>
13342 <secondary>asterisk in</secondary>
13343 </indexterm>
13344 <indexterm role="concept">
13345 <primary>domain list</primary>
13346 <secondary>matching <quote>ends with</quote></secondary>
13347 </indexterm>
13348 If a pattern starts with an asterisk, the remaining characters of the pattern
13349 are compared with the terminating characters of the domain. The use of <quote>*</quote> in
13350 domain lists differs from its use in partial matching lookups. In a domain
13351 list, the character following the asterisk need not be a dot, whereas partial
13352 matching works only in terms of dot-separated components. For example, a domain
13353 list item such as <literal>*key.ex</literal> matches <emphasis>donkey.ex</emphasis> as well as
13354 <emphasis>cipher.key.ex</emphasis>.
13355 </para>
13356 <para>
13357 The value for a match will be the list element string (starting with the asterisk).
13358 Additionally, <varname>$0</varname> will be set to the matched string
13359 and <varname>$1</varname> to the variable portion which the asterisk matched.
13360 </para>
13361 </listitem>
13362 <listitem>
13363 <para>
13364 <indexterm role="concept">
13365 <primary>regular expressions</primary>
13366 <secondary>in domain list</secondary>
13367 </indexterm>
13368 <indexterm role="concept">
13369 <primary>domain list</primary>
13370 <secondary>matching regular expression</secondary>
13371 </indexterm>
13372 If a pattern starts with a circumflex character, it is treated as a regular
13373 expression, and matched against the domain using a regular expression matching
13374 function. The circumflex is treated as part of the regular expression.
13375 Email domains are case-independent, so this regular expression match is by
13376 default case-independent, but you can make it case-dependent by starting it
13377 with <literal>(?-i)</literal>. References to descriptions of the syntax of regular expressions
13378 are given in chapter <xref linkend="CHAPregexp"/>.
13379 </para>
13380 <para>
13381 <emphasis role="bold">Warning</emphasis>: Because domain lists are expanded before being processed, you
13382 must escape any backslash and dollar characters in the regular expression, or
13383 use the special <literal>\N</literal> sequence (see chapter <xref linkend="CHAPexpand"/>) to specify that
13384 it is not to be expanded (unless you really do want to build a regular
13385 expression by expansion, of course).
13386 </para>
13387 <para>
13388 The value for a match will be the list element string (starting with the circumflex).
13389 Additionally, <varname>$0</varname> will be set to the string matching the regular expression,
13390 and <varname>$1</varname> (onwards) to any submatches identified by parentheses.
13391 </para>
13392 </listitem>
13393 <listitem>
13394 <para>
13395 <indexterm role="concept">
13396 <primary>lookup</primary>
13397 <secondary>in domain list</secondary>
13398 </indexterm>
13399 <indexterm role="concept">
13400 <primary>domain list</primary>
13401 <secondary>matching by lookup</secondary>
13402 </indexterm>
13403 If a pattern starts with the name of a single-key lookup type followed by a
13404 semicolon (for example, <quote>dbm;</quote> or <quote>lsearch;</quote>), the remainder of the pattern
13405 must be a filename in a suitable format for the lookup type. For example, for
13406 <quote>cdb;</quote> it must be an absolute path:
13407 </para>
13408 <literallayout class="monospaced">
13409 domains = cdb;/etc/mail/local_domains.cdb
13410 </literallayout>
13411 <para>
13412 The appropriate type of lookup is done on the file using the domain name as the
13413 key. In most cases, the value resulting from the lookup is not used; Exim is interested
13414 only in whether or not the key is present in the file. However, when a lookup
13415 is used for the <option>domains</option> option on a router
13416 or a <option>domains</option> condition in an ACL statement, the value is preserved in the
13417 <varname>$domain_data</varname> variable and can be referred to in other router options or
13418 other statements in the same ACL.
13419 <indexterm role="concept">
13420 <primary>tainted data</primary>
13421 <secondary>de-tainting</secondary>
13422 </indexterm>
13423 <indexterm role="concept">
13424 <primary>de-tainting</primary>
13425 <secondary>using ACL domains condition</secondary>
13426 </indexterm>
13427 The value will be untainted.
13428 </para>
13429 <para>
13430 <emphasis role="bold">Note</emphasis>: If the data result of the lookup (as opposed to the key)
13431 is empty, then this empty value is stored in <varname>$domain_data</varname>.
13432 The option to return the key for the lookup, as the value,
13433 may be what is wanted.
13434 </para>
13435 </listitem>
13436 <listitem>
13437 <para>
13438 Any of the single-key lookup type names may be preceded by
13439 <literal>partial</literal>&lt;<emphasis>n</emphasis>&gt;<literal>-</literal>, where the &lt;<emphasis>n</emphasis>&gt; is optional, for example,
13440 </para>
13441 <literallayout class="monospaced">
13442 domains = partial-dbm;/partial/domains
13443 </literallayout>
13444 <para>
13445 This causes partial matching logic to be invoked; a description of how this
13446 works is given in section <xref linkend="SECTpartiallookup"/>.
13447 </para>
13448 </listitem>
13449 <listitem>
13450 <para>
13451 <indexterm role="concept">
13452 <primary>asterisk</primary>
13453 <secondary>in lookup type</secondary>
13454 </indexterm>
13455 Any of the single-key lookup types may be followed by an asterisk. This causes
13456 a default lookup for a key consisting of a single asterisk to be done if the
13457 original lookup fails. This is not a useful feature when using a domain list to
13458 select particular domains (because any domain would match), but it might have
13459 value if the result of the lookup is being used via the <varname>$domain_data</varname>
13460 expansion variable.
13461 </para>
13462 </listitem>
13463 <listitem>
13464 <para>
13465 If the pattern starts with the name of a query-style lookup type followed by a
13466 semicolon (for example, <quote>nisplus;</quote> or <quote>ldap;</quote>), the remainder of the
13467 pattern must be an appropriate query for the lookup type, as described in
13468 chapter <xref linkend="CHAPfdlookup"/>. For example:
13469 </para>
13470 <literallayout class="monospaced">
13471 hold_domains = mysql;select domain from holdlist \
13472   where domain = '${quote_mysql:$domain}';
13473 </literallayout>
13474 <para>
13475 In most cases, the value resulting from the lookup is not used (so for an SQL query, for
13476 example, it doesn&#x2019;t matter what field you select). Exim is interested only in
13477 whether or not the query succeeds. However, when a lookup is used for the
13478 <option>domains</option> option on a router, the value is preserved in the <varname>$domain_data</varname>
13479 variable and can be referred to in other options.
13480 <indexterm role="concept">
13481 <primary>tainted data</primary>
13482 <secondary>de-tainting</secondary>
13483 </indexterm>
13484 <indexterm role="concept">
13485 <primary>de-tainting</primary>
13486 <secondary>using router domains option</secondary>
13487 </indexterm>
13488 The value will be untainted.
13489 </para>
13490 </listitem>
13491 <listitem>
13492 <para>
13493 If the pattern starts with the name of a lookup type
13494 of either kind (single-key or query-style) it may be
13495 followed by a comma and options,
13496 The options are lookup-type specific and consist of a comma-separated list.
13497 Each item starts with a tag and and equals "=" sign.
13498 </para>
13499 </listitem>
13500 <listitem>
13501 <para>
13502 <indexterm role="concept">
13503 <primary>domain list</primary>
13504 <secondary>matching literal domain name</secondary>
13505 </indexterm>
13506 If none of the above cases apply, a caseless textual comparison is made
13507 between the pattern and the domain.
13508 </para>
13509 <para>
13510 The value for a match will be the list element string.
13511 <indexterm role="concept">
13512 <primary>tainted data</primary>
13513 <secondary>de-tainting</secondary>
13514 </indexterm>
13515 Note that this is commonly untainted
13516 (depending on the way the list was created).
13517 Specifically, explicit text in the configuration file in not tainted.
13518 This is a useful way of obtaining an untainted equivalent to
13519 the domain, for later operations.
13520 </para>
13521 <para>
13522 However if the list (including one-element lists)
13523 is created by expanding a variable containing tainted data,
13524 it is tainted and so will the match value be.
13525 </para>
13526 </listitem>
13527 </itemizedlist>
13528 <para>
13529 Here is an example that uses several different kinds of pattern:
13530 </para>
13531 <literallayout class="monospaced">
13532 domainlist funny_domains = \
13533   @ : \
13534   lib.unseen.edu : \
13535   *.foundation.fict.example : \
13536   \N^[1-2]\d{3}\.fict\.example$\N : \
13537   partial-dbm;/opt/data/penguin/book : \
13538   nis;domains.byname : \
13539   nisplus;[name=$domain,status=local],domains.org_dir
13540 </literallayout>
13541 <para>
13542 There are obvious processing trade-offs among the various matching modes. Using
13543 an asterisk is faster than a regular expression, and listing a few names
13544 explicitly probably is too. The use of a file or database lookup is expensive,
13545 but may be the only option if hundreds of names are required. Because the
13546 patterns are tested in order, it makes sense to put the most commonly matched
13547 patterns earlier.
13548 </para>
13549 </section>
13550 <section id="SECThostlist">
13551 <title>Host lists</title>
13552 <para>
13553 <indexterm role="concept">
13554 <primary>host list</primary>
13555 <secondary>patterns in</secondary>
13556 </indexterm>
13557 <indexterm role="concept">
13558 <primary>list</primary>
13559 <secondary>host list</secondary>
13560 </indexterm>
13561 Host lists are used to control what remote hosts are allowed to do. For
13562 example, some hosts may be allowed to use the local host as a relay, and some
13563 may be permitted to use the SMTP ETRN command. Hosts can be identified in
13564 two different ways, by name or by IP address. In a host list, some types of
13565 pattern are matched to a host name, and some are matched to an IP address.
13566 You need to be particularly careful with this when single-key lookups are
13567 involved, to ensure that the right value is being used as the key.
13568 </para>
13569 </section>
13570 <section id="SECID80">
13571 <title>Special host list patterns</title>
13572 <para>
13573 <indexterm role="concept">
13574 <primary>empty item in hosts list</primary>
13575 </indexterm>
13576 <indexterm role="concept">
13577 <primary>host list</primary>
13578 <secondary>empty string in</secondary>
13579 </indexterm>
13580 If a host list item is the empty string, it matches only when no remote host is
13581 involved. This is the case when a message is being received from a local
13582 process using SMTP on the standard input, that is, when a TCP/IP connection is
13583 not used.
13584 </para>
13585 <para>
13586 <indexterm role="concept">
13587 <primary>asterisk</primary>
13588 <secondary>in host list</secondary>
13589 </indexterm>
13590 The special pattern <quote>*</quote> in a host list matches any host or no host. Neither
13591 the IP address nor the name is actually inspected.
13592 </para>
13593 </section>
13594 <section id="SECThoslispatip">
13595 <title>Host list patterns that match by IP address</title>
13596 <para>
13597 <indexterm role="concept">
13598 <primary>host list</primary>
13599 <secondary>matching IP addresses</secondary>
13600 </indexterm>
13601 If an IPv4 host calls an IPv6 host and the call is accepted on an IPv6 socket,
13602 the incoming address actually appears in the IPv6 host as
13603 <literal>::ffff:</literal>&lt;<emphasis>v4address</emphasis>&gt;. When such an address is tested against a host
13604 list, it is converted into a traditional IPv4 address first. (Not all operating
13605 systems accept IPv4 calls on IPv6 sockets, as there have been some security
13606 concerns.)
13607 </para>
13608 <para>
13609 The following types of pattern in a host list check the remote host by
13610 inspecting its IP address:
13611 </para>
13612 <itemizedlist>
13613 <listitem>
13614 <para>
13615 If the pattern is a plain domain name (not a regular expression, not starting
13616 with *, not a lookup of any kind), Exim calls the operating system function
13617 to find the associated IP address(es). Exim uses the newer
13618 <function>getipnodebyname()</function> function when available, otherwise <function>gethostbyname()</function>.
13619 This typically causes a forward DNS lookup of the name. The result is compared
13620 with the IP address of the subject host.
13621 </para>
13622 <para>
13623 If there is a temporary problem (such as a DNS timeout) with the host name
13624 lookup, a temporary error occurs. For example, if the list is being used in an
13625 ACL condition, the ACL gives a <quote>defer</quote> response, usually leading to a
13626 temporary SMTP error code. If no IP address can be found for the host name,
13627 what happens is described in section <xref linkend="SECTbehipnot"/> below.
13628 </para>
13629 </listitem>
13630 <listitem>
13631 <para>
13632 <indexterm role="concept">
13633 <primary>@ in a host list</primary>
13634 </indexterm>
13635 If the pattern is <quote>@</quote>, the primary host name is substituted and used as a
13636 domain name, as just described.
13637 </para>
13638 </listitem>
13639 <listitem>
13640 <para>
13641 If the pattern is an IP address, it is matched against the IP address of the
13642 subject host. IPv4 addresses are given in the normal <quote>dotted-quad</quote> notation.
13643 IPv6 addresses can be given in colon-separated format, but the colons have to
13644 be doubled so as not to be taken as item separators when the default list
13645 separator is used. IPv6 addresses are recognized even when Exim is compiled
13646 without IPv6 support. This means that if they appear in a host list on an
13647 IPv4-only host, Exim will not treat them as host names. They are just addresses
13648 that can never match a client host.
13649 </para>
13650 </listitem>
13651 <listitem>
13652 <para>
13653 <indexterm role="concept">
13654 <primary>@[] in a host list</primary>
13655 </indexterm>
13656 If the pattern is <quote>@[]</quote>, it matches the IP address of any IP interface on
13657 the local host. For example, if the local host is an IPv4 host with one
13658 interface address 10.45.23.56, these two ACL statements have the same effect:
13659 </para>
13660 <literallayout class="monospaced">
13661 accept hosts = 127.0.0.1 : 10.45.23.56
13662 accept hosts = @[]
13663 </literallayout>
13664 </listitem>
13665 <listitem>
13666 <para>
13667 <indexterm role="concept">
13668 <primary>CIDR notation</primary>
13669 </indexterm>
13670 If the pattern is an IP address followed by a slash and a mask length, for
13671 example
13672 </para>
13673 <literallayout class="monospaced">
13674 10.11.42.0/24
13675 </literallayout>
13676 <para>
13677 , it is matched against the IP address of the subject
13678 host under the given mask. This allows an entire network of hosts to be
13679 included (or excluded) by a single item. The mask uses CIDR notation; it
13680 specifies the number of address bits that must match, starting from the most
13681 significant end of the address.
13682 </para>
13683 <para>
13684 <emphasis role="bold">Note</emphasis>: The mask is <emphasis>not</emphasis> a count of addresses, nor is it the high number
13685 of a range of addresses. It is the number of bits in the network portion of the
13686 address. The above example specifies a 24-bit netmask, so it matches all 256
13687 addresses in the 10.11.42.0 network. An item such as
13688 </para>
13689 <literallayout class="monospaced">
13690 192.168.23.236/31
13691 </literallayout>
13692 <para>
13693 matches just two addresses, 192.168.23.236 and 192.168.23.237. A mask value of
13694 32 for an IPv4 address is the same as no mask at all; just a single address
13695 matches.
13696 </para>
13697 <para>
13698 Here is another example which shows an IPv4 and an IPv6 network:
13699 </para>
13700 <literallayout class="monospaced">
13701 recipient_unqualified_hosts = 192.168.0.0/16: \
13702                               3ffe::ffff::836f::::/48
13703 </literallayout>
13704 <para>
13705 The doubling of list separator characters applies only when these items
13706 appear inline in a host list. It is not required when indirecting via a file.
13707 For example:
13708 </para>
13709 <literallayout class="monospaced">
13710 recipient_unqualified_hosts = /opt/exim/unqualnets
13711 </literallayout>
13712 <para>
13713 could make use of a file containing
13714 </para>
13715 <literallayout class="monospaced">
13716 172.16.0.0/12
13717 3ffe:ffff:836f::/48
13718 </literallayout>
13719 <para>
13720 to have exactly the same effect as the previous example. When listing IPv6
13721 addresses inline, it is usually more convenient to use the facility for
13722 changing separator characters. This list contains the same two networks:
13723 </para>
13724 <literallayout class="monospaced">
13725 recipient_unqualified_hosts = &lt;; 172.16.0.0/12; \
13726                                  3ffe:ffff:836f::/48
13727 </literallayout>
13728 <para>
13729 The separator is changed to semicolon by the leading <quote>&lt;;</quote> at the start of the
13730 list.
13731 </para>
13732 </listitem>
13733 </itemizedlist>
13734 </section>
13735 <section id="SECThoslispatsikey">
13736 <title>Host list patterns for single-key lookups by host address</title>
13737 <para>
13738 <indexterm role="concept">
13739 <primary>host list</primary>
13740 <secondary>lookup of IP address</secondary>
13741 </indexterm>
13742 When a host is to be identified by a single-key lookup of its complete IP
13743 address, the pattern takes this form:
13744 </para>
13745 <literallayout>
13746 <literal>net-&lt;</literal><emphasis>single-key-search-type</emphasis><literal>&gt;;&lt;</literal><emphasis>search-data</emphasis><literal>&gt;</literal>
13747 </literallayout>
13748 <para>
13749 For example:
13750 </para>
13751 <literallayout class="monospaced">
13752 hosts_lookup = net-cdb;/hosts-by-ip.db
13753 </literallayout>
13754 <para>
13755 The text form of the IP address of the subject host is used as the lookup key.
13756 IPv6 addresses are converted to an unabbreviated form, using lower case
13757 letters, with dots as separators because colon is the key terminator in
13758 <command>lsearch</command> files. [Colons can in fact be used in keys in <command>lsearch</command> files by
13759 quoting the keys, but this is a facility that was added later.] The data
13760 returned by the lookup is not used.
13761 </para>
13762 <para>
13763 <indexterm role="concept">
13764 <primary>IP address</primary>
13765 <secondary>masking</secondary>
13766 </indexterm>
13767 <indexterm role="concept">
13768 <primary>host list</primary>
13769 <secondary>masked IP address</secondary>
13770 </indexterm>
13771 Single-key lookups can also be performed using masked IP addresses, using
13772 patterns of this form:
13773 </para>
13774 <literallayout>
13775 <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>
13776 </literallayout>
13777 <para>
13778 For example:
13779 </para>
13780 <literallayout class="monospaced">
13781 net24-dbm;/networks.db
13782 </literallayout>
13783 <para>
13784 The IP address of the subject host is masked using &lt;<emphasis>number</emphasis>&gt; as the mask
13785 length. A textual string is constructed from the masked value, followed by the
13786 mask, and this is used as the lookup key. For example, if the host&#x2019;s IP address
13787 is 192.168.34.6, the key that is looked up for the above example is
13788 <quote>192.168.34.0/24</quote>.
13789 </para>
13790 <para>
13791 When an IPv6 address is converted to a string, dots are normally used instead
13792 of colons, so that keys in <command>lsearch</command> files need not contain colons (which
13793 terminate <command>lsearch</command> keys). This was implemented some time before the ability
13794 to quote keys was made available in <command>lsearch</command> files. However, the more
13795 recently implemented <command>iplsearch</command> files do require colons in IPv6 keys
13796 (notated using the quoting facility) so as to distinguish them from IPv4 keys.
13797 For this reason, when the lookup type is <command>iplsearch</command>, IPv6 addresses are
13798 converted using colons and not dots.
13799 In all cases except IPv4-mapped IPv6, full, unabbreviated IPv6
13800 addresses are always used.
13801 The latter are converted to IPv4 addresses, in dotted-quad form.
13802 </para>
13803 <para>
13804 Ideally, it would be nice to tidy up this anomalous situation by changing to
13805 colons in all cases, given that quoting is now available for <command>lsearch</command>.
13806 However, this would be an incompatible change that might break some existing
13807 configurations.
13808 </para>
13809 <para>
13810 <emphasis role="bold">Warning</emphasis>: Specifying <option>net32-</option> (for an IPv4 address) or <option>net128-</option> (for an
13811 IPv6 address) is not the same as specifying just <option>net-</option> without a number. In
13812 the former case the key strings include the mask value, whereas in the latter
13813 case the IP address is used on its own.
13814 </para>
13815 </section>
13816 <section id="SECThoslispatnam">
13817 <title>Host list patterns that match by host name</title>
13818 <para>
13819 <indexterm role="concept">
13820 <primary>host</primary>
13821 <secondary>lookup failures</secondary>
13822 </indexterm>
13823 <indexterm role="concept">
13824 <primary>unknown host name</primary>
13825 </indexterm>
13826 <indexterm role="concept">
13827 <primary>host list</primary>
13828 <secondary>matching host name</secondary>
13829 </indexterm>
13830 There are several types of pattern that require Exim to know the name of the
13831 remote host. These are either wildcard patterns or lookups by name. (If a
13832 complete hostname is given without any wildcarding, it is used to find an IP
13833 address to match against, as described in section <xref linkend="SECThoslispatip"/>
13834 above.)
13835 </para>
13836 <para>
13837 If the remote host name is not already known when Exim encounters one of these
13838 patterns, it has to be found from the IP address.
13839 Although many sites on the Internet are conscientious about maintaining reverse
13840 DNS data for their hosts, there are also many that do not do this.
13841 Consequently, a name cannot always be found, and this may lead to unwanted
13842 effects. Take care when configuring host lists with wildcarded name patterns.
13843 Consider what will happen if a name cannot be found.
13844 </para>
13845 <para>
13846 Because of the problems of determining host names from IP addresses, matching
13847 against host names is not as common as matching against IP addresses.
13848 </para>
13849 <para>
13850 By default, in order to find a host name, Exim first does a reverse DNS lookup;
13851 if no name is found in the DNS, the system function (<function>gethostbyaddr()</function> or
13852 <function>getipnodebyaddr()</function> if available) is tried. The order in which these lookups
13853 are done can be changed by setting the <option>host_lookup_order</option> option. For
13854 security, once Exim has found one or more names, it looks up the IP addresses
13855 for these names and compares them with the IP address that it started with.
13856 Only those names whose IP addresses match are accepted. Any other names are
13857 discarded. If no names are left, Exim behaves as if the host name cannot be
13858 found. In the most common case there is only one name and one IP address.
13859 </para>
13860 <para>
13861 There are some options that control what happens if a host name cannot be
13862 found. These are described in section <xref linkend="SECTbehipnot"/> below.
13863 </para>
13864 <para>
13865 <indexterm role="concept">
13866 <primary>host</primary>
13867 <secondary>alias for</secondary>
13868 </indexterm>
13869 <indexterm role="concept">
13870 <primary>alias for host</primary>
13871 </indexterm>
13872 As a result of aliasing, hosts may have more than one name. When processing any
13873 of the following types of pattern, all the host&#x2019;s names are checked:
13874 </para>
13875 <itemizedlist>
13876 <listitem>
13877 <para>
13878 <indexterm role="concept">
13879 <primary>asterisk</primary>
13880 <secondary>in host list</secondary>
13881 </indexterm>
13882 If a pattern starts with <quote>*</quote> the remainder of the item must match the end of
13883 the host name. For example, <literal>*.b.c</literal> matches all hosts whose names end in
13884 <emphasis>.b.c</emphasis>. This special simple form is provided because this is a very common
13885 requirement. Other kinds of wildcarding require the use of a regular
13886 expression.
13887 </para>
13888 </listitem>
13889 <listitem>
13890 <para>
13891 <indexterm role="concept">
13892 <primary>regular expressions</primary>
13893 <secondary>in host list</secondary>
13894 </indexterm>
13895 <indexterm role="concept">
13896 <primary>host list</primary>
13897 <secondary>regular expression in</secondary>
13898 </indexterm>
13899 If the item starts with <quote>^</quote> it is taken to be a regular expression which is
13900 matched against the host name. Host names are case-independent, so this regular
13901 expression match is by default case-independent, but you can make it
13902 case-dependent by starting it with <literal>(?-i)</literal>. References to descriptions of the
13903 syntax of regular expressions are given in chapter <xref linkend="CHAPregexp"/>. For
13904 example,
13905 </para>
13906 <literallayout class="monospaced">
13907 ^(a|b)\.c\.d$
13908 </literallayout>
13909 <para>
13910 is a regular expression that matches either of the two hosts <emphasis>a.c.d</emphasis> or
13911 <emphasis>b.c.d</emphasis>. When a regular expression is used in a host list, you must take care
13912 that backslash and dollar characters are not misinterpreted as part of the
13913 string expansion. The simplest way to do this is to use <literal>\N</literal> to mark that
13914 part of the string as non-expandable. For example:
13915 </para>
13916 <literallayout class="monospaced">
13917 sender_unqualified_hosts = \N^(a|b)\.c\.d$\N : ....
13918 </literallayout>
13919 <para>
13920 <emphasis role="bold">Warning</emphasis>: If you want to match a complete host name, you must include the
13921 <literal>$</literal> terminating metacharacter in the regular expression, as in the above
13922 example. Without it, a match at the start of the host name is all that is
13923 required.
13924 </para>
13925 </listitem>
13926 </itemizedlist>
13927 </section>
13928 <section id="SECTbehipnot">
13929 <title>Behaviour when an IP address or name cannot be found</title>
13930 <para>
13931 <indexterm role="concept">
13932 <primary>host</primary>
13933 <secondary>lookup failures, permanent</secondary>
13934 </indexterm>
13935 While processing a host list, Exim may need to look up an IP address from a
13936 name (see section <xref linkend="SECThoslispatip"/>), or it may need to look up a host name
13937 from an IP address (see section <xref linkend="SECThoslispatnam"/>). In either case, the
13938 behaviour when it fails to find the information it is seeking is the same.
13939 </para>
13940 <para>
13941 <emphasis role="bold">Note</emphasis>: This section applies to permanent lookup failures. It does <emphasis>not</emphasis>
13942 apply to temporary DNS errors, whose handling is described in the next section.
13943 </para>
13944 <para>
13945 <indexterm role="concept">
13946 <primary><literal>+include_unknown</literal></primary>
13947 </indexterm>
13948 <indexterm role="concept">
13949 <primary><literal>+ignore_unknown</literal></primary>
13950 </indexterm>
13951 Exim parses a host list from left to right. If it encounters a permanent
13952 lookup failure in any item in the host list before it has found a match,
13953 Exim treats it as a failure and the default behavior is as if the host
13954 does not match the list. This may not always be what you want to happen.
13955 To change Exim&#x2019;s behaviour, the special items <literal>+include_unknown</literal> or
13956 <literal>+ignore_unknown</literal> may appear in the list (at top level &ndash; they are
13957 not recognized in an indirected file).
13958 </para>
13959 <itemizedlist>
13960 <listitem>
13961 <para>
13962 If any item that follows <literal>+include_unknown</literal> requires information that
13963 cannot found, Exim behaves as if the host does match the list. For example,
13964 </para>
13965 <literallayout class="monospaced">
13966 host_reject_connection = +include_unknown:*.enemy.ex
13967 </literallayout>
13968 <para>
13969 rejects connections from any host whose name matches <literal>*.enemy.ex</literal>, and also
13970 any hosts whose name it cannot find.
13971 </para>
13972 </listitem>
13973 <listitem>
13974 <para>
13975 If any item that follows <literal>+ignore_unknown</literal> requires information that cannot
13976 be found, Exim ignores that item and proceeds to the rest of the list. For
13977 example:
13978 </para>
13979 <literallayout class="monospaced">
13980 accept hosts = +ignore_unknown : friend.example : \
13981                192.168.4.5
13982 </literallayout>
13983 <para>
13984 accepts from any host whose name is <emphasis>friend.example</emphasis> and from 192.168.4.5,
13985 whether or not its host name can be found. Without <literal>+ignore_unknown</literal>, if no
13986 name can be found for 192.168.4.5, it is rejected.
13987 </para>
13988 </listitem>
13989 </itemizedlist>
13990 <para>
13991 Both <literal>+include_unknown</literal> and <literal>+ignore_unknown</literal> may appear in the same
13992 list. The effect of each one lasts until the next, or until the end of the
13993 list.
13994 </para>
13995 </section>
13996 <section id="SECTmixwilhos">
13997 <title>Mixing wildcarded host names and addresses in host lists</title>
13998 <para>
13999 <indexterm role="concept">
14000 <primary>host list</primary>
14001 <secondary>mixing names and addresses in</secondary>
14002 </indexterm>
14003 </para>
14004 <para>
14005 This section explains the host/ip processing logic with the same concepts
14006 as the previous section, but specifically addresses what happens when a
14007 wildcarded hostname is one of the items in the hostlist.
14008 </para>
14009 <itemizedlist>
14010 <listitem>
14011 <para>
14012 If you have name lookups or wildcarded host names and
14013 IP addresses in the same host list, you should normally put the IP
14014 addresses first. For example, in an ACL you could have:
14015 </para>
14016 <literallayout class="monospaced">
14017 accept hosts = 10.9.8.7 : *.friend.example
14018 </literallayout>
14019 <para>
14020 The reason you normally would order it this way lies in the
14021 left-to-right way that Exim processes lists.  It can test IP addresses
14022 without doing any DNS lookups, but when it reaches an item that requires
14023 a host name, it fails if it cannot find a host name to compare with the
14024 pattern. If the above list is given in the opposite order, the
14025 <option>accept</option> statement fails for a host whose name cannot be found, even
14026 if its IP address is 10.9.8.7.
14027 </para>
14028 </listitem>
14029 <listitem>
14030 <para>
14031 If you really do want to do the name check first, and still recognize the IP
14032 address, you can rewrite the ACL like this:
14033 </para>
14034 <literallayout class="monospaced">
14035 accept hosts = *.friend.example
14036 accept hosts = 10.9.8.7
14037 </literallayout>
14038 <para>
14039 If the first <option>accept</option> fails, Exim goes on to try the second one. See chapter
14040 <xref linkend="CHAPACL"/> for details of ACLs. Alternatively, you can use
14041 <literal>+ignore_unknown</literal>, which was discussed in depth in the first example in
14042 this section.
14043 </para>
14044 </listitem>
14045 </itemizedlist>
14046 </section>
14047 <section id="SECTtemdnserr">
14048 <title>Temporary DNS errors when looking up host information</title>
14049 <para>
14050 <indexterm role="concept">
14051 <primary>host</primary>
14052 <secondary>lookup failures, temporary</secondary>
14053 </indexterm>
14054 <indexterm role="concept">
14055 <primary><literal>+include_defer</literal></primary>
14056 </indexterm>
14057 <indexterm role="concept">
14058 <primary><literal>+ignore_defer</literal></primary>
14059 </indexterm>
14060 A temporary DNS lookup failure normally causes a defer action (except when
14061 <option>dns_again_means_nonexist</option> converts it into a permanent error). However,
14062 host lists can include <literal>+ignore_defer</literal> and <literal>+include_defer</literal>, analogous to
14063 <literal>+ignore_unknown</literal> and <literal>+include_unknown</literal>, as described in the previous
14064 section. These options should be used with care, probably only in non-critical
14065 host lists such as whitelists.
14066 </para>
14067 </section>
14068 <section id="SECThoslispatnamsk">
14069 <title>Host list patterns for single-key lookups by host name</title>
14070 <para>
14071 <indexterm role="concept">
14072 <primary>unknown host name</primary>
14073 </indexterm>
14074 <indexterm role="concept">
14075 <primary>host list</primary>
14076 <secondary>matching host name</secondary>
14077 </indexterm>
14078 If a pattern is of the form
14079 </para>
14080 <literallayout>
14081 &lt;<emphasis>single-key-search-type</emphasis>&gt;;&lt;<emphasis>search-data</emphasis>&gt;
14082 </literallayout>
14083 <para>
14084 for example
14085 </para>
14086 <literallayout class="monospaced">
14087 dbm;/host/accept/list
14088 </literallayout>
14089 <para>
14090 a single-key lookup is performed, using the host name as its key. If the
14091 lookup succeeds, the host matches the item. The actual data that is looked up
14092 is not used.
14093 </para>
14094 <para>
14095 <emphasis role="bold">Reminder</emphasis>: With this kind of pattern, you must have host <emphasis>names</emphasis> as
14096 keys in the file, not IP addresses. If you want to do lookups based on IP
14097 addresses, you must precede the search type with <quote>net-</quote> (see section
14098 <xref linkend="SECThoslispatsikey"/>). There is, however, no reason why you could not use
14099 two items in the same list, one doing an address lookup and one doing a name
14100 lookup, both using the same file.
14101 </para>
14102 </section>
14103 <section id="SECID81">
14104 <title>Host list patterns for query-style lookups</title>
14105 <para>
14106 If a pattern is of the form
14107 </para>
14108 <literallayout>
14109 &lt;<emphasis>query-style-search-type</emphasis>&gt;;&lt;<emphasis>query</emphasis>&gt;
14110 </literallayout>
14111 <para>
14112 the query is obeyed, and if it succeeds, the host matches the item. The actual
14113 data that is looked up is not used. The variables <varname>$sender_host_address</varname> and
14114 <varname>$sender_host_name</varname> can be used in the query. For example:
14115 </para>
14116 <literallayout class="monospaced">
14117 hosts_lookup = pgsql;\
14118   select ip from hostlist where ip='$sender_host_address'
14119 </literallayout>
14120 <para>
14121 The value of <varname>$sender_host_address</varname> for an IPv6 address contains colons. You
14122 can use the <option>sg</option> expansion item to change this if you need to. If you want to
14123 use masked IP addresses in database queries, you can use the <option>mask</option> expansion
14124 operator.
14125 </para>
14126 <para>
14127 If the query contains a reference to <varname>$sender_host_name</varname>, Exim automatically
14128 looks up the host name if it has not already done so. (See section
14129 <xref linkend="SECThoslispatnam"/> for comments on finding host names.)
14130 </para>
14131 <para>
14132 Historical note: prior to release 4.30, Exim would always attempt to find a
14133 host name before running the query, unless the search type was preceded by
14134 <literal>net-</literal>. This is no longer the case. For backwards compatibility, <literal>net-</literal> is
14135 still recognized for query-style lookups, but its presence or absence has no
14136 effect. (Of course, for single-key lookups, <literal>net-</literal> <emphasis>is</emphasis> important.
14137 See section <xref linkend="SECThoslispatsikey"/>.)
14138 </para>
14139 </section>
14140 <section id="SECTaddresslist">
14141 <title>Address lists</title>
14142 <para>
14143 <indexterm role="concept">
14144 <primary>list</primary>
14145 <secondary>address list</secondary>
14146 </indexterm>
14147 <indexterm role="concept">
14148 <primary>address list</primary>
14149 <secondary>empty item</secondary>
14150 </indexterm>
14151 <indexterm role="concept">
14152 <primary>address list</primary>
14153 <secondary>patterns</secondary>
14154 </indexterm>
14155 Address lists contain patterns that are matched against mail addresses. There
14156 is one special case to be considered: the sender address of a bounce message is
14157 always empty. You can test for this by providing an empty item in an address
14158 list. For example, you can set up a router to process bounce messages by
14159 using this option setting:
14160 </para>
14161 <literallayout class="monospaced">
14162 senders = :
14163 </literallayout>
14164 <para>
14165 The presence of the colon creates an empty item. If you do not provide any
14166 data, the list is empty and matches nothing. The empty sender can also be
14167 detected by a regular expression that matches an empty string,
14168 and by a query-style lookup that succeeds when <varname>$sender_address</varname> is empty.
14169 </para>
14170 <para>
14171 Non-empty items in an address list can be straightforward email addresses. For
14172 example:
14173 </para>
14174 <literallayout class="monospaced">
14175 senders = jbc@askone.example : hs@anacreon.example
14176 </literallayout>
14177 <para>
14178 A certain amount of wildcarding is permitted. If a pattern contains an @
14179 character, but is not a regular expression and does not begin with a
14180 semicolon-terminated lookup type (described below), the local part of the
14181 subject address is compared with the local part of the pattern, which may start
14182 with an asterisk. If the local parts match, the domain is checked in exactly
14183 the same way as for a pattern in a domain list. For example, the domain can be
14184 wildcarded, refer to a named list, or be a lookup:
14185 </para>
14186 <literallayout class="monospaced">
14187 deny senders = *@*.spamming.site:\
14188                *@+hostile_domains:\
14189                bozo@partial-lsearch;/list/of/dodgy/sites:\
14190                *@dbm;/bad/domains.db
14191 </literallayout>
14192 <para>
14193 <indexterm role="concept">
14194 <primary>local part</primary>
14195 <secondary>starting with !</secondary>
14196 </indexterm>
14197 <indexterm role="concept">
14198 <primary>address list</primary>
14199 <secondary>local part starting with !</secondary>
14200 </indexterm>
14201 If a local part that begins with an exclamation mark is required, it has to be
14202 specified using a regular expression, because otherwise the exclamation mark is
14203 treated as a sign of negation, as is standard in lists.
14204 </para>
14205 <para>
14206 If a non-empty pattern that is not a regular expression or a lookup does not
14207 contain an @ character, it is matched against the domain part of the subject
14208 address. The only two formats that are recognized this way are a literal
14209 domain, or a domain pattern that starts with *. In both these cases, the effect
14210 is the same as if <literal>*@</literal> preceded the pattern. For example:
14211 </para>
14212 <literallayout class="monospaced">
14213 deny senders = enemy.domain : *.enemy.domain
14214 </literallayout>
14215 <para>
14216 The following kinds of more complicated address list pattern can match any
14217 address, including the empty address that is characteristic of bounce message
14218 senders:
14219 </para>
14220 <itemizedlist>
14221 <listitem>
14222 <para>
14223 <indexterm role="concept">
14224 <primary>regular expressions</primary>
14225 <secondary>in address list</secondary>
14226 </indexterm>
14227 <indexterm role="concept">
14228 <primary>address list</primary>
14229 <secondary>regular expression in</secondary>
14230 </indexterm>
14231 If (after expansion) a pattern starts with <quote>^</quote>, a regular expression match is
14232 done against the complete address, with the pattern as the regular expression.
14233 You must take care that backslash and dollar characters are not misinterpreted
14234 as part of the string expansion. The simplest way to do this is to use <literal>\N</literal>
14235 to mark that part of the string as non-expandable. For example:
14236 </para>
14237 <literallayout class="monospaced">
14238 deny senders = \N^.*this.*@example\.com$\N : \
14239                \N^\d{8}.+@spamhaus.example$\N : ...
14240 </literallayout>
14241 <para>
14242 The <literal>\N</literal> sequences are removed by the expansion, so these items do indeed
14243 start with <quote>^</quote> by the time they are being interpreted as address patterns.
14244 </para>
14245 </listitem>
14246 <listitem>
14247 <para>
14248 <indexterm role="concept">
14249 <primary>address list</primary>
14250 <secondary>lookup for complete address</secondary>
14251 </indexterm>
14252 Complete addresses can be looked up by using a pattern that starts with a
14253 lookup type terminated by a semicolon, followed by the data for the lookup. For
14254 example:
14255 </para>
14256 <literallayout class="monospaced">
14257 deny senders = cdb;/etc/blocked.senders : \
14258   mysql;select address from blocked where \
14259   address='${quote_mysql:$sender_address}'
14260 </literallayout>
14261 <para>
14262 Both query-style and single-key lookup types can be used. For a single-key
14263 lookup type, Exim uses the complete address as the key. However, empty keys are
14264 not supported for single-key lookups, so a match against the empty address
14265 always fails. This restriction does not apply to query-style lookups.
14266 </para>
14267 <para>
14268 Partial matching for single-key lookups (section <xref linkend="SECTpartiallookup"/>)
14269 cannot be used, and is ignored if specified, with an entry being written to the
14270 panic log.
14271 <indexterm role="concept">
14272 <primary>*@ with single-key lookup</primary>
14273 </indexterm>
14274 However, you can configure lookup defaults, as described in section
14275 <xref linkend="SECTdefaultvaluelookups"/>, but this is useful only for the <quote>*@</quote> type of
14276 default. For example, with this lookup:
14277 </para>
14278 <literallayout class="monospaced">
14279 accept senders = lsearch*@;/some/file
14280 </literallayout>
14281 <para>
14282 the file could contains lines like this:
14283 </para>
14284 <literallayout class="monospaced">
14285 user1@domain1.example
14286 *@domain2.example
14287 </literallayout>
14288 <para>
14289 and for the sender address <emphasis>nimrod@jaeger.example</emphasis>, the sequence of keys
14290 that are tried is:
14291 </para>
14292 <literallayout class="monospaced">
14293 nimrod@jaeger.example
14294 *@jaeger.example
14295 *
14296 </literallayout>
14297 <para>
14298 <emphasis role="bold">Warning 1</emphasis>: Do not include a line keyed by <quote>*</quote> in the file, because that
14299 would mean that every address matches, thus rendering the test useless.
14300 </para>
14301 <para>
14302 <emphasis role="bold">Warning 2</emphasis>: Do not confuse these two kinds of item:
14303 </para>
14304 <literallayout class="monospaced">
14305 deny recipients = dbm*@;/some/file
14306 deny recipients = *@dbm;/some/file
14307 </literallayout>
14308 <para>
14309 The first does a whole address lookup, with defaulting, as just described,
14310 because it starts with a lookup type. The second matches the local part and
14311 domain independently, as described in a bullet point below.
14312 </para>
14313 </listitem>
14314 </itemizedlist>
14315 <para>
14316 The following kinds of address list pattern can match only non-empty addresses.
14317 If the subject address is empty, a match against any of these pattern types
14318 always fails.
14319 </para>
14320 <itemizedlist>
14321 <listitem>
14322 <para>
14323 <indexterm role="concept">
14324 <primary>@@ with single-key lookup</primary>
14325 </indexterm>
14326 <indexterm role="concept">
14327 <primary>address list</primary>
14328 <secondary>@@ lookup type</secondary>
14329 </indexterm>
14330 <indexterm role="concept">
14331 <primary>address list</primary>
14332 <secondary>split local part and domain</secondary>
14333 </indexterm>
14334 If a pattern starts with <quote>@@</quote> followed by a single-key lookup item
14335 (for example, <literal>@@lsearch;/some/file</literal>), the address that is being checked is
14336 split into a local part and a domain. The domain is looked up in the file. If
14337 it is not found, there is no match. If it is found, the data that is looked up
14338 from the file is treated as a colon-separated list of local part patterns, each
14339 of which is matched against the subject local part in turn.
14340 </para>
14341 <para>
14342 <indexterm role="concept">
14343 <primary>asterisk</primary>
14344 <secondary>in address list</secondary>
14345 </indexterm>
14346 The lookup may be a partial one, and/or one involving a search for a default
14347 keyed by <quote>*</quote> (see section <xref linkend="SECTdefaultvaluelookups"/>). The local part
14348 patterns that are looked up can be regular expressions or begin with <quote>*</quote>, or
14349 even be further lookups. They may also be independently negated. For example,
14350 with
14351 </para>
14352 <literallayout class="monospaced">
14353 deny senders = @@dbm;/etc/reject-by-domain
14354 </literallayout>
14355 <para>
14356 the data from which the DBM file is built could contain lines like
14357 </para>
14358 <literallayout class="monospaced">
14359 baddomain.com:  !postmaster : *
14360 </literallayout>
14361 <para>
14362 to reject all senders except <option>postmaster</option> from that domain.
14363 </para>
14364 <para>
14365 <indexterm role="concept">
14366 <primary>local part</primary>
14367 <secondary>starting with !</secondary>
14368 </indexterm>
14369 If a local part that actually begins with an exclamation mark is required, it
14370 has to be specified using a regular expression. In <command>lsearch</command> files, an entry
14371 may be split over several lines by indenting the second and subsequent lines,
14372 but the separating colon must still be included at line breaks. White space
14373 surrounding the colons is ignored. For example:
14374 </para>
14375 <literallayout class="monospaced">
14376 aol.com:  spammer1 : spammer2 : ^[0-9]+$ :
14377   spammer3 : spammer4
14378 </literallayout>
14379 <para>
14380 As in all colon-separated lists in Exim, a colon can be included in an item by
14381 doubling.
14382 </para>
14383 <para>
14384 If the last item in the list starts with a right angle-bracket, the remainder
14385 of the item is taken as a new key to look up in order to obtain a continuation
14386 list of local parts. The new key can be any sequence of characters. Thus one
14387 might have entries like
14388 </para>
14389 <literallayout class="monospaced">
14390 aol.com: spammer1 : spammer 2 : &gt;*
14391 xyz.com: spammer3 : &gt;*
14392 *:       ^\d{8}$
14393 </literallayout>
14394 <para>
14395 in a file that was searched with <option>@@dbm*</option>, to specify a match for 8-digit
14396 local parts for all domains, in addition to the specific local parts listed for
14397 each domain. Of course, using this feature costs another lookup each time a
14398 chain is followed, but the effort needed to maintain the data is reduced.
14399 </para>
14400 <para>
14401 <indexterm role="concept">
14402 <primary>loop</primary>
14403 <secondary>in lookups</secondary>
14404 </indexterm>
14405 It is possible to construct loops using this facility, and in order to catch
14406 them, the chains may be no more than fifty items long.
14407 </para>
14408 </listitem>
14409 <listitem>
14410 <para>
14411 The @@&lt;<emphasis>lookup</emphasis>&gt; style of item can also be used with a query-style
14412 lookup, but in this case, the chaining facility is not available. The lookup
14413 can only return a single list of local parts.
14414 </para>
14415 </listitem>
14416 </itemizedlist>
14417 <para>
14418 <emphasis role="bold">Warning</emphasis>: There is an important difference between the address list items
14419 in these two examples:
14420 </para>
14421 <literallayout class="monospaced">
14422 senders = +my_list
14423 senders = *@+my_list
14424 </literallayout>
14425 <para>
14426 In the first one, <literal>my_list</literal> is a named address list, whereas in the second
14427 example it is a named domain list.
14428 </para>
14429 </section>
14430 <section id="SECTcasletadd">
14431 <title>Case of letters in address lists</title>
14432 <para>
14433 <indexterm role="concept">
14434 <primary>case of local parts</primary>
14435 </indexterm>
14436 <indexterm role="concept">
14437 <primary>address list</primary>
14438 <secondary>case forcing</secondary>
14439 </indexterm>
14440 <indexterm role="concept">
14441 <primary>case forcing in address lists</primary>
14442 </indexterm>
14443 Domains in email addresses are always handled caselessly, but for local parts
14444 case may be significant on some systems (see <option>caseful_local_part</option> for how
14445 Exim deals with this when routing addresses). However, RFC 2505 (<emphasis>Anti-Spam
14446 Recommendations for SMTP MTAs</emphasis>) suggests that matching of addresses to
14447 blocking lists should be done in a case-independent manner. Since most address
14448 lists in Exim are used for this kind of control, Exim attempts to do this by
14449 default.
14450 </para>
14451 <para>
14452 The domain portion of an address is always lowercased before matching it to an
14453 address list. The local part is lowercased by default, and any string
14454 comparisons that take place are done caselessly. This means that the data in
14455 the address list itself, in files included as plain filenames, and in any file
14456 that is looked up using the <quote>@@</quote> mechanism, can be in any case. However, the
14457 keys in files that are looked up by a search type other than <command>lsearch</command> (which
14458 works caselessly) must be in lower case, because these lookups are not
14459 case-independent.
14460 </para>
14461 <para>
14462 <indexterm role="concept">
14463 <primary><literal>+caseful</literal></primary>
14464 </indexterm>
14465 To allow for the possibility of caseful address list matching, if an item in
14466 an address list is the string <quote>+caseful</quote>, the original case of the local
14467 part is restored for any comparisons that follow, and string comparisons are no
14468 longer case-independent. This does not affect the domain, which remains in
14469 lower case. However, although independent matches on the domain alone are still
14470 performed caselessly, regular expressions that match against an entire address
14471 become case-sensitive after <quote>+caseful</quote> has been seen.
14472 </para>
14473 </section>
14474 <section id="SECTlocparlis">
14475 <title>Local part lists</title>
14476 <para>
14477 <indexterm role="concept">
14478 <primary>list</primary>
14479 <secondary>local part list</secondary>
14480 </indexterm>
14481 <indexterm role="concept">
14482 <primary>local part</primary>
14483 <secondary>list</secondary>
14484 </indexterm>
14485 These behave in the same way as domain and host lists, with the following
14486 changes:
14487 </para>
14488 <para>
14489 Case-sensitivity in local part lists is handled in the same way as for address
14490 lists, as just described. The <quote>+caseful</quote> item can be used if required. In a
14491 setting of the <option>local_parts</option> option in a router with <option>caseful_local_part</option>
14492 set false, the subject is lowercased and the matching is initially
14493 case-insensitive. In this case, <quote>+caseful</quote> will restore case-sensitive
14494 matching in the local part list, but not elsewhere in the router. If
14495 <option>caseful_local_part</option> is set true in a router, matching in the <option>local_parts</option>
14496 option is case-sensitive from the start.
14497 </para>
14498 <para>
14499 If a local part list is indirected to a file (see section <xref linkend="SECTfilnamlis"/>),
14500 comments are handled in the same way as address lists &ndash; they are recognized
14501 only if the # is preceded by white space or the start of the line.
14502 Otherwise, local part lists are matched in the same way as domain lists, except
14503 that the special items that refer to the local host (<literal>@</literal>, <literal>@[]</literal>,
14504 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal>) are not recognized.
14505 Refer to section <xref linkend="SECTdomainlist"/> for details of the other available item
14506 types.
14507 <indexterm role="concept" startref="IIDdohoadli" class="endofrange"/>
14508 </para>
14509 </section>
14510 </chapter>
14511
14512 <chapter id="CHAPexpand">
14513 <title>String expansions</title>
14514 <para>
14515 <indexterm role="concept" id="IIDstrexp" class="startofrange">
14516 <primary>expansion</primary>
14517 <secondary>of strings</secondary>
14518 </indexterm>
14519 Many strings in Exim&#x2019;s runtime configuration are expanded before use. Some of
14520 them are expanded every time they are used; others are expanded only once.
14521 </para>
14522 <para>
14523 When a string is being expanded it is copied verbatim from left to right except
14524 <indexterm role="concept">
14525 <primary>expansion</primary>
14526 <secondary>string concatenation</secondary>
14527 </indexterm>
14528 when a dollar or backslash character is encountered. A dollar specifies the
14529 start of a portion of the string that is interpreted and replaced as described
14530 below in section <xref linkend="SECTexpansionitems"/> onwards. Backslash is used as an
14531 escape character, as described in the following section.
14532 </para>
14533 <para>
14534 Whether a string is expanded depends upon the context.  Usually this is solely
14535 dependent upon the option for which a value is sought; in this documentation,
14536 options for which string expansion is performed are marked with &dagger; after
14537 the data type.  ACL rules always expand strings.  A couple of expansion
14538 conditions do not expand some of the brace-delimited branches, for security
14539 reasons,
14540 <indexterm role="concept">
14541 <primary>tainted data</primary>
14542 <secondary>expansion</secondary>
14543 </indexterm>
14544 <indexterm role="concept">
14545 <primary>tainted data</primary>
14546 <secondary>definition</secondary>
14547 </indexterm>
14548 <indexterm role="concept">
14549 <primary>expansion</primary>
14550 <secondary>tainted data</secondary>
14551 </indexterm>
14552 and expansion of data deriving from the sender (<quote>tainted data</quote>)
14553 is not permitted (including acessing a file using a tainted name).
14554 </para>
14555 <para>
14556 Common ways of obtaining untainted equivalents of variables with
14557 tainted values
14558 <indexterm role="concept">
14559 <primary>tainted data</primary>
14560 <secondary>de-tainting</secondary>
14561 </indexterm>
14562 come down to using the tainted value as a lookup key in a trusted database.
14563 This database could be the filesystem structure,
14564 or the password file,
14565 or accessed via a DBMS.
14566 Specific methods are indexed under <quote>de-tainting</quote>.
14567 </para>
14568 <section id="SECTlittext">
14569 <title>Literal text in expanded strings</title>
14570 <para>
14571 <indexterm role="concept">
14572 <primary>expansion</primary>
14573 <secondary>including literal text</secondary>
14574 </indexterm>
14575 An uninterpreted dollar can be included in an expanded string by putting a
14576 backslash in front of it. A backslash can be used to prevent any special
14577 character being treated specially in an expansion, including backslash itself.
14578 If the string appears in quotes in the configuration file, two backslashes are
14579 required because the quotes themselves cause interpretation of backslashes when
14580 the string is read in (see section <xref linkend="SECTstrings"/>).
14581 </para>
14582 <para>
14583 <indexterm role="concept">
14584 <primary>expansion</primary>
14585 <secondary>non-expandable substrings</secondary>
14586 </indexterm>
14587 A portion of the string can specified as non-expandable by placing it between
14588 two occurrences of <literal>\N</literal>. This is particularly useful for protecting regular
14589 expressions, which often contain backslashes and dollar signs. For example:
14590 </para>
14591 <literallayout class="monospaced">
14592 deny senders = \N^\d{8}[a-z]@some\.site\.example$\N
14593 </literallayout>
14594 <para>
14595 On encountering the first <literal>\N</literal>, the expander copies subsequent characters
14596 without interpretation until it reaches the next <literal>\N</literal> or the end of the
14597 string.
14598 </para>
14599 </section>
14600 <section id="SECID82">
14601 <title>Character escape sequences in expanded strings</title>
14602 <para>
14603 <indexterm role="concept">
14604 <primary>expansion</primary>
14605 <secondary>escape sequences</secondary>
14606 </indexterm>
14607 A backslash followed by one of the letters <quote>n</quote>, <quote>r</quote>, or <quote>t</quote> in an
14608 expanded string is recognized as an escape sequence for the character newline,
14609 carriage return, or tab, respectively. A backslash followed by up to three
14610 octal digits is recognized as an octal encoding for a single character, and a
14611 backslash followed by <quote>x</quote> and up to two hexadecimal digits is a hexadecimal
14612 encoding.
14613 </para>
14614 <para>
14615 These escape sequences are also recognized in quoted strings when they are read
14616 in. Their interpretation in expansions as well is useful for unquoted strings,
14617 and for other cases such as looked-up strings that are then expanded.
14618 </para>
14619 </section>
14620 <section id="SECID83">
14621 <title>Testing string expansions</title>
14622 <para>
14623 <indexterm role="concept">
14624 <primary>expansion</primary>
14625 <secondary>testing</secondary>
14626 </indexterm>
14627 <indexterm role="concept">
14628 <primary>testing</primary>
14629 <secondary>string expansion</secondary>
14630 </indexterm>
14631 <indexterm role="option">
14632 <primary><option>-be</option></primary>
14633 </indexterm>
14634 Many expansions can be tested by calling Exim with the <option>-be</option> option. This
14635 takes the command arguments, or lines from the standard input if there are no
14636 arguments, runs them through the string expansion code, and writes the results
14637 to the standard output. Variables based on configuration values are set up, but
14638 since no message is being processed, variables such as <varname>$local_part</varname> have no
14639 value. Nevertheless the <option>-be</option> option can be useful for checking out file and
14640 database lookups, and the use of expansion operators such as <option>sg</option>, <option>substr</option>
14641 and <option>nhash</option>.
14642 </para>
14643 <para>
14644 Exim gives up its root privilege when it is called with the <option>-be</option> option, and
14645 instead runs under the uid and gid it was called with, to prevent users from
14646 using <option>-be</option> for reading files to which they do not have access.
14647 </para>
14648 <para>
14649 <indexterm role="option">
14650 <primary><option>-bem</option></primary>
14651 </indexterm>
14652 If you want to test expansions that include variables whose values are taken
14653 from a message, there are two other options that can be used. The <option>-bem</option>
14654 option is like <option>-be</option> except that it is followed by a filename. The file is
14655 read as a message before doing the test expansions. For example:
14656 </para>
14657 <literallayout class="monospaced">
14658 exim -bem /tmp/test.message '$h_subject:'
14659 </literallayout>
14660 <para>
14661 The <option>-Mset</option> option is used in conjunction with <option>-be</option> and is followed by an
14662 Exim message identifier. For example:
14663 </para>
14664 <literallayout class="monospaced">
14665 exim -be -Mset 1GrA8W-0004WS-LQ '$recipients'
14666 </literallayout>
14667 <para>
14668 This loads the message from Exim&#x2019;s spool before doing the test expansions, and
14669 is therefore restricted to admin users.
14670 </para>
14671 </section>
14672 <section id="SECTforexpfai">
14673 <title>Forced expansion failure</title>
14674 <para>
14675 <indexterm role="concept">
14676 <primary>expansion</primary>
14677 <secondary>forced failure</secondary>
14678 </indexterm>
14679 A number of expansions that are described in the following section have
14680 alternative <quote>true</quote> and <quote>false</quote> substrings, enclosed in brace characters
14681 (which are sometimes called <quote>curly brackets</quote>). Which of the two strings is
14682 used depends on some condition that is evaluated as part of the expansion. If,
14683 instead of a <quote>false</quote> substring, the word <quote>fail</quote> is used (not in braces),
14684 the entire string expansion fails in a way that can be detected by the code
14685 that requested the expansion. This is called <quote>forced expansion failure</quote>, and
14686 its consequences depend on the circumstances. In some cases it is no different
14687 from any other expansion failure, but in others a different action may be
14688 taken. Such variations are mentioned in the documentation of the option that is
14689 being expanded.
14690 </para>
14691 </section>
14692 <section id="SECTexpansionitems">
14693 <title>Expansion items</title>
14694 <para>
14695 The following items are recognized in expanded strings. White space may be used
14696 between sub-items that are keywords or substrings enclosed in braces inside an
14697 outer set of braces, to improve readability. <emphasis role="bold">Warning</emphasis>: Within braces,
14698 white space is significant.
14699 </para>
14700 <variablelist>
14701 <varlistentry>
14702 <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>
14703 <listitem>
14704 <para>
14705 <indexterm role="concept">
14706 <primary>expansion</primary>
14707 <secondary>variables</secondary>
14708 </indexterm>
14709 Substitute the contents of the named variable, for example:
14710 </para>
14711 <literallayout class="monospaced">
14712 $local_part
14713 ${domain}
14714 </literallayout>
14715 <para>
14716 The second form can be used to separate the name from subsequent alphanumeric
14717 characters. This form (using braces) is available only for variables; it does
14718 <emphasis>not</emphasis> apply to message headers. The names of the variables are given in
14719 section <xref linkend="SECTexpvar"/> below. If the name of a non-existent variable is
14720 given, the expansion fails.
14721 </para>
14722 </listitem></varlistentry>
14723 <varlistentry>
14724 <term><emphasis role="bold">${</emphasis>&lt;<emphasis>op</emphasis>&gt;<emphasis role="bold">:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
14725 <listitem>
14726 <para>
14727 <indexterm role="concept">
14728 <primary>expansion</primary>
14729 <secondary>operators</secondary>
14730 </indexterm>
14731 The string is first itself expanded, and then the operation specified by
14732 &lt;<emphasis>op</emphasis>&gt; is applied to it. For example:
14733 </para>
14734 <literallayout class="monospaced">
14735 ${lc:$local_part}
14736 </literallayout>
14737 <para>
14738 The string starts with the first character after the colon, which may be
14739 leading white space. A list of operators is given in section <xref linkend="SECTexpop"/>
14740 below. The operator notation is used for simple expansion items that have just
14741 one argument, because it reduces the number of braces and therefore makes the
14742 string easier to understand.
14743 </para>
14744 </listitem></varlistentry>
14745 <varlistentry>
14746 <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>
14747 <listitem>
14748 <para>
14749 This item inserts <quote>basic</quote> header lines. It is described with the <option>header</option>
14750 expansion item below.
14751 </para>
14752 </listitem></varlistentry>
14753 <varlistentry>
14754 <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>
14755 <listitem>
14756 <para>
14757 <indexterm role="concept">
14758 <primary>expansion</primary>
14759 <secondary>calling an acl</secondary>
14760 </indexterm>
14761 <indexterm role="concept">
14762 <primary><option>acl</option></primary>
14763 <secondary>call from expansion</secondary>
14764 </indexterm>
14765 The name and zero to nine argument strings are first expanded separately.  The expanded
14766 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
14767 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
14768 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
14769 and may use the variables; if another acl expansion is used the values
14770 are restored after it returns.  If the ACL sets
14771 a value using a "message =" modifier and returns accept or deny, the value becomes
14772 the result of the expansion.
14773 If no message is set and the ACL returns accept or deny
14774 the expansion result is an empty string.
14775 If the ACL returns defer the result is a forced-fail.  Otherwise the expansion fails.
14776 </para>
14777 </listitem></varlistentry>
14778 <varlistentry>
14779 <term><emphasis role="bold">${authresults{</emphasis>&lt;<emphasis>authserv-id</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
14780 <listitem>
14781 <para>
14782 <indexterm role="concept">
14783 <primary>authentication</primary>
14784 <secondary>results header</secondary>
14785 </indexterm>
14786 <indexterm role="concept">
14787 <primary><emphasis>Authentication-Results:</emphasis> header line</primary>
14788 </indexterm>
14789 <indexterm role="concept">
14790 <primary>header lines</primary>
14791 <secondary>Authentication-Results:</secondary>
14792 </indexterm>
14793 <indexterm role="concept">
14794 <primary>authentication</primary>
14795 <secondary>expansion item</secondary>
14796 </indexterm>
14797 This item returns a string suitable for insertion as an
14798 <emphasis>Authentication-Results:</emphasis>
14799 header line.
14800 The given &lt;<emphasis>authserv-id</emphasis>&gt; is included in the result; typically this
14801 will be a domain name identifying the system performing the authentications.
14802 Methods that might be present in the result include:
14803 </para>
14804 <literallayout class="monospaced">
14805 none
14806 iprev
14807 auth
14808 spf
14809 dkim
14810 </literallayout>
14811 <para>
14812 Example use (as an ACL modifier):
14813 </para>
14814 <literallayout class="monospaced">
14815       add_header = :at_start:${authresults {$primary_hostname}}
14816 </literallayout>
14817 <para>
14818 This is safe even if no authentication results are available.
14819 </para>
14820 </listitem></varlistentry>
14821 <varlistentry>
14822 <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>
14823 <listitem>
14824 <para>
14825 <indexterm role="concept">
14826 <primary>expansion</primary>
14827 <secondary>extracting certificate fields</secondary>
14828 </indexterm>
14829 <indexterm role="concept">
14830 <primary><option>certextract</option></primary>
14831 <secondary>certificate fields</secondary>
14832 </indexterm>
14833 <indexterm role="concept">
14834 <primary>certificate</primary>
14835 <secondary>extracting fields</secondary>
14836 </indexterm>
14837 The &lt;<emphasis>certificate</emphasis>&gt; must be a variable of type certificate.
14838 The field name is expanded and used to retrieve the relevant field from
14839 the certificate.  Supported fields are:
14840 </para>
14841 <literallayout>
14842 <literal>version        </literal>
14843 <literal>serial_number  </literal>
14844 <literal>subject        </literal> RFC4514 DN
14845 <literal>issuer         </literal> RFC4514 DN
14846 <literal>notbefore      </literal> time
14847 <literal>notafter       </literal> time
14848 <literal>sig_algorithm  </literal>
14849 <literal>signature      </literal>
14850 <literal>subj_altname   </literal> tagged list
14851 <literal>ocsp_uri       </literal> list
14852 <literal>crl_uri        </literal> list
14853 </literallayout>
14854 <para>
14855 If the field is found,
14856 &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
14857 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
14858 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
14859 is restored to any previous value it might have had.
14860 </para>
14861 <para>
14862 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
14863 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
14864 extracted is used.
14865 </para>
14866 <para>
14867 Some field names take optional modifiers, appended and separated by commas.
14868 </para>
14869 <para>
14870 The field selectors marked as "RFC4514" above
14871 output a Distinguished Name string which is
14872 not quite
14873 parseable by Exim as a comma-separated tagged list
14874 (the exceptions being elements containing commas).
14875 RDN elements of a single type may be selected by
14876 a modifier of the type label; if so the expansion
14877 result is a list (newline-separated by default).
14878 The separator may be changed by another modifier of
14879 a right angle-bracket followed immediately by the new separator.
14880 Recognised RDN type labels include "CN", "O", "OU" and "DC".
14881 </para>
14882 <para>
14883 The field selectors marked as "time" above
14884 take an optional modifier of "int"
14885 for which the result is the number of seconds since epoch.
14886 Otherwise the result is a human-readable string
14887 in the timezone selected by the main "timezone" option.
14888 </para>
14889 <para>
14890 The field selectors marked as "list" above return a list,
14891 newline-separated by default,
14892 (embedded separator characters in elements are doubled).
14893 The separator may be changed by a modifier of
14894 a right angle-bracket followed immediately by the new separator.
14895 </para>
14896 <para>
14897 The field selectors marked as "tagged" above
14898 prefix each list element with a type string and an equals sign.
14899 Elements of only one type may be selected by a modifier
14900 which is one of "dns", "uri" or "mail";
14901 if so the element tags are omitted.
14902 </para>
14903 <para>
14904 If not otherwise noted field values are presented in human-readable form.
14905 </para>
14906 </listitem></varlistentry>
14907 <varlistentry>
14908 <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>
14909 <listitem>
14910 <para>
14911 <indexterm role="concept">
14912 <primary><option>dlfunc</option></primary>
14913 </indexterm>
14914 This expansion dynamically loads and then calls a locally-written C function.
14915 This functionality is available only if Exim is compiled with
14916 </para>
14917 <literallayout class="monospaced">
14918 EXPAND_DLFUNC=yes
14919 </literallayout>
14920 <para>
14921 set in <filename>Local/Makefile</filename>. Once loaded, Exim remembers the dynamically loaded
14922 object so that it doesn&#x2019;t reload the same object file in the same Exim process
14923 (but of course Exim does start new processes frequently).
14924 </para>
14925 <para>
14926 There may be from zero to eight arguments to the function.
14927 </para>
14928 <para>
14929 When compiling
14930 a local function that is to be called in this way,
14931 first <filename>DLFUNC_IMPL</filename> should be defined,
14932 and second <filename>local_scan.h</filename> should be included.
14933 The Exim variables and functions that are defined by that API
14934 are also available for dynamically loaded functions. The function itself
14935 must have the following type:
14936 </para>
14937 <literallayout class="monospaced">
14938 int dlfunction(uschar **yield, int argc, uschar *argv[])
14939 </literallayout>
14940 <para>
14941 Where <literal>uschar</literal> is a typedef for <literal>unsigned char</literal> in <filename>local_scan.h</filename>. The
14942 function should return one of the following values:
14943 </para>
14944 <para>
14945 <literal>OK</literal>: Success. The string that is placed in the variable <emphasis>yield</emphasis> is put
14946 into the expanded string that is being built.
14947 </para>
14948 <para>
14949 <literal>FAIL</literal>: A non-forced expansion failure occurs, with the error message taken
14950 from <emphasis>yield</emphasis>, if it is set.
14951 </para>
14952 <para>
14953 <literal>FAIL_FORCED</literal>: A forced expansion failure occurs, with the error message
14954 taken from <emphasis>yield</emphasis> if it is set.
14955 </para>
14956 <para>
14957 <literal>ERROR</literal>: Same as <literal>FAIL</literal>, except that a panic log entry is written.
14958 </para>
14959 <para>
14960 When compiling a function that is to be used in this way with gcc,
14961 you need to add <option>-shared</option> to the gcc command. Also, in the Exim build-time
14962 configuration, you must add <option>-export-dynamic</option> to EXTRALIBS.
14963 </para>
14964 </listitem></varlistentry>
14965 <varlistentry>
14966 <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>
14967 <listitem>
14968 <para>
14969 <indexterm role="concept">
14970 <primary>expansion</primary>
14971 <secondary>extracting value from environment</secondary>
14972 </indexterm>
14973 <indexterm role="concept">
14974 <primary>environment</primary>
14975 <secondary>values from</secondary>
14976 </indexterm>
14977 The key is first expanded separately, and leading and trailing white space
14978 removed.
14979 This is then searched for as a name in the environment.
14980 If a variable is found then its value is placed in <varname>$value</varname>
14981 and &lt;<emphasis>string1</emphasis>&gt; is expanded, otherwise &lt;<emphasis>string2</emphasis>&gt; is expanded.
14982 </para>
14983 <para>
14984 Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
14985 appear, for example:
14986 </para>
14987 <literallayout class="monospaced">
14988 ${env{USER}{$value} fail }
14989 </literallayout>
14990 <para>
14991 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
14992 {&lt;<emphasis>string1</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
14993 </para>
14994 <para>
14995 If {&lt;<emphasis>string2</emphasis>&gt;} is omitted an empty string is substituted on
14996 search failure.
14997 If {&lt;<emphasis>string1</emphasis>&gt;} is omitted the search result is substituted on
14998 search success.
14999 </para>
15000 <para>
15001 The environment is adjusted by the <option>keep_environment</option> and
15002 <option>add_environment</option> main section options.
15003 </para>
15004 </listitem></varlistentry>
15005 <varlistentry>
15006 <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>
15007 <listitem>
15008 <para>
15009 <indexterm role="concept">
15010 <primary>expansion</primary>
15011 <secondary>extracting substrings by key</secondary>
15012 </indexterm>
15013 <indexterm role="concept">
15014 <primary><option>extract</option></primary>
15015 <secondary>substrings by key</secondary>
15016 </indexterm>
15017 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
15018 white space is removed from the key (but not from any of the strings). The key
15019 must not be empty and must not consist entirely of digits.
15020 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
15021 </para>
15022 <literallayout>
15023 &lt;<emphasis>key1</emphasis>&gt; = &lt;<emphasis>value1</emphasis>&gt;  &lt;<emphasis>key2</emphasis>&gt; = &lt;<emphasis>value2</emphasis>&gt; ...
15024 </literallayout>
15025 <para>
15026 <indexterm role="variable">
15027 <primary><varname>$value</varname></primary>
15028 </indexterm>
15029 where the equals signs and spaces (but not both) are optional. If any of the
15030 values contain white space, they must be enclosed in double quotes, and any
15031 values that are enclosed in double quotes are subject to escape processing as
15032 described in section <xref linkend="SECTstrings"/>. The expanded &lt;<emphasis>string1</emphasis>&gt; is searched
15033 for the value that corresponds to the key. The search is case-insensitive. If
15034 the key is found, &lt;<emphasis>string2</emphasis>&gt; is expanded, and replaces the whole item;
15035 otherwise &lt;<emphasis>string3</emphasis>&gt; is used. During the expansion of &lt;<emphasis>string2</emphasis>&gt; the
15036 variable <varname>$value</varname> contains the value that has been extracted. Afterwards, it
15037 is restored to any previous value it might have had.
15038 </para>
15039 <para>
15040 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, the item is replaced by an empty string if the
15041 key is not found. If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
15042 extracted is used. Thus, for example, these two expansions are identical, and
15043 yield <quote>2001</quote>:
15044 </para>
15045 <literallayout class="monospaced">
15046 ${extract{gid}{uid=1984 gid=2001}}
15047 ${extract{gid}{uid=1984 gid=2001}{$value}}
15048 </literallayout>
15049 <para>
15050 Instead of {&lt;<emphasis>string3</emphasis>&gt;} the word <quote>fail</quote> (not in curly brackets) can
15051 appear, for example:
15052 </para>
15053 <literallayout class="monospaced">
15054 ${extract{Z}{A=... B=...}{$value} fail }
15055 </literallayout>
15056 <para>
15057 This forces an expansion failure (see section <xref linkend="SECTforexpfai"/>);
15058 {&lt;<emphasis>string2</emphasis>&gt;} must be present for <quote>fail</quote> to be recognized.
15059 </para>
15060 </listitem></varlistentry>
15061 <varlistentry>
15062 <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>
15063 <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>
15064 <listitem>
15065 <para>
15066 <indexterm role="concept">
15067 <primary>expansion</primary>
15068 <secondary>extracting from JSON object</secondary>
15069 </indexterm>
15070 <indexterm role="concept">
15071 <primary>JSON</primary>
15072 <secondary>expansions</secondary>
15073 </indexterm>
15074 The key and &lt;<emphasis>string1</emphasis>&gt; are first expanded separately. Leading and trailing
15075 white space is removed from the key (but not from any of the strings). The key
15076 must not be empty and must not consist entirely of digits.
15077 The expanded &lt;<emphasis>string1</emphasis>&gt; must be of the form:
15078 </para>
15079 <literallayout>
15080 { &lt;<emphasis>"key1"</emphasis>&gt; : &lt;<emphasis>value1</emphasis>&gt; ,  &lt;<emphasis>"key2"</emphasis>&gt; , &lt;<emphasis>value2</emphasis>&gt; ... }
15081 </literallayout>
15082 <para>
15083 <indexterm role="variable">
15084 <primary><varname>$value</varname></primary>
15085 </indexterm>
15086 The braces, commas and colons, and the quoting of the member name are required;
15087 the spaces are optional.
15088 Matching of the key against the member names is done case-sensitively.
15089 For the <quote>json</quote> variant,
15090 if a returned value is a JSON string, it retains its leading and
15091 trailing quotes.
15092 For the <quote>jsons</quote> variant, which is intended for use with JSON strings, the
15093 leading and trailing quotes are removed from the returned value.
15094 </para>
15095 <para>
15096 The results of matching are handled as above.
15097 </para>
15098 </listitem></varlistentry>
15099 <varlistentry>
15100 <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>
15101 <listitem>
15102 <para>
15103 <indexterm role="concept">
15104 <primary>expansion</primary>
15105 <secondary>extracting substrings by number</secondary>
15106 </indexterm>
15107 <indexterm role="concept">
15108 <primary><option>extract</option></primary>
15109 <secondary>substrings by number</secondary>
15110 </indexterm>
15111 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
15112 apart from leading and trailing white space, which is ignored.
15113 This is what distinguishes this form of <option>extract</option> from the previous kind. It
15114 behaves in the same way, except that, instead of extracting a named field, it
15115 extracts from &lt;<emphasis>string1</emphasis>&gt; the field whose number is given as the first
15116 argument. You can use <varname>$value</varname> in &lt;<emphasis>string2</emphasis>&gt; or <literal>fail</literal> instead of
15117 &lt;<emphasis>string3</emphasis>&gt; as before.
15118 </para>
15119 <para>
15120 The fields in the string are separated by any one of the characters in the
15121 separator string. These may include space or tab characters.
15122 The first field is numbered one. If the number is negative, the fields are
15123 counted from the end of the string, with the rightmost one numbered -1. If the
15124 number given is zero, the entire string is returned. If the modulus of the
15125 number is greater than the number of fields in the string, the result is the
15126 expansion of &lt;<emphasis>string3</emphasis>&gt;, or the empty string if &lt;<emphasis>string3</emphasis>&gt; is not
15127 provided. For example:
15128 </para>
15129 <literallayout class="monospaced">
15130 ${extract{2}{:}{x:42:99:&amp; Mailer::/bin/bash}}
15131 </literallayout>
15132 <para>
15133 yields <quote>42</quote>, and
15134 </para>
15135 <literallayout class="monospaced">
15136 ${extract{-4}{:}{x:42:99:&amp; Mailer::/bin/bash}}
15137 </literallayout>
15138 <para>
15139 yields <quote>99</quote>. Two successive separators mean that the field between them is
15140 empty (for example, the fifth field above).
15141 </para>
15142 </listitem></varlistentry>
15143 <varlistentry>
15144 <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>
15145 <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>
15146 <listitem>
15147 <para>
15148 <indexterm role="concept">
15149 <primary>expansion</primary>
15150 <secondary>extracting from JSON array</secondary>
15151 </indexterm>
15152 <indexterm role="concept">
15153 <primary>JSON</primary>
15154 <secondary>expansions</secondary>
15155 </indexterm>
15156 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
15157 apart from leading and trailing white space, which is ignored.
15158 </para>
15159 <para>
15160 Field selection and result handling is as above;
15161 there is no choice of field separator.
15162 For the <quote>json</quote> variant,
15163 if a returned value is a JSON string, it retains its leading and
15164 trailing quotes.
15165 For the <quote>jsons</quote> variant, which is intended for use with JSON strings, the
15166 leading and trailing quotes are removed from the returned value.
15167 </para>
15168 </listitem></varlistentry>
15169 <varlistentry>
15170 <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>
15171 <listitem>
15172 <para>
15173 <indexterm role="concept">
15174 <primary>list</primary>
15175 <secondary>selecting by condition</secondary>
15176 </indexterm>
15177 <indexterm role="concept">
15178 <primary>expansion</primary>
15179 <secondary>selecting from list by condition</secondary>
15180 </indexterm>
15181 <indexterm role="variable">
15182 <primary><varname>$item</varname></primary>
15183 </indexterm>
15184 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
15185 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15186 For each item
15187 in this list, its value is place in <varname>$item</varname>, and then the condition is
15188 evaluated. If the condition is true, <varname>$item</varname> is added to the output as an
15189 item in a new list; if the condition is false, the item is discarded. The
15190 separator used for the output list is the same as the one used for the
15191 input, but a separator setting is not included in the output. For example:
15192 </para>
15193 <literallayout class="monospaced">
15194 ${filter{a:b:c}{!eq{$item}{b}}}
15195 </literallayout>
15196 <para>
15197 yields <literal>a:c</literal>. At the end of the expansion, the value of <varname>$item</varname> is restored
15198 to what it was before. See also the <option>map</option> and <option>reduce</option> expansion items.
15199 </para>
15200 </listitem></varlistentry>
15201 <varlistentry>
15202 <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>
15203 <listitem>
15204 <para>
15205 <indexterm role="concept">
15206 <primary>hash function</primary>
15207 <secondary>textual</secondary>
15208 </indexterm>
15209 <indexterm role="concept">
15210 <primary>expansion</primary>
15211 <secondary>textual hash</secondary>
15212 </indexterm>
15213 This is a textual hashing function, and was the first to be implemented in
15214 early versions of Exim. In current releases, there are other hashing functions
15215 (numeric, MD5, and SHA-1), which are described below.
15216 </para>
15217 <para>
15218 The first two strings, after expansion, must be numbers. Call them &lt;<emphasis>m</emphasis>&gt; and
15219 &lt;<emphasis>n</emphasis>&gt;. If you are using fixed values for these numbers, that is, if
15220 &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you can
15221 use the simpler operator notation that avoids some of the braces:
15222 </para>
15223 <literallayout class="monospaced">
15224 ${hash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
15225 </literallayout>
15226 <para>
15227 The second number is optional (in both notations). If &lt;<emphasis>n</emphasis>&gt; is greater than
15228 or equal to the length of the string, the expansion item returns the string.
15229 Otherwise it computes a new string of length &lt;<emphasis>n</emphasis>&gt; by applying a hashing
15230 function to the string. The new string consists of characters taken from the
15231 first &lt;<emphasis>m</emphasis>&gt; characters of the string
15232 </para>
15233 <literallayout class="monospaced">
15234 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQWRSTUVWXYZ0123456789
15235 </literallayout>
15236 <para>
15237 If &lt;<emphasis>m</emphasis>&gt; is not present the value 26 is used, so that only lower case
15238 letters appear. For example:
15239 </para>
15240 <literallayout>
15241 <literal>$hash{3}{monty}}           </literal>   yields  <literal>jmg</literal>
15242 <literal>$hash{5}{monty}}           </literal>   yields  <literal>monty</literal>
15243 <literal>$hash{4}{62}{monty python}}</literal>   yields  <literal>fbWx</literal>
15244 </literallayout>
15245 </listitem></varlistentry>
15246 <varlistentry>
15247 <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>
15248 <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>
15249 <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>
15250 <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>
15251 <listitem>
15252 <para>
15253 <indexterm role="concept">
15254 <primary>expansion</primary>
15255 <secondary>header insertion</secondary>
15256 </indexterm>
15257 <indexterm role="variable">
15258 <primary><varname>$header_</varname></primary>
15259 </indexterm>
15260 <indexterm role="variable">
15261 <primary><varname>$bheader_</varname></primary>
15262 </indexterm>
15263 <indexterm role="variable">
15264 <primary><varname>$lheader_</varname></primary>
15265 </indexterm>
15266 <indexterm role="variable">
15267 <primary><varname>$rheader_</varname></primary>
15268 </indexterm>
15269 <indexterm role="concept">
15270 <primary>header lines</primary>
15271 <secondary>in expansion strings</secondary>
15272 </indexterm>
15273 <indexterm role="concept">
15274 <primary>header lines</primary>
15275 <secondary>character sets</secondary>
15276 </indexterm>
15277 <indexterm role="concept">
15278 <primary>header lines</primary>
15279 <secondary>decoding</secondary>
15280 </indexterm>
15281 Substitute the contents of the named message header line, for example
15282 </para>
15283 <literallayout class="monospaced">
15284 $header_reply-to:
15285 </literallayout>
15286 <para>
15287 The newline that terminates a header line is not included in the expansion, but
15288 internal newlines (caused by splitting the header line over several physical
15289 lines) may be present.
15290 </para>
15291 <para>
15292 The difference between the four pairs of expansions is in the way
15293 the data in the header line is interpreted.
15294 </para>
15295 <itemizedlist>
15296 <listitem>
15297 <para>
15298 <indexterm role="concept">
15299 <primary>white space</primary>
15300 <secondary>in header lines</secondary>
15301 </indexterm>
15302 <option>rheader</option> gives the original <quote>raw</quote> content of the header line, with no
15303 processing at all, and without the removal of leading and trailing white space.
15304 </para>
15305 </listitem>
15306 <listitem>
15307 <para>
15308 <indexterm role="concept">
15309 <primary>list</primary>
15310 <secondary>of header lines</secondary>
15311 </indexterm>
15312 <option>lheader</option> gives a colon-separated list, one element per header when there
15313 are multiple headers with a given name.
15314 Any embedded colon characters within an element are doubled, so normal Exim
15315 list-processing facilities can be used.
15316 The terminating newline of each element is removed; in other respects
15317 the content is <quote>raw</quote>.
15318 </para>
15319 </listitem>
15320 <listitem>
15321 <para>
15322 <indexterm role="concept">
15323 <primary>base64 encoding</primary>
15324 <secondary>in header lines</secondary>
15325 </indexterm>
15326 <option>bheader</option> removes leading and trailing white space, and then decodes base64
15327 or quoted-printable MIME <quote>words</quote> within the header text, but does no
15328 character set translation. If decoding of what looks superficially like a MIME
15329 <quote>word</quote> fails, the raw string is returned. If decoding
15330 <indexterm role="concept">
15331 <primary>binary zero</primary>
15332 <secondary>in header line</secondary>
15333 </indexterm>
15334 produces a binary zero character, it is replaced by a question mark &ndash; this is
15335 what Exim does for binary zeros that are actually received in header lines.
15336 </para>
15337 </listitem>
15338 <listitem>
15339 <para>
15340 <option>header</option> tries to translate the string as decoded by <option>bheader</option> to a
15341 standard character set. This is an attempt to produce the same string as would
15342 be displayed on a user&#x2019;s MUA. If translation fails, the <option>bheader</option> string is
15343 returned. Translation is attempted only on operating systems that support the
15344 <function>iconv()</function> function. This is indicated by the compile-time macro HAVE_ICONV in
15345 a system Makefile or in <filename>Local/Makefile</filename>.
15346 </para>
15347 </listitem>
15348 </itemizedlist>
15349 <para>
15350 In a filter file, the target character set for <option>header</option> can be specified by a
15351 command of the following form:
15352 </para>
15353 <literallayout class="monospaced">
15354 headers charset "UTF-8"
15355 </literallayout>
15356 <para>
15357 This command affects all references to <varname>$h_</varname> (or <varname>$header_</varname>) expansions in
15358 subsequently obeyed filter commands. In the absence of this command, the target
15359 character set in a filter is taken from the setting of the <option>headers_charset</option>
15360 option in the runtime configuration. The value of this option defaults to the
15361 value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The ultimate default is
15362 ISO-8859-1.
15363 </para>
15364 <para>
15365 Header names follow the syntax of RFC 2822, which states that they may contain
15366 any printing characters except space and colon. Consequently, curly brackets
15367 <emphasis>do not</emphasis> terminate header names, and should not be used to enclose them as
15368 if they were variables. Attempting to do so causes a syntax error.
15369 </para>
15370 <para>
15371 Only header lines that are common to all copies of a message are visible to
15372 this mechanism. These are the original header lines that are received with the
15373 message, and any that are added by an ACL statement or by a system
15374 filter. Header lines that are added to a particular copy of a message by a
15375 router or transport are not accessible.
15376 </para>
15377 <para>
15378 For incoming SMTP messages, no header lines are visible in
15379 ACLs that are obeyed before the data phase completes,
15380 because the header structure is not set up until the message is received.
15381 They are visible in DKIM, PRDR and DATA ACLs.
15382 Header lines that are added in a RCPT ACL (for example)
15383 are saved until the message&#x2019;s incoming header lines are available, at which
15384 point they are added.
15385 When any of the above ACLs are
15386 running, however, header lines added by earlier ACLs are visible.
15387 </para>
15388 <para>
15389 Upper case and lower case letters are synonymous in header names. If the
15390 following character is white space, the terminating colon may be omitted, but
15391 this is not recommended, because you may then forget it when it is needed. When
15392 white space terminates the header name, this white space is included in the
15393 expanded string.  If the message does not contain the given header, the
15394 expansion item is replaced by an empty string. (See the <option>def</option> condition in
15395 section <xref linkend="SECTexpcond"/> for a means of testing for the existence of a
15396 header.)
15397 </para>
15398 <para>
15399 If there is more than one header with the same name, they are all concatenated
15400 to form the substitution string, up to a maximum length of 64K. Unless
15401 <option>rheader</option> is being used, leading and trailing white space is removed from
15402 each header before concatenation, and a completely empty header is ignored. A
15403 newline character is then inserted between non-empty headers, but there is no
15404 newline at the very end. For the <option>header</option> and <option>bheader</option> expansion, for
15405 those headers that contain lists of addresses, a comma is also inserted at the
15406 junctions between headers. This does not happen for the <option>rheader</option> expansion.
15407 </para>
15408 <para>
15409 <indexterm role="concept">
15410 <primary>tainted data</primary>
15411 <secondary>message headers</secondary>
15412 </indexterm>
15413 When the headers are from an incoming message,
15414 the result of expanding any of these variables is tainted.
15415 </para>
15416 </listitem></varlistentry>
15417 <varlistentry>
15418 <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>
15419 <listitem>
15420 <para>
15421 <indexterm role="concept">
15422 <primary>expansion</primary>
15423 <secondary>hmac hashing</secondary>
15424 </indexterm>
15425 <indexterm role="concept">
15426 <primary><option>hmac</option></primary>
15427 </indexterm>
15428 This function uses cryptographic hashing (either MD5 or SHA-1) to convert a
15429 shared secret and some text into a message authentication code, as specified in
15430 RFC 2104. This differs from <literal>${md5:secret_text...}</literal> or
15431 <literal>${sha1:secret_text...}</literal> in that the hmac step adds a signature to the
15432 cryptographic hash, allowing for authentication that is not possible with MD5
15433 or SHA-1 alone. The hash name must expand to either <literal>md5</literal> or <literal>sha1</literal> at
15434 present. For example:
15435 </para>
15436 <literallayout class="monospaced">
15437 ${hmac{md5}{somesecret}{$primary_hostname $tod_log}}
15438 </literallayout>
15439 <para>
15440 For the hostname <emphasis>mail.example.com</emphasis> and time 2002-10-17 11:30:59, this
15441 produces:
15442 </para>
15443 <literallayout class="monospaced">
15444 dd97e3ba5d1a61b5006108f8c8252953
15445 </literallayout>
15446 <para>
15447 As an example of how this might be used, you might put in the main part of
15448 an Exim configuration:
15449 </para>
15450 <literallayout class="monospaced">
15451 SPAMSCAN_SECRET=cohgheeLei2thahw
15452 </literallayout>
15453 <para>
15454 In a router or a transport you could then have:
15455 </para>
15456 <literallayout class="monospaced">
15457 headers_add = \
15458   X-Spam-Scanned: ${primary_hostname} ${message_exim_id} \
15459   ${hmac{md5}{SPAMSCAN_SECRET}\
15460   {${primary_hostname},${message_exim_id},$h_message-id:}}
15461 </literallayout>
15462 <para>
15463 Then given a message, you can check where it was scanned by looking at the
15464 <emphasis>X-Spam-Scanned:</emphasis> header line. If you know the secret, you can check that
15465 this header line is authentic by recomputing the authentication code from the
15466 host name, message ID and the <emphasis>Message-id:</emphasis> header line. This can be done
15467 using Exim&#x2019;s <option>-be</option> option, or by other means, for example, by using the
15468 <emphasis>hmac_md5_hex()</emphasis> function in Perl.
15469 </para>
15470 </listitem></varlistentry>
15471 <varlistentry>
15472 <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>
15473 <listitem>
15474 <para>
15475 <indexterm role="concept">
15476 <primary>expansion</primary>
15477 <secondary>conditional</secondary>
15478 </indexterm>
15479 <indexterm role="concept">
15480 <primary><option>if</option>, expansion item</primary>
15481 </indexterm>
15482 If &lt;<emphasis>condition</emphasis>&gt; is true, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the whole
15483 item; otherwise &lt;<emphasis>string2</emphasis>&gt; is used. The available conditions are described
15484 in section <xref linkend="SECTexpcond"/> below. For example:
15485 </para>
15486 <literallayout class="monospaced">
15487 ${if eq {$local_part}{postmaster} {yes}{no} }
15488 </literallayout>
15489 <para>
15490 The second string need not be present; if it is not and the condition is not
15491 true, the item is replaced with nothing. Alternatively, the word <quote>fail</quote> may
15492 be present instead of the second string (without any curly brackets). In this
15493 case, the expansion is forced to fail if the condition is not true (see section
15494 <xref linkend="SECTforexpfai"/>).
15495 </para>
15496 <para>
15497 If both strings are omitted, the result is the string <literal>true</literal> if the condition
15498 is true, and the empty string if the condition is false. This makes it less
15499 cumbersome to write custom ACL and router conditions. For example, instead of
15500 </para>
15501 <literallayout class="monospaced">
15502 condition = ${if &gt;{$acl_m4}{3}{true}{false}}
15503 </literallayout>
15504 <para>
15505 you can use
15506 </para>
15507 <literallayout class="monospaced">
15508 condition = ${if &gt;{$acl_m4}{3}}
15509 </literallayout>
15510 </listitem></varlistentry>
15511 <varlistentry>
15512 <term><emphasis role="bold">${imapfolder{</emphasis>&lt;<emphasis>foldername</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15513 <listitem>
15514 <para>
15515 <indexterm role="concept">
15516 <primary>expansion</primary>
15517 <secondary>imap folder</secondary>
15518 </indexterm>
15519 <indexterm role="concept">
15520 <primary><option>imapfolder</option> expansion item</primary>
15521 </indexterm>
15522 This item converts a (possibly multilevel, or with non-ASCII characters)
15523 folder specification to a Maildir name for filesystem use.
15524 For information on internationalisation support see <xref linkend="SECTi18nMDA"/>.
15525 </para>
15526 </listitem></varlistentry>
15527 <varlistentry>
15528 <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>
15529 <listitem>
15530 <para>
15531 <indexterm role="concept">
15532 <primary>expansion</primary>
15533 <secondary>string truncation</secondary>
15534 </indexterm>
15535 <indexterm role="concept">
15536 <primary><option>length</option> expansion item</primary>
15537 </indexterm>
15538 The <option>length</option> item is used to extract the initial portion of a string. Both
15539 strings are expanded, and the first one must yield a number, &lt;<emphasis>n</emphasis>&gt;, say. If
15540 you are using a fixed value for the number, that is, if &lt;<emphasis>string1</emphasis>&gt; does not
15541 change when expanded, you can use the simpler operator notation that avoids
15542 some of the braces:
15543 </para>
15544 <literallayout class="monospaced">
15545 ${length_&lt;n&gt;:&lt;string&gt;}
15546 </literallayout>
15547 <para>
15548 The result of this item is either the first &lt;<emphasis>n</emphasis>&gt; bytes or the whole
15549 of &lt;<emphasis>string2</emphasis>&gt;, whichever is the shorter. Do not confuse <option>length</option> with
15550 <option>strlen</option>, which gives the length of a string.
15551 All measurement is done in bytes and is not UTF-8 aware.
15552 </para>
15553 </listitem></varlistentry>
15554 <varlistentry>
15555 <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>
15556 <listitem>
15557 <para>
15558 <indexterm role="concept">
15559 <primary>expansion</primary>
15560 <secondary>extracting list elements by number</secondary>
15561 </indexterm>
15562 <indexterm role="concept">
15563 <primary><option>listextract</option></primary>
15564 <secondary>extract list elements by number</secondary>
15565 </indexterm>
15566 <indexterm role="concept">
15567 <primary>list</primary>
15568 <secondary>extracting elements by number</secondary>
15569 </indexterm>
15570 The &lt;<emphasis>number</emphasis>&gt; argument must consist entirely of decimal digits,
15571 apart from an optional leading minus,
15572 and leading and trailing white space (which is ignored).
15573 </para>
15574 <para>
15575 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
15576 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15577 </para>
15578 <para>
15579 The first field of the list is numbered one.
15580 If the number is negative, the fields are
15581 counted from the end of the list, with the rightmost one numbered -1.
15582 The numbered element of the list is extracted and placed in <varname>$value</varname>,
15583 then &lt;<emphasis>string2</emphasis>&gt; is expanded as the result.
15584 </para>
15585 <para>
15586 If the modulus of the
15587 number is zero or greater than the number of fields in the string,
15588 the result is the expansion of &lt;<emphasis>string3</emphasis>&gt;.
15589 </para>
15590 <para>
15591 For example:
15592 </para>
15593 <literallayout class="monospaced">
15594 ${listextract{2}{x:42:99}}
15595 </literallayout>
15596 <para>
15597 yields <quote>42</quote>, and
15598 </para>
15599 <literallayout class="monospaced">
15600 ${listextract{-3}{&lt;, x,42,99,&amp; Mailer,,/bin/bash}{result: $value}}
15601 </literallayout>
15602 <para>
15603 yields <quote>result: 42</quote>.
15604 </para>
15605 <para>
15606 If {&lt;<emphasis>string3</emphasis>&gt;} is omitted, an empty string is used for string3.
15607 If {&lt;<emphasis>string2</emphasis>&gt;} is also omitted, the value that was
15608 extracted is used.
15609 You can use <literal>fail</literal> instead of {&lt;<emphasis>string3</emphasis>&gt;} as in a string extract.
15610 </para>
15611 </listitem></varlistentry>
15612 <varlistentry>
15613 <term><emphasis role="bold">${listquote{</emphasis>&lt;<emphasis>separator</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15614 <listitem>
15615 <para>
15616 <indexterm role="concept">
15617 <primary>quoting</primary>
15618 <secondary>for list</secondary>
15619 </indexterm>
15620 <indexterm role="concept">
15621 <primary>list</primary>
15622 <secondary>quoting</secondary>
15623 </indexterm>
15624 This item doubles any occurrence of the separator character
15625 in the given string.
15626 An empty string is replaced with a single space.
15627 This converts the string into a safe form for use as a list element,
15628 in a list using the given separator.
15629 </para>
15630 </listitem></varlistentry>
15631 <varlistentry>
15632 <term><emphasis role="bold">${lookup&nbsp;{</emphasis>&lt;<emphasis>key</emphasis>&gt;<emphasis role="bold">}&nbsp;</emphasis>&lt;<emphasis>search&nbsp;type</emphasis>&gt;<emphasis role="bold">&nbsp;{</emphasis>&lt;<emphasis>file</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string1</emphasis>&gt;<emphasis role="bold">}&nbsp;{</emphasis>&lt;<emphasis>string2</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
15633 <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>
15634 <listitem>
15635 <para>
15636 <indexterm role="concept">
15637 <primary>expansion</primary>
15638 <secondary>lookup in</secondary>
15639 </indexterm>
15640 <indexterm role="concept">
15641 <primary>file</primary>
15642 <secondary>lookups</secondary>
15643 </indexterm>
15644 <indexterm role="concept">
15645 <primary>lookup</primary>
15646 <secondary>in expanded string</secondary>
15647 </indexterm>
15648 The two forms of lookup item specify data lookups in files and databases, as
15649 discussed in chapter <xref linkend="CHAPfdlookup"/>. The first form is used for single-key
15650 lookups, and the second is used for query-style lookups. The &lt;<emphasis>key</emphasis>&gt;,
15651 &lt;<emphasis>file</emphasis>&gt;, and &lt;<emphasis>query</emphasis>&gt; strings are expanded before use.
15652 </para>
15653 <para>
15654 If there is any white space in a lookup item which is part of a filter command,
15655 a retry or rewrite rule, a routing rule for the <command>manualroute</command> router, or any
15656 other place where white space is significant, the lookup item must be enclosed
15657 in double quotes. The use of data lookups in users&#x2019; filter files may be locked
15658 out by the system administrator.
15659 </para>
15660 <para>
15661 <indexterm role="variable">
15662 <primary><varname>$value</varname></primary>
15663 </indexterm>
15664 If the lookup succeeds, &lt;<emphasis>string1</emphasis>&gt; is expanded and replaces the entire item.
15665 During its expansion, the variable <varname>$value</varname> contains the data returned by the
15666 lookup. Afterwards it reverts to the value it had previously (at the outer
15667 level it is empty). If the lookup fails, &lt;<emphasis>string2</emphasis>&gt; is expanded and replaces
15668 the entire item. If {&lt;<emphasis>string2</emphasis>&gt;} is omitted, the replacement is the empty
15669 string on failure. If &lt;<emphasis>string2</emphasis>&gt; is provided, it can itself be a nested
15670 lookup, thus providing a mechanism for looking up a default value when the
15671 original lookup fails.
15672 </para>
15673 <para>
15674 If a nested lookup is used as part of &lt;<emphasis>string1</emphasis>&gt;, <varname>$value</varname> contains the
15675 data for the outer lookup while the parameters of the second lookup are
15676 expanded, and also while &lt;<emphasis>string2</emphasis>&gt; of the second lookup is expanded, should
15677 the second lookup fail. Instead of {&lt;<emphasis>string2</emphasis>&gt;} the word <quote>fail</quote> can
15678 appear, and in this case, if the lookup fails, the entire expansion is forced
15679 to fail (see section <xref linkend="SECTforexpfai"/>). If both {&lt;<emphasis>string1</emphasis>&gt;} and
15680 {&lt;<emphasis>string2</emphasis>&gt;} are omitted, the result is the looked up value in the case of a
15681 successful lookup, and nothing in the case of failure.
15682 </para>
15683 <para>
15684 For single-key lookups, the string <quote>partial</quote> is permitted to precede the
15685 search type in order to do partial matching, and * or *@ may follow a search
15686 type to request default lookups if the key does not match (see sections
15687 <xref linkend="SECTdefaultvaluelookups"/> and <xref linkend="SECTpartiallookup"/> for details).
15688 </para>
15689 <para>
15690 <indexterm role="concept">
15691 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
15692 <secondary>in lookup expansion</secondary>
15693 </indexterm>
15694 If a partial search is used, the variables <varname>$1</varname> and <varname>$2</varname> contain the wild
15695 and non-wild parts of the key during the expansion of the replacement text.
15696 They return to their previous values at the end of the lookup item.
15697 </para>
15698 <para>
15699 This example looks up the postmaster alias in the conventional alias file:
15700 </para>
15701 <literallayout class="monospaced">
15702 ${lookup {postmaster} lsearch {/etc/aliases} {$value}}
15703 </literallayout>
15704 <para>
15705 This example uses NIS+ to look up the full name of the user corresponding to
15706 the local part of an address, forcing the expansion to fail if it is not found:
15707 </para>
15708 <literallayout class="monospaced">
15709 ${lookup nisplus {[name=$local_part],passwd.org_dir:gcos} \
15710   {$value}fail}
15711 </literallayout>
15712 </listitem></varlistentry>
15713 <varlistentry>
15714 <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>
15715 <listitem>
15716 <para>
15717 <indexterm role="concept">
15718 <primary>expansion</primary>
15719 <secondary>list creation</secondary>
15720 </indexterm>
15721 <indexterm role="variable">
15722 <primary><varname>$item</varname></primary>
15723 </indexterm>
15724 After expansion, &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by
15725 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
15726 For each item
15727 in this list, its value is place in <varname>$item</varname>, and then &lt;<emphasis>string2</emphasis>&gt; is
15728 expanded and added to the output as an item in a new list. The separator used
15729 for the output list is the same as the one used for the input, but a separator
15730 setting is not included in the output. For example:
15731 </para>
15732 <literallayout class="monospaced">
15733 ${map{a:b:c}{[$item]}} ${map{&lt;- x-y-z}{($item)}}
15734 </literallayout>
15735 <para>
15736 expands to <literal>[a]:[b]:[c] (x)-(y)-(z)</literal>. At the end of the expansion, the
15737 value of <varname>$item</varname> is restored to what it was before. See also the <option>filter</option>
15738 and <option>reduce</option> expansion items.
15739 </para>
15740 </listitem></varlistentry>
15741 <varlistentry>
15742 <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>
15743 <listitem>
15744 <para>
15745 <indexterm role="concept">
15746 <primary>expansion</primary>
15747 <secondary>numeric hash</secondary>
15748 </indexterm>
15749 <indexterm role="concept">
15750 <primary>hash function</primary>
15751 <secondary>numeric</secondary>
15752 </indexterm>
15753 The three strings are expanded; the first two must yield numbers. Call them
15754 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
15755 if &lt;<emphasis>string1</emphasis>&gt; and &lt;<emphasis>string2</emphasis>&gt; do not change when they are expanded, you
15756 can use the simpler operator notation that avoids some of the braces:
15757 </para>
15758 <literallayout class="monospaced">
15759 ${nhash_&lt;n&gt;_&lt;m&gt;:&lt;string&gt;}
15760 </literallayout>
15761 <para>
15762 The second number is optional (in both notations). If there is only one number,
15763 the result is a number in the range 0&ndash;&lt;<emphasis>n</emphasis>&gt;-1. Otherwise, the string is
15764 processed by a div/mod hash function that returns two numbers, separated by a
15765 slash, in the ranges 0 to &lt;<emphasis>n</emphasis>&gt;-1 and 0 to &lt;<emphasis>m</emphasis>&gt;-1, respectively. For
15766 example,
15767 </para>
15768 <literallayout class="monospaced">
15769 ${nhash{8}{64}{supercalifragilisticexpialidocious}}
15770 </literallayout>
15771 <para>
15772 returns the string <quote>6/33</quote>.
15773 </para>
15774 </listitem></varlistentry>
15775 <varlistentry>
15776 <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>
15777 <listitem>
15778 <para>
15779 <indexterm role="concept">
15780 <primary>Perl</primary>
15781 <secondary>use in expanded string</secondary>
15782 </indexterm>
15783 <indexterm role="concept">
15784 <primary>expansion</primary>
15785 <secondary>calling Perl from</secondary>
15786 </indexterm>
15787 This item is available only if Exim has been built to include an embedded Perl
15788 interpreter. The subroutine name and the arguments are first separately
15789 expanded, and then the Perl subroutine is called with those arguments. No
15790 additional arguments need be given; the maximum number permitted, including the
15791 name of the subroutine, is nine.
15792 </para>
15793 <para>
15794 The return value of the subroutine is inserted into the expanded string, unless
15795 the return value is <option>undef</option>. In that case, the entire expansion is
15796 forced to fail, in the same way as an explicit <quote>fail</quote> on a lookup item
15797 does (see section <xref linkend="SECTforexpfai"/>).  Whatever you return is evaluated
15798 in a scalar context, thus the return value is a scalar.  For example, if you
15799 return a Perl vector, the return value is the size of the vector,
15800 not its contents.
15801 </para>
15802 <para>
15803 If the subroutine exits by calling Perl&#x2019;s <option>die</option> function, the expansion fails
15804 with the error message that was passed to <option>die</option>. More details of the embedded
15805 Perl facility are given in chapter <xref linkend="CHAPperl"/>.
15806 </para>
15807 <para>
15808 The <command>redirect</command> router has an option called <option>forbid_filter_perl</option> which locks
15809 out the use of this expansion item in filter files.
15810 </para>
15811 </listitem></varlistentry>
15812 <varlistentry>
15813 <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>
15814 <listitem>
15815 <para>
15816 <indexterm role="concept">
15817 <primary><option>prvs</option> expansion item</primary>
15818 </indexterm>
15819 The first argument is a complete email address and the second is secret
15820 keystring. The third argument, specifying a key number, is optional. If absent,
15821 it defaults to 0. The result of the expansion is a prvs-signed email address,
15822 to be typically used with the <option>return_path</option> option on an <command>smtp</command> transport
15823 as part of a bounce address tag validation (BATV) scheme. For more discussion
15824 and an example, see section <xref linkend="SECTverifyPRVS"/>.
15825 </para>
15826 </listitem></varlistentry>
15827 <varlistentry>
15828 <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>
15829 <listitem>
15830 <para>
15831 <indexterm role="concept">
15832 <primary><option>prvscheck</option> expansion item</primary>
15833 </indexterm>
15834 This expansion item is the complement of the <option>prvs</option> item. It is used for
15835 checking prvs-signed addresses. If the expansion of the first argument does not
15836 yield a syntactically valid prvs-signed address, the whole item expands to the
15837 empty string. When the first argument does expand to a syntactically valid
15838 prvs-signed address, the second argument is expanded, with the prvs-decoded
15839 version of the address and the key number extracted from the address in the
15840 variables <varname>$prvscheck_address</varname> and <varname>$prvscheck_keynum</varname>, respectively.
15841 </para>
15842 <para>
15843 These two variables can be used in the expansion of the second argument to
15844 retrieve the secret. The validity of the prvs-signed address is then checked
15845 against the secret. The result is stored in the variable <varname>$prvscheck_result</varname>,
15846 which is empty for failure or <quote>1</quote> for success.
15847 </para>
15848 <para>
15849 The third argument is optional; if it is missing, it defaults to an empty
15850 string. This argument is now expanded. If the result is an empty string, the
15851 result of the expansion is the decoded version of the address. This is the case
15852 whether or not the signature was valid. Otherwise, the result of the expansion
15853 is the expansion of the third argument.
15854 </para>
15855 <para>
15856 All three variables can be used in the expansion of the third argument.
15857 However, once the expansion is complete, only <varname>$prvscheck_result</varname> remains set.
15858 For more discussion and an example, see section <xref linkend="SECTverifyPRVS"/>.
15859 </para>
15860 </listitem></varlistentry>
15861 <varlistentry>
15862 <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>
15863 <listitem>
15864 <para>
15865 <indexterm role="concept">
15866 <primary>expansion</primary>
15867 <secondary>inserting an entire file</secondary>
15868 </indexterm>
15869 <indexterm role="concept">
15870 <primary>file</primary>
15871 <secondary>inserting into expansion</secondary>
15872 </indexterm>
15873 <indexterm role="concept">
15874 <primary><option>readfile</option> expansion item</primary>
15875 </indexterm>
15876 The filename and end-of-line (eol) string are first expanded separately. The file is
15877 then read, and its contents replace the entire item. All newline characters in
15878 the file are replaced by the end-of-line string if it is present. Otherwise,
15879 newlines are left in the string.
15880 String expansion is not applied to the contents of the file. If you want this,
15881 you must wrap the item in an <option>expand</option> operator. If the file cannot be read,
15882 the string expansion fails.
15883 </para>
15884 <para>
15885 The <command>redirect</command> router has an option called <option>forbid_filter_readfile</option> which
15886 locks out the use of this expansion item in filter files.
15887 </para>
15888 </listitem></varlistentry>
15889 <varlistentry>
15890 <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>
15891 <listitem>
15892 <para>
15893 <indexterm role="concept">
15894 <primary>expansion</primary>
15895 <secondary>inserting from a socket</secondary>
15896 </indexterm>
15897 <indexterm role="concept">
15898 <primary>socket, use of in expansion</primary>
15899 </indexterm>
15900 <indexterm role="concept">
15901 <primary><option>readsocket</option> expansion item</primary>
15902 </indexterm>
15903 This item inserts data from a Unix domain or TCP socket into the expanded
15904 string. The minimal way of using it uses just two arguments, as in these
15905 examples:
15906 </para>
15907 <literallayout class="monospaced">
15908 ${readsocket{/socket/name}{request string}}
15909 ${readsocket{inet:some.host:1234}{request string}}
15910 </literallayout>
15911 <para>
15912 For a Unix domain socket, the first substring must be the path to the socket.
15913 For an Internet socket, the first substring must contain <literal>inet:</literal> followed by
15914 a host name or IP address, followed by a colon and a port, which can be a
15915 number or the name of a TCP port in <filename>/etc/services</filename>. An IP address may
15916 optionally be enclosed in square brackets. This is best for IPv6 addresses. For
15917 example:
15918 </para>
15919 <literallayout class="monospaced">
15920 ${readsocket{inet:[::1]:1234}{request string}}
15921 </literallayout>
15922 <para>
15923 Only a single host name may be given, but if looking it up yields more than
15924 one IP address, they are each tried in turn until a connection is made. For
15925 both kinds of socket, Exim makes a connection, writes the request string
15926 (unless it is an empty string; no terminating NUL is ever sent)
15927 and reads from the socket until an end-of-file
15928 is read. A timeout of 5 seconds is applied. Additional, optional arguments
15929 extend what can be done. Firstly, you can vary the timeout. For example:
15930 </para>
15931 <literallayout class="monospaced">
15932 ${readsocket{/socket/name}{request string}{3s}}
15933 </literallayout>
15934 <para>
15935 The third argument is a list of options, of which the first element is the timeout
15936 and must be present if any options are given.
15937 Further elements are options of form <emphasis>name=value</emphasis>.
15938 Example:
15939 </para>
15940 <literallayout class="monospaced">
15941 ${readsocket{/socket/name}{request string}{3s:shutdown=no}}
15942 </literallayout>
15943 <para>
15944 The following option names are recognised:
15945 </para>
15946 <itemizedlist>
15947 <listitem>
15948 <para>
15949 <emphasis role="bold">cache</emphasis>
15950 Defines if the result data can be cached for use by a later identical
15951 request in the same process.
15952 Values are <quote>yes</quote> or <quote>no</quote> (the default).
15953 If not, all cached results for this connection specification
15954 will be invalidated.
15955 </para>
15956 </listitem>
15957 <listitem>
15958 <para>
15959 <emphasis role="bold">shutdown</emphasis>
15960 Defines whether or not a write-shutdown is done on the connection after
15961 sending the request. Values are <quote>yes</quote> (the default) or <quote>no</quote>
15962 (preferred, eg. by some webservers).
15963 </para>
15964 </listitem>
15965 <listitem>
15966 <para>
15967 <emphasis role="bold">tls</emphasis>
15968 Controls the use of TLS on the connection.
15969 Values are <quote>yes</quote> or <quote>no</quote> (the default).
15970 If it is enabled, a shutdown as described above is never done.
15971 </para>
15972 </listitem>
15973 </itemizedlist>
15974 <para>
15975 A fourth argument allows you to change any newlines that are in the data
15976 that is read, in the same way as for <option>readfile</option> (see above). This example
15977 turns them into spaces:
15978 </para>
15979 <literallayout class="monospaced">
15980 ${readsocket{inet:127.0.0.1:3294}{request string}{3s}{ }}
15981 </literallayout>
15982 <para>
15983 As with all expansions, the substrings are expanded before the processing
15984 happens. Errors in these sub-expansions cause the expansion to fail. In
15985 addition, the following errors can occur:
15986 </para>
15987 <itemizedlist>
15988 <listitem>
15989 <para>
15990 Failure to create a socket file descriptor;
15991 </para>
15992 </listitem>
15993 <listitem>
15994 <para>
15995 Failure to connect the socket;
15996 </para>
15997 </listitem>
15998 <listitem>
15999 <para>
16000 Failure to write the request string;
16001 </para>
16002 </listitem>
16003 <listitem>
16004 <para>
16005 Timeout on reading from the socket.
16006 </para>
16007 </listitem>
16008 </itemizedlist>
16009 <para>
16010 By default, any of these errors causes the expansion to fail. However, if
16011 you supply a fifth substring, it is expanded and used when any of the above
16012 errors occurs. For example:
16013 </para>
16014 <literallayout class="monospaced">
16015 ${readsocket{/socket/name}{request string}{3s}{\n}\
16016   {socket failure}}
16017 </literallayout>
16018 <para>
16019 You can test for the existence of a Unix domain socket by wrapping this
16020 expansion in <literal>${if exists</literal>, but there is a race condition between that test
16021 and the actual opening of the socket, so it is safer to use the fifth argument
16022 if you want to be absolutely sure of avoiding an expansion error for a
16023 non-existent Unix domain socket, or a failure to connect to an Internet socket.
16024 </para>
16025 <para>
16026 The <command>redirect</command> router has an option called <option>forbid_filter_readsocket</option> which
16027 locks out the use of this expansion item in filter files.
16028 </para>
16029 </listitem></varlistentry>
16030 <varlistentry>
16031 <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>
16032 <listitem>
16033 <para>
16034 <indexterm role="concept">
16035 <primary>expansion</primary>
16036 <secondary>reducing a list to a scalar</secondary>
16037 </indexterm>
16038 <indexterm role="concept">
16039 <primary>list</primary>
16040 <secondary>reducing to a scalar</secondary>
16041 </indexterm>
16042 <indexterm role="variable">
16043 <primary><varname>$value</varname></primary>
16044 </indexterm>
16045 <indexterm role="variable">
16046 <primary><varname>$item</varname></primary>
16047 </indexterm>
16048 This operation reduces a list to a single, scalar string. After expansion,
16049 &lt;<emphasis>string1</emphasis>&gt; is interpreted as a list, colon-separated by default, but the
16050 separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
16051 Then &lt;<emphasis>string2</emphasis>&gt; is expanded and
16052 assigned to the <varname>$value</varname> variable. After this, each item in the &lt;<emphasis>string1</emphasis>&gt;
16053 list is assigned to <varname>$item</varname>, in turn, and &lt;<emphasis>string3</emphasis>&gt; is expanded for each of
16054 them. The result of that expansion is assigned to <varname>$value</varname> before the next
16055 iteration. When the end of the list is reached, the final value of <varname>$value</varname> is
16056 added to the expansion output. The <option>reduce</option> expansion item can be used in a
16057 number of ways. For example, to add up a list of numbers:
16058 </para>
16059 <literallayout class="monospaced">
16060 ${reduce {&lt;, 1,2,3}{0}{${eval:$value+$item}}}
16061 </literallayout>
16062 <para>
16063 The result of that expansion would be <literal>6</literal>. The maximum of a list of numbers
16064 can be found:
16065 </para>
16066 <literallayout class="monospaced">
16067 ${reduce {3:0:9:4:6}{0}{${if &gt;{$item}{$value}{$item}{$value}}}}
16068 </literallayout>
16069 <para>
16070 At the end of a <emphasis role="bold">reduce</emphasis> expansion, the values of <varname>$item</varname> and <varname>$value</varname> are
16071 restored to what they were before. See also the <option>filter</option> and <option>map</option>
16072 expansion items.
16073 </para>
16074 </listitem></varlistentry>
16075 <varlistentry>
16076 <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>
16077 <listitem>
16078 <para>
16079 This item inserts <quote>raw</quote> header lines. It is described with the <option>header</option>
16080 expansion item in section <xref linkend="SECTexpansionitems"/> above.
16081 </para>
16082 </listitem></varlistentry>
16083 <varlistentry>
16084 <term><emphasis role="bold">${run &lt;<emphasis>options</emphasis>&gt; {</emphasis>&lt;<emphasis>command&nbsp;arg&nbsp;list</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>
16085 <listitem>
16086 <para>
16087 <indexterm role="concept">
16088 <primary>expansion</primary>
16089 <secondary>running a command</secondary>
16090 </indexterm>
16091 <indexterm role="concept">
16092 <primary><option>run</option> expansion item</primary>
16093 </indexterm>
16094 This item runs an external command, as a subprocess.
16095 </para>
16096 <para revisionflag="changed">
16097 One option is supported after the word <emphasis>run</emphasis>, comma-separated.
16098 </para>
16099 <para revisionflag="changed">
16100 If the option <emphasis>preexpand</emphasis> is not used,
16101 the command string is split into individual arguments by spaces
16102 and then each argument is expanded.
16103 Then the command is run
16104 in a separate process, but under the same uid and gid.  As in other command
16105 executions from Exim, a shell is not used by default. If the command requires
16106 a shell, you must explicitly code it.
16107 The command name may not be tainted, but the remaining arguments can be.
16108 </para>
16109 <para revisionflag="changed">
16110 <emphasis role="bold">Note</emphasis>: if tainted arguments are used, they are supplied by a
16111 potential attacker;
16112 a careful assessment for security vulnerabilities should be done.
16113 </para>
16114 <para revisionflag="changed">
16115 If the option <emphasis>preexpand</emphasis> is used,
16116 </para>
16117 <para>
16118 the command and its arguments are first expanded as one string. The result is
16119 split apart into individual arguments by spaces, and then the command is run
16120 as above.
16121 Since the arguments are split by spaces, when there is a variable expansion
16122 which has an empty result, it will cause the situation that the argument will
16123 simply be omitted when the program is actually executed by Exim. If the
16124 script/program requires a specific number of arguments and the expanded
16125 variable could possibly result in this empty expansion, the variable must be
16126 quoted. This is more difficult if the expanded variable itself could result
16127 in a string containing quotes, because it would interfere with the quotes
16128 around the command arguments. A possible guard against this is to wrap the
16129 variable in the <option>sg</option> operator to change any quote marks to some other
16130 character.
16131 </para>
16132 <para revisionflag="changed">
16133 Neither the command nor any argument may be tainted.
16134 </para>
16135 <para>
16136 The standard input for the command exists, but is empty. The standard output
16137 and standard error are set to the same file descriptor.
16138 <indexterm role="concept">
16139 <primary>return code</primary>
16140 <secondary>from <option>run</option> expansion</secondary>
16141 </indexterm>
16142 <indexterm role="variable">
16143 <primary><varname>$value</varname></primary>
16144 </indexterm>
16145 If the command succeeds (gives a zero return code) &lt;<emphasis>string1</emphasis>&gt; is expanded
16146 and replaces the entire item; during this expansion, the standard output/error
16147 from the command is in the variable <varname>$value</varname>. If the command fails,
16148 &lt;<emphasis>string2</emphasis>&gt;, if present, is expanded and used. Once again, during the
16149 expansion, the standard output/error from the command is in the variable
16150 <varname>$value</varname>.
16151 </para>
16152 <para>
16153 If &lt;<emphasis>string2</emphasis>&gt; is absent, the result is empty. Alternatively, &lt;<emphasis>string2</emphasis>&gt;
16154 can be the word <quote>fail</quote> (not in braces) to force expansion failure if the
16155 command does not succeed. If both strings are omitted, the result is contents
16156 of the standard output/error on success, and nothing on failure.
16157 </para>
16158 <para>
16159 <indexterm role="variable">
16160 <primary><varname>$run_in_acl</varname></primary>
16161 </indexterm>
16162 The standard output/error of the command is put in the variable <varname>$value</varname>.
16163 In this ACL example, the output of a command is logged for the admin to
16164 troubleshoot:
16165 </para>
16166 <literallayout class="monospaced">
16167 warn  condition    = ${run{/usr/bin/id}{yes}{no}}
16168       log_message  = Output of id: $value
16169 </literallayout>
16170 <para>
16171 If the command requires shell idioms, such as the &gt; redirect operator, the
16172 shell must be invoked directly, such as with:
16173 </para>
16174 <literallayout class="monospaced">
16175 ${run{/bin/bash -c "/usr/bin/id &gt;/tmp/id"}{yes}{yes}}
16176 </literallayout>
16177 <para>
16178 <indexterm role="variable">
16179 <primary><varname>$runrc</varname></primary>
16180 </indexterm>
16181 The return code from the command is put in the variable <varname>$runrc</varname>, and this
16182 remains set afterwards, so in a filter file you can do things like this:
16183 </para>
16184 <literallayout class="monospaced">
16185 if "${run{x y z}{}}$runrc" is 1 then ...
16186   elif $runrc is 2 then ...
16187   ...
16188 endif
16189 </literallayout>
16190 <para>
16191 If execution of the command fails (for example, the command does not exist),
16192 the return code is 127 &ndash; the same code that shells use for non-existent
16193 commands.
16194 </para>
16195 <para>
16196 <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot assume the order in which
16197 option values are expanded, except for those preconditions whose order of
16198 testing is documented. Therefore, you cannot reliably expect to set <varname>$runrc</varname>
16199 by the expansion of one option, and use it in another.
16200 </para>
16201 <para>
16202 The <command>redirect</command> router has an option called <option>forbid_filter_run</option> which locks
16203 out the use of this expansion item in filter files.
16204 </para>
16205 </listitem></varlistentry>
16206 <varlistentry>
16207 <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>
16208 <listitem>
16209 <para>
16210 <indexterm role="concept">
16211 <primary>expansion</primary>
16212 <secondary>string substitution</secondary>
16213 </indexterm>
16214 <indexterm role="concept">
16215 <primary><option>sg</option> expansion item</primary>
16216 </indexterm>
16217 This item works like Perl&#x2019;s substitution operator (s) with the global (/g)
16218 option; hence its name. However, unlike the Perl equivalent, Exim does not
16219 modify the subject string; instead it returns the modified string for insertion
16220 into the overall expansion. The item takes three arguments: the subject string,
16221 a regular expression, and a substitution string. For example:
16222 </para>
16223 <literallayout class="monospaced">
16224 ${sg{abcdefabcdef}{abc}{xyz}}
16225 </literallayout>
16226 <para>
16227 yields <quote>xyzdefxyzdef</quote>. Because all three arguments are expanded before use,
16228 if any $, } or \ characters are required in the regular expression or in the
16229 substitution string, they have to be escaped. For example:
16230 </para>
16231 <literallayout class="monospaced">
16232 ${sg{abcdef}{^(...)(...)\$}{\$2\$1}}
16233 </literallayout>
16234 <para>
16235 yields <quote>defabc</quote>, and
16236 </para>
16237 <literallayout class="monospaced">
16238 ${sg{1=A 4=D 3=C}{\N(\d+)=\N}{K\$1=}}
16239 </literallayout>
16240 <para>
16241 yields <quote>K1=A K4=D K3=C</quote>. Note the use of <literal>\N</literal> to protect the contents of
16242 the regular expression from string expansion.
16243 </para>
16244 <para>
16245 The regular expression is compiled in 8-bit mode, working against bytes
16246 rather than any Unicode-aware character handling.
16247 </para>
16248 </listitem></varlistentry>
16249 <varlistentry>
16250 <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>
16251 <listitem>
16252 <para>
16253 <indexterm role="concept">
16254 <primary>sorting</primary>
16255 <secondary>a list</secondary>
16256 </indexterm>
16257 <indexterm role="concept">
16258 <primary>list</primary>
16259 <secondary>sorting</secondary>
16260 </indexterm>
16261 <indexterm role="concept">
16262 <primary>expansion</primary>
16263 <secondary>list sorting</secondary>
16264 </indexterm>
16265 After expansion, &lt;<emphasis>string</emphasis>&gt; is interpreted as a list, colon-separated by
16266 default, but the separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
16267 The &lt;<emphasis>comparator</emphasis>&gt; argument is interpreted as the operator
16268 of a two-argument expansion condition.
16269 The numeric operators plus ge, gt, le, lt (and ~i variants) are supported.
16270 The comparison should return true when applied to two values
16271 if the first value should sort before the second value.
16272 The &lt;<emphasis>extractor</emphasis>&gt; expansion is applied repeatedly to elements of the list,
16273 the element being placed in <varname>$item</varname>,
16274 to give values for comparison.
16275 </para>
16276 <para>
16277 The item result is a sorted list,
16278 with the original list separator,
16279 of the list elements (in full) of the original.
16280 </para>
16281 <para>
16282 Examples:
16283 </para>
16284 <literallayout class="monospaced">
16285 ${sort{3:2:1:4}{&lt;}{$item}}
16286 </literallayout>
16287 <para>
16288 sorts a list of numbers, and
16289 </para>
16290 <literallayout class="monospaced">
16291 ${sort {${lookup dnsdb{&gt;:,,mx=example.com}}} {&lt;} {${listextract{1}{&lt;,$item}}}}
16292 </literallayout>
16293 <para>
16294 will sort an MX lookup into priority order.
16295 </para>
16296 </listitem></varlistentry>
16297 <varlistentry>
16298 <term><emphasis role="bold">${srs_encode&nbsp;{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>return&nbsp;path</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>original&nbsp;domain</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
16299 <listitem>
16300 <para>
16301 SRS encoding.  See SECT <xref linkend="SECTSRS"/> for details.
16302 </para>
16303 </listitem></varlistentry>
16304 <varlistentry>
16305 <term><emphasis role="bold">${substr{</emphasis>&lt;<emphasis>start</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>len</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>subject</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
16306 <listitem>
16307 <para>
16308 <indexterm role="concept">
16309 <primary><option>substr</option> expansion item</primary>
16310 </indexterm>
16311 <indexterm role="concept">
16312 <primary>substring extraction</primary>
16313 </indexterm>
16314 <indexterm role="concept">
16315 <primary>expansion</primary>
16316 <secondary>substring extraction</secondary>
16317 </indexterm>
16318 The three strings are expanded; the first two must yield numbers. Call them
16319 &lt;<emphasis>n</emphasis>&gt; and &lt;<emphasis>m</emphasis>&gt;. If you are using fixed values for these numbers, that is,
16320 if &lt;<emphasis>start</emphasis>&gt; and &lt;<emphasis>len</emphasis>&gt; do not change when they are expanded, you
16321 can use the simpler operator notation that avoids some of the braces:
16322 </para>
16323 <literallayout class="monospaced">
16324 ${substr_&lt;n&gt;_&lt;m&gt;:&lt;subject&gt;}
16325 </literallayout>
16326 <para>
16327 The second number is optional (in both notations).
16328 If it is absent in the simpler format, the preceding underscore must also be
16329 omitted.
16330 </para>
16331 <para>
16332 The <option>substr</option> item can be used to extract more general substrings than
16333 <option>length</option>. The first number, &lt;<emphasis>n</emphasis>&gt;, is a starting offset, and &lt;<emphasis>m</emphasis>&gt; is the
16334 length required. For example
16335 </para>
16336 <literallayout class="monospaced">
16337 ${substr{3}{2}{$local_part}}
16338 </literallayout>
16339 <para>
16340 If the starting offset is greater than the string length the result is the
16341 null string; if the length plus starting offset is greater than the string
16342 length, the result is the right-hand part of the string, starting from the
16343 given offset. The first byte (character) in the string has offset zero.
16344 </para>
16345 <para>
16346 The <option>substr</option> expansion item can take negative offset values to count
16347 from the right-hand end of its operand. The last byte (character) is offset -1,
16348 the second-last is offset -2, and so on. Thus, for example,
16349 </para>
16350 <literallayout class="monospaced">
16351 ${substr{-5}{2}{1234567}}
16352 </literallayout>
16353 <para>
16354 yields <quote>34</quote>. If the absolute value of a negative offset is greater than the
16355 length of the string, the substring starts at the beginning of the string, and
16356 the length is reduced by the amount of overshoot. Thus, for example,
16357 </para>
16358 <literallayout class="monospaced">
16359 ${substr{-5}{2}{12}}
16360 </literallayout>
16361 <para>
16362 yields an empty string, but
16363 </para>
16364 <literallayout class="monospaced">
16365 ${substr{-3}{2}{12}}
16366 </literallayout>
16367 <para>
16368 yields <quote>1</quote>.
16369 </para>
16370 <para>
16371 When the second number is omitted from <option>substr</option>, the remainder of the string
16372 is taken if the offset is positive. If it is negative, all bytes (characters) in the
16373 string preceding the offset point are taken. For example, an offset of -1 and
16374 no length, as in these semantically identical examples:
16375 </para>
16376 <literallayout class="monospaced">
16377 ${substr_-1:abcde}
16378 ${substr{-1}{abcde}}
16379 </literallayout>
16380 <para>
16381 yields all but the last character of the string, that is, <quote>abcd</quote>.
16382 </para>
16383 <para>
16384 All measurement is done in bytes and is not UTF-8 aware.
16385 </para>
16386 </listitem></varlistentry>
16387 <varlistentry>
16388 <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>
16389 <listitem>
16390 <para>
16391 <indexterm role="concept">
16392 <primary>expansion</primary>
16393 <secondary>character translation</secondary>
16394 </indexterm>
16395 <indexterm role="concept">
16396 <primary><option>tr</option> expansion item</primary>
16397 </indexterm>
16398 This item does single-character (in bytes) translation on its subject string. The second
16399 argument is a list of characters to be translated in the subject string. Each
16400 matching character is replaced by the corresponding character from the
16401 replacement list. For example
16402 </para>
16403 <literallayout class="monospaced">
16404 ${tr{abcdea}{ac}{13}}
16405 </literallayout>
16406 <para>
16407 yields <literal>1b3de1</literal>. If there are duplicates in the second character string, the
16408 last occurrence is used. If the third string is shorter than the second, its
16409 last character is replicated. However, if it is empty, no translation takes
16410 place.
16411 </para>
16412 <para>
16413 All character handling is done in bytes and is not UTF-8 aware.
16414 </para>
16415 </listitem></varlistentry>
16416 </variablelist>
16417 </section>
16418 <section id="SECTexpop">
16419 <title>Expansion operators</title>
16420 <para>
16421 <indexterm role="concept">
16422 <primary>expansion</primary>
16423 <secondary>operators</secondary>
16424 </indexterm>
16425 For expansion items that perform transformations on a single argument string,
16426 the <quote>operator</quote> notation is used because it is simpler and uses fewer braces.
16427 The substring is first expanded before the operation is applied to it. The
16428 following operations can be performed:
16429 </para>
16430 <variablelist>
16431 <varlistentry>
16432 <term><emphasis role="bold">${address:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16433 <listitem>
16434 <para>
16435 <indexterm role="concept">
16436 <primary>expansion</primary>
16437 <secondary>RFC 2822 address handling</secondary>
16438 </indexterm>
16439 <indexterm role="concept">
16440 <primary><option>address</option> expansion item</primary>
16441 </indexterm>
16442 The string is interpreted as an RFC 2822 address, as it might appear in a
16443 header line, and the effective address is extracted from it. If the string does
16444 not parse successfully, the result is empty.
16445 </para>
16446 <para>
16447 The parsing correctly handles SMTPUTF8 Unicode in the string.
16448 </para>
16449 </listitem></varlistentry>
16450 <varlistentry>
16451 <term><emphasis role="bold">${addresses:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16452 <listitem>
16453 <para>
16454 <indexterm role="concept">
16455 <primary>expansion</primary>
16456 <secondary>RFC 2822 address handling</secondary>
16457 </indexterm>
16458 <indexterm role="concept">
16459 <primary><option>addresses</option> expansion item</primary>
16460 </indexterm>
16461 The string (after expansion) is interpreted as a list of addresses in RFC
16462 2822 format, such as can be found in a <emphasis>To:</emphasis> or <emphasis>Cc:</emphasis> header line. The
16463 operative address (<emphasis>local-part@domain</emphasis>) is extracted from each item, and the
16464 result of the expansion is a colon-separated list, with appropriate
16465 doubling of colons should any happen to be present in the email addresses.
16466 Syntactically invalid RFC2822 address items are omitted from the output.
16467 </para>
16468 <para>
16469 It is possible to specify a character other than colon for the output
16470 separator by starting the string with &gt; followed by the new separator
16471 character. For example:
16472 </para>
16473 <literallayout class="monospaced">
16474 ${addresses:&gt;&amp; Chief &lt;ceo@up.stairs&gt;, sec@base.ment (dogsbody)}
16475 </literallayout>
16476 <para>
16477 expands to <literal>ceo@up.stairs&amp;sec@base.ment</literal>. The string is expanded
16478 first, so if the expanded string starts with &gt;, it may change the output
16479 separator unintentionally. This can be avoided by setting the output
16480 separator explicitly:
16481 </para>
16482 <literallayout class="monospaced">
16483 ${addresses:&gt;:$h_from:}
16484 </literallayout>
16485 <para>
16486 Compare the <option>address</option> (singular)
16487 expansion item, which extracts the working address from a single RFC2822
16488 address. See the <option>filter</option>, <option>map</option>, and <option>reduce</option> items for ways of
16489 processing lists.
16490 </para>
16491 <para>
16492 To clarify "list of addresses in RFC 2822 format" mentioned above, Exim follows
16493 a strict interpretation of header line formatting.  Exim parses the bare,
16494 unquoted portion of an email address and if it finds a comma, treats it as an
16495 email address separator. For the example header line:
16496 </para>
16497 <literallayout class="monospaced">
16498 From: =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;
16499 </literallayout>
16500 <para>
16501 The first example below demonstrates that Q-encoded email addresses are parsed
16502 properly if it is given the raw header (in this example, <literal>$rheader_from:</literal>).
16503 It does not see the comma because it&#x2019;s still encoded as "=2C".  The second
16504 example below is passed the contents of <literal>$header_from:</literal>, meaning it gets
16505 de-mimed. Exim sees the decoded "," so it treats it as <emphasis role="bold">two</emphasis> email addresses.
16506 The third example shows that the presence of a comma is skipped when it is
16507 quoted.  The fourth example shows SMTPUTF8 handling.
16508 </para>
16509 <literallayout class="monospaced">
16510 # exim -be '${addresses:From: \
16511 =?iso-8859-2?Q?Last=2C_First?= &lt;user@example.com&gt;}'
16512 user@example.com
16513 # exim -be '${addresses:From: Last, First &lt;user@example.com&gt;}'
16514 Last:user@example.com
16515 # exim -be '${addresses:From: "Last, First" &lt;user@example.com&gt;}'
16516 user@example.com
16517 # exim -be '${addresses:フィル &lt;フィリップ@example.jp&gt;}'
16518 フィリップ@example.jp
16519 </literallayout>
16520 </listitem></varlistentry>
16521 <varlistentry>
16522 <term><emphasis role="bold">${base32:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16523 <listitem>
16524 <para>
16525 <indexterm role="concept">
16526 <primary><option>base32</option> expansion item</primary>
16527 </indexterm>
16528 <indexterm role="concept">
16529 <primary>expansion</primary>
16530 <secondary>conversion to base 32</secondary>
16531 </indexterm>
16532 The string must consist entirely of decimal digits. The number is converted to
16533 base 32 and output as a (empty, for zero) string of characters.
16534 Only lowercase letters are used.
16535 </para>
16536 </listitem></varlistentry>
16537 <varlistentry>
16538 <term><emphasis role="bold">${base32d:</emphasis>&lt;<emphasis>base-32&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16539 <listitem>
16540 <para>
16541 <indexterm role="concept">
16542 <primary><option>base32d</option> expansion item</primary>
16543 </indexterm>
16544 <indexterm role="concept">
16545 <primary>expansion</primary>
16546 <secondary>conversion to base 32</secondary>
16547 </indexterm>
16548 The string must consist entirely of base-32 digits.
16549 The number is converted to decimal and output as a string.
16550 </para>
16551 </listitem></varlistentry>
16552 <varlistentry>
16553 <term><emphasis role="bold">${base62:</emphasis>&lt;<emphasis>digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16554 <listitem>
16555 <para>
16556 <indexterm role="concept">
16557 <primary><option>base62</option> expansion item</primary>
16558 </indexterm>
16559 <indexterm role="concept">
16560 <primary>expansion</primary>
16561 <secondary>conversion to base 62</secondary>
16562 </indexterm>
16563 The string must consist entirely of decimal digits. The number is converted to
16564 base 62 and output as a string of six characters, including leading zeros. In
16565 the few operating environments where Exim uses base 36 instead of base 62 for
16566 its message identifiers (because those systems do not have case-sensitive
16567 filenames), base 36 is used by this operator, despite its name. <emphasis role="bold">Note</emphasis>: Just
16568 to be absolutely clear: this is <emphasis>not</emphasis> base64 encoding.
16569 </para>
16570 </listitem></varlistentry>
16571 <varlistentry>
16572 <term><emphasis role="bold">${base62d:</emphasis>&lt;<emphasis>base-62&nbsp;digits</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16573 <listitem>
16574 <para>
16575 <indexterm role="concept">
16576 <primary><option>base62d</option> expansion item</primary>
16577 </indexterm>
16578 <indexterm role="concept">
16579 <primary>expansion</primary>
16580 <secondary>conversion to base 62</secondary>
16581 </indexterm>
16582 The string must consist entirely of base-62 digits, or, in operating
16583 environments where Exim uses base 36 instead of base 62 for its message
16584 identifiers, base-36 digits. The number is converted to decimal and output as a
16585 string.
16586 </para>
16587 </listitem></varlistentry>
16588 <varlistentry>
16589 <term><emphasis role="bold">${base64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16590 <listitem>
16591 <para>
16592 <indexterm role="concept">
16593 <primary>expansion</primary>
16594 <secondary>base64 encoding</secondary>
16595 </indexterm>
16596 <indexterm role="concept">
16597 <primary>base64 encoding</primary>
16598 <secondary>in string expansion</secondary>
16599 </indexterm>
16600 <indexterm role="concept">
16601 <primary><option>base64</option> expansion item</primary>
16602 </indexterm>
16603 <indexterm role="concept">
16604 <primary>certificate</primary>
16605 <secondary>base64 of DER</secondary>
16606 </indexterm>
16607 This operator converts a string into one that is base64 encoded.
16608 </para>
16609 <para>
16610 If the string is a single variable of type certificate,
16611 returns the base64 encoding of the DER form of the certificate.
16612 </para>
16613 </listitem></varlistentry>
16614 <varlistentry>
16615 <term><emphasis role="bold">${base64d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16616 <listitem>
16617 <para>
16618 <indexterm role="concept">
16619 <primary>expansion</primary>
16620 <secondary>base64 decoding</secondary>
16621 </indexterm>
16622 <indexterm role="concept">
16623 <primary>base64 decoding</primary>
16624 <secondary>in string expansion</secondary>
16625 </indexterm>
16626 <indexterm role="concept">
16627 <primary><option>base64d</option> expansion item</primary>
16628 </indexterm>
16629 This operator converts a base64-encoded string into the un-coded form.
16630 </para>
16631 </listitem></varlistentry>
16632 <varlistentry>
16633 <term><emphasis role="bold">${domain:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16634 <listitem>
16635 <para>
16636 <indexterm role="concept">
16637 <primary>domain</primary>
16638 <secondary>extraction</secondary>
16639 </indexterm>
16640 <indexterm role="concept">
16641 <primary>expansion</primary>
16642 <secondary>domain extraction</secondary>
16643 </indexterm>
16644 The string is interpreted as an RFC 2822 address and the domain is extracted
16645 from it. If the string does not parse successfully, the result is empty.
16646 </para>
16647 </listitem></varlistentry>
16648 <varlistentry>
16649 <term><emphasis role="bold">${escape:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16650 <listitem>
16651 <para>
16652 <indexterm role="concept">
16653 <primary>expansion</primary>
16654 <secondary>escaping non-printing characters</secondary>
16655 </indexterm>
16656 <indexterm role="concept">
16657 <primary><option>escape</option> expansion item</primary>
16658 </indexterm>
16659 If the string contains any non-printing characters, they are converted to
16660 escape sequences starting with a backslash. Whether characters with the most
16661 significant bit set (so-called <quote>8-bit characters</quote>) count as printing or not
16662 is controlled by the <option>print_topbitchars</option> option.
16663 </para>
16664 </listitem></varlistentry>
16665 <varlistentry>
16666 <term><emphasis role="bold">${escape8bit:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16667 <listitem>
16668 <para>
16669 <indexterm role="concept">
16670 <primary>expansion</primary>
16671 <secondary>escaping 8-bit characters</secondary>
16672 </indexterm>
16673 <indexterm role="concept">
16674 <primary><option>escape8bit</option> expansion item</primary>
16675 </indexterm>
16676 If the string contains any characters with the most significant bit set,
16677 they are converted to escape sequences starting with a backslash.
16678 Backslashes and DEL characters are also converted.
16679 </para>
16680 </listitem></varlistentry>
16681 <varlistentry>
16682 <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>
16683 <listitem>
16684 <para>
16685 <indexterm role="concept">
16686 <primary>expansion</primary>
16687 <secondary>expression evaluation</secondary>
16688 </indexterm>
16689 <indexterm role="concept">
16690 <primary>expansion</primary>
16691 <secondary>arithmetic expression</secondary>
16692 </indexterm>
16693 <indexterm role="concept">
16694 <primary><option>eval</option> expansion item</primary>
16695 </indexterm>
16696 These items supports simple arithmetic and bitwise logical operations in
16697 expansion strings. The string (after expansion) must be a conventional
16698 arithmetic expression, but it is limited to basic arithmetic operators, bitwise
16699 logical operators, and parentheses. All operations are carried out using
16700 integer arithmetic. The operator priorities are as follows (the same as in the
16701 C programming language):
16702 </para>
16703 <informaltable frame="none">
16704 <tgroup cols="2" colsep="0" rowsep="0">
16705 <colspec colwidth="70pt" align="left"/>
16706 <colspec colwidth="300pt" align="left"/>
16707 <tbody>
16708 <row>
16709 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>highest:</emphasis></entry>
16710 <entry>not (~), negate (-)</entry>
16711 </row>
16712 <row>
16713 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16714 <entry>multiply (*), divide (/), remainder (%)</entry>
16715 </row>
16716 <row>
16717 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16718 <entry>plus (+), minus (-)</entry>
16719 </row>
16720 <row>
16721 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16722 <entry>shift-left (&lt;&lt;), shift-right (&gt;&gt;)</entry>
16723 </row>
16724 <row>
16725 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16726 <entry>and (&amp;)</entry>
16727 </row>
16728 <row>
16729 <entry>&nbsp;&nbsp;&nbsp;&nbsp;</entry>
16730 <entry>xor (^)</entry>
16731 </row>
16732 <row>
16733 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>lowest:</emphasis></entry>
16734 <entry>or (|)</entry>
16735 </row>
16736 </tbody>
16737 </tgroup>
16738 </informaltable>
16739 <para>
16740 Binary operators with the same priority are evaluated from left to right. White
16741 space is permitted before or after operators.
16742 </para>
16743 <para>
16744 For <option>eval</option>, numbers may be decimal, octal (starting with <quote>0</quote>) or
16745 hexadecimal (starting with <quote>0x</quote>). For <option>eval10</option>, all numbers are taken as
16746 decimal, even if they start with a leading zero; hexadecimal numbers are not
16747 permitted. This can be useful when processing numbers extracted from dates or
16748 times, which often do have leading zeros.
16749 </para>
16750 <para>
16751 A number may be followed by <quote>K</quote>, <quote>M</quote> or <quote>G</quote> to multiply it by 1024, 1024*1024
16752 or 1024*1024*1024,
16753 respectively. Negative numbers are supported. The result of the computation is
16754 a decimal representation of the answer (without <quote>K</quote>, <quote>M</quote> or <quote>G</quote>). For example:
16755 </para>
16756 <literallayout>
16757 <literal>${eval:1+1}            </literal>  yields 2
16758 <literal>${eval:1+2*3}          </literal>  yields 7
16759 <literal>${eval:(1+2)*3}        </literal>  yields 9
16760 <literal>${eval:2+42%5}         </literal>  yields 4
16761 <literal>${eval:0xc&amp;5}          </literal>  yields 4
16762 <literal>${eval:0xc|5}          </literal>  yields 13
16763 <literal>${eval:0xc^5}          </literal>  yields 9
16764 <literal>${eval:0xc&gt;&gt;1}         </literal>  yields 6
16765 <literal>${eval:0xc&lt;&lt;1}         </literal>  yields 24
16766 <literal>${eval:~255&amp;0x1234}    </literal>  yields 4608
16767 <literal>${eval:-(~255&amp;0x1234)} </literal>  yields -4608
16768 </literallayout>
16769 <para>
16770 As a more realistic example, in an ACL you might have
16771 </para>
16772 <literallayout class="monospaced">
16773 deny   condition =                    \
16774          ${if and {                   \
16775            {&gt;{$rcpt_count}{10}}       \
16776            {                          \
16777            &lt;                          \
16778              {$recipients_count}      \
16779              {${eval:$rcpt_count/2}}  \
16780            }                          \
16781          }{yes}{no}}
16782        message = Too many bad recipients
16783 </literallayout>
16784 <para>
16785 The condition is true if there have been more than 10 RCPT commands and
16786 fewer than half of them have resulted in a valid recipient.
16787 </para>
16788 </listitem></varlistentry>
16789 <varlistentry>
16790 <term><emphasis role="bold">${expand:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16791 <listitem>
16792 <para>
16793 <indexterm role="concept">
16794 <primary>expansion</primary>
16795 <secondary>re-expansion of substring</secondary>
16796 </indexterm>
16797 The <option>expand</option> operator causes a string to be expanded for a second time. For
16798 example,
16799 </para>
16800 <literallayout class="monospaced">
16801 ${expand:${lookup{$domain}dbm{/some/file}{$value}}}
16802 </literallayout>
16803 <para>
16804 first looks up a string in a file while expanding the operand for <option>expand</option>,
16805 and then re-expands what it has found.
16806 </para>
16807 </listitem></varlistentry>
16808 <varlistentry>
16809 <term><emphasis role="bold">${from_utf8:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16810 <listitem>
16811 <para>
16812 <indexterm role="concept">
16813 <primary>Unicode</primary>
16814 </indexterm>
16815 <indexterm role="concept">
16816 <primary>UTF-8</primary>
16817 <secondary>conversion from</secondary>
16818 </indexterm>
16819 <indexterm role="concept">
16820 <primary>expansion</primary>
16821 <secondary>UTF-8 conversion</secondary>
16822 </indexterm>
16823 <indexterm role="concept">
16824 <primary><option>from_utf8</option> expansion item</primary>
16825 </indexterm>
16826 The world is slowly moving towards Unicode, although there are no standards for
16827 email yet. However, other applications (including some databases) are starting
16828 to store data in Unicode, using UTF-8 encoding. This operator converts from a
16829 UTF-8 string to an ISO-8859-1 string. UTF-8 code values greater than 255 are
16830 converted to underscores. The input must be a valid UTF-8 string. If it is not,
16831 the result is an undefined sequence of bytes.
16832 </para>
16833 <para>
16834 Unicode code points with values less than 256 are compatible with ASCII and
16835 ISO-8859-1 (also known as Latin-1).
16836 For example, character 169 is the copyright symbol in both cases, though the
16837 way it is encoded is different. In UTF-8, more than one byte is needed for
16838 characters with code values greater than 127, whereas ISO-8859-1 is a
16839 single-byte encoding (but thereby limited to 256 characters). This makes
16840 translation from UTF-8 to ISO-8859-1 straightforward.
16841 </para>
16842 </listitem></varlistentry>
16843 <varlistentry>
16844 <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>
16845 <listitem>
16846 <para>
16847 <indexterm role="concept">
16848 <primary>hash function</primary>
16849 <secondary>textual</secondary>
16850 </indexterm>
16851 <indexterm role="concept">
16852 <primary>expansion</primary>
16853 <secondary>textual hash</secondary>
16854 </indexterm>
16855 The <option>hash</option> operator is a simpler interface to the hashing function that can
16856 be used when the two parameters are fixed numbers (as opposed to strings that
16857 change when expanded). The effect is the same as
16858 </para>
16859 <literallayout class="monospaced">
16860 ${hash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
16861 </literallayout>
16862 <para>
16863 See the description of the general <option>hash</option> item above for details. The
16864 abbreviation <option>h</option> can be used when <option>hash</option> is used as an operator.
16865 </para>
16866 </listitem></varlistentry>
16867 <varlistentry>
16868 <term><emphasis role="bold">${hex2b64:</emphasis>&lt;<emphasis>hexstring</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16869 <listitem>
16870 <para>
16871 <indexterm role="concept">
16872 <primary>base64 encoding</primary>
16873 <secondary>conversion from hex</secondary>
16874 </indexterm>
16875 <indexterm role="concept">
16876 <primary>expansion</primary>
16877 <secondary>hex to base64</secondary>
16878 </indexterm>
16879 <indexterm role="concept">
16880 <primary><option>hex2b64</option> expansion item</primary>
16881 </indexterm>
16882 This operator converts a hex string into one that is base64 encoded. This can
16883 be useful for processing the output of the various hashing functions.
16884 </para>
16885 </listitem></varlistentry>
16886 <varlistentry>
16887 <term><emphasis role="bold">${hexquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16888 <listitem>
16889 <para>
16890 <indexterm role="concept">
16891 <primary>quoting</primary>
16892 <secondary>hex-encoded unprintable characters</secondary>
16893 </indexterm>
16894 <indexterm role="concept">
16895 <primary><option>hexquote</option> expansion item</primary>
16896 </indexterm>
16897 This operator converts non-printable characters in a string into a hex
16898 escape form. Byte values between 33 (!) and 126 (~) inclusive are left
16899 as is, and other byte values are converted to <literal>\xNN</literal>, for example, a
16900 byte value 127 is converted to <literal>\x7f</literal>.
16901 </para>
16902 </listitem></varlistentry>
16903 <varlistentry>
16904 <term><emphasis role="bold">${ipv6denorm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16905 <listitem>
16906 <para>
16907 <indexterm role="concept">
16908 <primary><option>ipv6denorm</option> expansion item</primary>
16909 </indexterm>
16910 <indexterm role="concept">
16911 <primary>IP address</primary>
16912 <secondary>normalisation</secondary>
16913 </indexterm>
16914 This expands an IPv6 address to a full eight-element colon-separated set
16915 of hex digits including leading zeroes.
16916 A trailing ipv4-style dotted-decimal set is converted to hex.
16917 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
16918 </para>
16919 </listitem></varlistentry>
16920 <varlistentry>
16921 <term><emphasis role="bold">${ipv6norm:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16922 <listitem>
16923 <para>
16924 <indexterm role="concept">
16925 <primary><option>ipv6norm</option> expansion item</primary>
16926 </indexterm>
16927 <indexterm role="concept">
16928 <primary>IP address</primary>
16929 <secondary>normalisation</secondary>
16930 </indexterm>
16931 <indexterm role="concept">
16932 <primary>IP address</primary>
16933 <secondary>canonical form</secondary>
16934 </indexterm>
16935 This converts an IPv6 address to canonical form.
16936 Leading zeroes of groups are omitted, and the longest
16937 set of zero-valued groups is replaced with a double colon.
16938 A trailing ipv4-style dotted-decimal set is converted to hex.
16939 Pure IPv4 addresses are converted to IPv4-mapped IPv6.
16940 </para>
16941 </listitem></varlistentry>
16942 <varlistentry>
16943 <term><emphasis role="bold">${lc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16944 <listitem>
16945 <para>
16946 <indexterm role="concept">
16947 <primary>case forcing in strings</primary>
16948 </indexterm>
16949 <indexterm role="concept">
16950 <primary>string</primary>
16951 <secondary>case forcing</secondary>
16952 </indexterm>
16953 <indexterm role="concept">
16954 <primary>lower casing</primary>
16955 </indexterm>
16956 <indexterm role="concept">
16957 <primary>expansion</primary>
16958 <secondary>case forcing</secondary>
16959 </indexterm>
16960 <indexterm role="concept">
16961 <primary><option>lc</option> expansion item</primary>
16962 </indexterm>
16963 This forces the letters in the string into lower-case, for example:
16964 </para>
16965 <literallayout class="monospaced">
16966 ${lc:$local_part}
16967 </literallayout>
16968 <para>
16969 Case is defined per the system C locale.
16970 </para>
16971 </listitem></varlistentry>
16972 <varlistentry>
16973 <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>
16974 <listitem>
16975 <para>
16976 <indexterm role="concept">
16977 <primary>expansion</primary>
16978 <secondary>string truncation</secondary>
16979 </indexterm>
16980 <indexterm role="concept">
16981 <primary><option>length</option> expansion item</primary>
16982 </indexterm>
16983 The <option>length</option> operator is a simpler interface to the <option>length</option> function that
16984 can be used when the parameter is a fixed number (as opposed to a string that
16985 changes when expanded). The effect is the same as
16986 </para>
16987 <literallayout class="monospaced">
16988 ${length{&lt;number&gt;}{&lt;string&gt;}}
16989 </literallayout>
16990 <para>
16991 See the description of the general <option>length</option> item above for details. Note that
16992 <option>length</option> is not the same as <option>strlen</option>. The abbreviation <option>l</option> can be used
16993 when <option>length</option> is used as an operator.
16994 All measurement is done in bytes and is not UTF-8 aware.
16995 </para>
16996 </listitem></varlistentry>
16997 <varlistentry>
16998 <term><emphasis role="bold">${listcount:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
16999 <listitem>
17000 <para>
17001 <indexterm role="concept">
17002 <primary>expansion</primary>
17003 <secondary>list item count</secondary>
17004 </indexterm>
17005 <indexterm role="concept">
17006 <primary>list</primary>
17007 <secondary>item count</secondary>
17008 </indexterm>
17009 <indexterm role="concept">
17010 <primary>list</primary>
17011 <secondary>count of items</secondary>
17012 </indexterm>
17013 <indexterm role="concept">
17014 <primary><option>listcount</option> expansion item</primary>
17015 </indexterm>
17016 The string is interpreted as a list and the number of items is returned.
17017 </para>
17018 </listitem></varlistentry>
17019 <varlistentry>
17020 <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>
17021 <listitem>
17022 <para>
17023 <indexterm role="concept">
17024 <primary>expansion</primary>
17025 <secondary>named list</secondary>
17026 </indexterm>
17027 <indexterm role="concept">
17028 <primary><option>listnamed</option> expansion item</primary>
17029 </indexterm>
17030 The name is interpreted as a named list and the content of the list is returned,
17031 expanding any referenced lists, re-quoting as needed for colon-separation.
17032 If the optional type is given it must be one of "a", "d", "h" or "l"
17033 and selects address-, domain-, host- or localpart- lists to search among respectively.
17034 Otherwise all types are searched in an undefined order and the first
17035 matching list is returned.
17036 <emphasis role="bold">Note</emphasis>: Neither string-expansion of lists referenced by named-list syntax elements,
17037 nor expansion of lookup elements, is done by the <option>listnamed</option> operator.
17038 </para>
17039 </listitem></varlistentry>
17040 <varlistentry>
17041 <term><emphasis role="bold">${local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17042 <listitem>
17043 <para>
17044 <indexterm role="concept">
17045 <primary>expansion</primary>
17046 <secondary>local part extraction</secondary>
17047 </indexterm>
17048 <indexterm role="concept">
17049 <primary><option>local_part</option> expansion item</primary>
17050 </indexterm>
17051 The string is interpreted as an RFC 2822 address and the local part is
17052 extracted from it. If the string does not parse successfully, the result is
17053 empty.
17054 The parsing correctly handles SMTPUTF8 Unicode in the string.
17055 </para>
17056 </listitem></varlistentry>
17057 <varlistentry>
17058 <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>
17059 <term><emphasis role="bold">${mask_n:</emphasis>&lt;<emphasis>IP&nbsp;address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>bit&nbsp;count</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17060 <listitem>
17061 <para>
17062 <indexterm role="concept">
17063 <primary>masked IP address</primary>
17064 </indexterm>
17065 <indexterm role="concept">
17066 <primary>IP address</primary>
17067 <secondary>masking</secondary>
17068 </indexterm>
17069 <indexterm role="concept">
17070 <primary>CIDR notation</primary>
17071 </indexterm>
17072 <indexterm role="concept">
17073 <primary>expansion</primary>
17074 <secondary>IP address masking</secondary>
17075 </indexterm>
17076 <indexterm role="concept">
17077 <primary><option>mask</option> expansion item</primary>
17078 </indexterm>
17079 If the form of the string to be operated on is not an IP address followed by a
17080 slash and an integer (that is, a network address in CIDR notation), the
17081 expansion fails. Otherwise, this operator converts the IP address to binary,
17082 masks off the least significant bits according to the bit count, and converts
17083 the result back to text, with mask appended. For example,
17084 </para>
17085 <literallayout class="monospaced">
17086 ${mask:10.111.131.206/28}
17087 </literallayout>
17088 <para>
17089 returns the string <quote>10.111.131.192/28</quote>.
17090 </para>
17091 <para>
17092 Since this operation is expected to
17093 be mostly used for looking up masked addresses in files, the
17094 </para>
17095 <para revisionflag="changed">
17096 normal
17097 </para>
17098 <para>
17099 result for an IPv6
17100 address uses dots to separate components instead of colons, because colon
17101 terminates a key string in lsearch files. So, for example,
17102 </para>
17103 <literallayout class="monospaced">
17104 ${mask:3ffe:ffff:836f:0a00:000a:0800:200a:c031/99}
17105 </literallayout>
17106 <para>
17107 returns the string
17108 </para>
17109 <literallayout class="monospaced">
17110 3ffe.ffff.836f.0a00.000a.0800.2000.0000/99
17111 </literallayout>
17112 <para revisionflag="changed">
17113 If the optional form <emphasis role="bold">mask_n</emphasis> is used, IPv6 address result are instead
17114 returned in normailsed form, using colons and with zero-compression.
17115 </para>
17116 <para>
17117 Letters in IPv6 addresses are always output in lower case.
17118 </para>
17119 </listitem></varlistentry>
17120 <varlistentry>
17121 <term><emphasis role="bold">${md5:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17122 <listitem>
17123 <para>
17124 <indexterm role="concept">
17125 <primary>MD5 hash</primary>
17126 </indexterm>
17127 <indexterm role="concept">
17128 <primary>expansion</primary>
17129 <secondary>MD5 hash</secondary>
17130 </indexterm>
17131 <indexterm role="concept">
17132 <primary>certificate</primary>
17133 <secondary>fingerprint</secondary>
17134 </indexterm>
17135 <indexterm role="concept">
17136 <primary><option>md5</option> expansion item</primary>
17137 </indexterm>
17138 The <option>md5</option> operator computes the MD5 hash value of the string, and returns it
17139 as a 32-digit hexadecimal number, in which any letters are in lower case.
17140 </para>
17141 <para>
17142 If the string is a single variable of type certificate,
17143 returns the MD5 hash fingerprint of the certificate.
17144 </para>
17145 </listitem></varlistentry>
17146 <varlistentry>
17147 <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>
17148 <listitem>
17149 <para>
17150 <indexterm role="concept">
17151 <primary>expansion</primary>
17152 <secondary>numeric hash</secondary>
17153 </indexterm>
17154 <indexterm role="concept">
17155 <primary>hash function</primary>
17156 <secondary>numeric</secondary>
17157 </indexterm>
17158 The <option>nhash</option> operator is a simpler interface to the numeric hashing function
17159 that can be used when the two parameters are fixed numbers (as opposed to
17160 strings that change when expanded). The effect is the same as
17161 </para>
17162 <literallayout class="monospaced">
17163 ${nhash{&lt;n&gt;}{&lt;m&gt;}{&lt;string&gt;}}
17164 </literallayout>
17165 <para>
17166 See the description of the general <option>nhash</option> item above for details.
17167 </para>
17168 </listitem></varlistentry>
17169 <varlistentry>
17170 <term><emphasis role="bold">${quote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17171 <listitem>
17172 <para>
17173 <indexterm role="concept">
17174 <primary>quoting</primary>
17175 <secondary>in string expansions</secondary>
17176 </indexterm>
17177 <indexterm role="concept">
17178 <primary>expansion</primary>
17179 <secondary>quoting</secondary>
17180 </indexterm>
17181 <indexterm role="concept">
17182 <primary><option>quote</option> expansion item</primary>
17183 </indexterm>
17184 The <option>quote</option> operator puts its argument into double quotes if it
17185 is an empty string or
17186 contains anything other than letters, digits, underscores, dots, and hyphens.
17187 Any occurrences of double quotes and backslashes are escaped with a backslash.
17188 Newlines and carriage returns are converted to <literal>\n</literal> and <literal>\r</literal>,
17189 respectively For example,
17190 </para>
17191 <literallayout class="monospaced">
17192 ${quote:ab"*"cd}
17193 </literallayout>
17194 <para>
17195 becomes
17196 </para>
17197 <literallayout class="monospaced">
17198 "ab\"*\"cd"
17199 </literallayout>
17200 <para>
17201 The place where this is useful is when the argument is a substitution from a
17202 variable or a message header.
17203 </para>
17204 </listitem></varlistentry>
17205 <varlistentry>
17206 <term><emphasis role="bold">${quote_local_part:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17207 <listitem>
17208 <para>
17209 <indexterm role="concept">
17210 <primary><option>quote_local_part</option> expansion item</primary>
17211 </indexterm>
17212 This operator is like <option>quote</option>, except that it quotes the string only if
17213 required to do so by the rules of RFC 2822 for quoting local parts. For
17214 example, a plus sign would not cause quoting (but it would for <option>quote</option>).
17215 If you are creating a new email address from the contents of <varname>$local_part</varname>
17216 (or any other unknown data), you should always use this operator.
17217 </para>
17218 <para>
17219 This quoting determination is not SMTPUTF8-aware, thus quoting non-ASCII data
17220 will likely use the quoting form.
17221 Thus <emphasis>${quote_local_part:フィル}</emphasis> will always become <emphasis>"フィル"</emphasis>.
17222 </para>
17223 </listitem></varlistentry>
17224 <varlistentry>
17225 <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>
17226 <listitem>
17227 <para>
17228 <indexterm role="concept">
17229 <primary>quoting</primary>
17230 <secondary>lookup-specific</secondary>
17231 </indexterm>
17232 This operator applies lookup-specific quoting rules to the string. Each
17233 query-style lookup type has its own quoting rules which are described with
17234 the lookups in chapter <xref linkend="CHAPfdlookup"/>. For example,
17235 </para>
17236 <literallayout class="monospaced">
17237 ${quote_ldap:two * two}
17238 </literallayout>
17239 <para>
17240 returns
17241 </para>
17242 <literallayout class="monospaced">
17243 two%20%5C2A%20two
17244 </literallayout>
17245 <para>
17246 For single-key lookup types, no quoting is ever necessary and this operator
17247 yields an unchanged string.
17248 </para>
17249 </listitem></varlistentry>
17250 <varlistentry>
17251 <term><emphasis role="bold">${randint:</emphasis>&lt;<emphasis>n</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17252 <listitem>
17253 <para>
17254 <indexterm role="concept">
17255 <primary>random number</primary>
17256 </indexterm>
17257 This operator returns a somewhat random number which is less than the
17258 supplied number and is at least 0.  The quality of this randomness depends
17259 on how Exim was built; the values are not suitable for keying material.
17260 If Exim is linked against OpenSSL then RAND_pseudo_bytes() is used.
17261 If Exim is linked against GnuTLS then gnutls_rnd(GNUTLS_RND_NONCE) is used,
17262 for versions of GnuTLS with that function.
17263 Otherwise, the implementation may be arc4random(), random() seeded by
17264 srandomdev() or srandom(), or a custom implementation even weaker than
17265 random().
17266 </para>
17267 </listitem></varlistentry>
17268 <varlistentry>
17269 <term><emphasis role="bold">${reverse_ip:</emphasis>&lt;<emphasis>ipaddr</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17270 <listitem>
17271 <para>
17272 <indexterm role="concept">
17273 <primary>expansion</primary>
17274 <secondary>IP address</secondary>
17275 </indexterm>
17276 This operator reverses an IP address; for IPv4 addresses, the result is in
17277 dotted-quad decimal form, while for IPv6 addresses the result is in
17278 dotted-nibble hexadecimal form.  In both cases, this is the "natural" form
17279 for DNS.  For example,
17280 </para>
17281 <literallayout class="monospaced">
17282 ${reverse_ip:192.0.2.4}
17283 ${reverse_ip:2001:0db8:c42:9:1:abcd:192.0.2.127}
17284 </literallayout>
17285 <para>
17286 returns
17287 </para>
17288 <literallayout class="monospaced">
17289 4.2.0.192
17290 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
17291 </literallayout>
17292 </listitem></varlistentry>
17293 <varlistentry>
17294 <term><emphasis role="bold">${rfc2047:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17295 <listitem>
17296 <para>
17297 <indexterm role="concept">
17298 <primary>expansion</primary>
17299 <secondary>RFC 2047</secondary>
17300 </indexterm>
17301 <indexterm role="concept">
17302 <primary>RFC 2047</primary>
17303 <secondary>expansion operator</secondary>
17304 </indexterm>
17305 <indexterm role="concept">
17306 <primary><option>rfc2047</option> expansion item</primary>
17307 </indexterm>
17308 This operator encodes text according to the rules of RFC 2047. This is an
17309 encoding that is used in header lines to encode non-ASCII characters. It is
17310 assumed that the input string is in the encoding specified by the
17311 <option>headers_charset</option> option, which gets its default at build time. If the string
17312 contains only characters in the range 33&ndash;126, and no instances of the
17313 characters
17314 </para>
17315 <literallayout class="monospaced">
17316 ? = ( ) &lt; &gt; @ , ; : \ " . [ ] _
17317 </literallayout>
17318 <para>
17319 it is not modified. Otherwise, the result is the RFC 2047 encoding of the
17320 string, using as many <quote>encoded words</quote> as necessary to encode all the
17321 characters.
17322 </para>
17323 </listitem></varlistentry>
17324 <varlistentry>
17325 <term><emphasis role="bold">${rfc2047d:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17326 <listitem>
17327 <para>
17328 <indexterm role="concept">
17329 <primary>expansion</primary>
17330 <secondary>RFC 2047</secondary>
17331 </indexterm>
17332 <indexterm role="concept">
17333 <primary>RFC 2047</primary>
17334 <secondary>decoding</secondary>
17335 </indexterm>
17336 <indexterm role="concept">
17337 <primary><option>rfc2047d</option> expansion item</primary>
17338 </indexterm>
17339 This operator decodes strings that are encoded as per RFC 2047. Binary zero
17340 bytes are replaced by question marks. Characters are converted into the
17341 character set defined by <option>headers_charset</option>. Overlong RFC 2047 <quote>words</quote> are
17342 not recognized unless <option>check_rfc2047_length</option> is set false.
17343 </para>
17344 <para>
17345 <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
17346 access a header line, RFC 2047 decoding is done automatically. You do not need
17347 to use this operator as well.
17348 </para>
17349 </listitem></varlistentry>
17350 <varlistentry>
17351 <term><emphasis role="bold">${rxquote:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17352 <listitem>
17353 <para>
17354 <indexterm role="concept">
17355 <primary>quoting</primary>
17356 <secondary>in regular expressions</secondary>
17357 </indexterm>
17358 <indexterm role="concept">
17359 <primary>regular expressions</primary>
17360 <secondary>quoting</secondary>
17361 </indexterm>
17362 <indexterm role="concept">
17363 <primary><option>rxquote</option> expansion item</primary>
17364 </indexterm>
17365 The <option>rxquote</option> operator inserts a backslash before any non-alphanumeric
17366 characters in its argument. This is useful when substituting the values of
17367 variables or headers inside regular expressions.
17368 </para>
17369 </listitem></varlistentry>
17370 <varlistentry>
17371 <term><emphasis role="bold">${sha1:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17372 <listitem>
17373 <para>
17374 <indexterm role="concept">
17375 <primary>SHA-1 hash</primary>
17376 </indexterm>
17377 <indexterm role="concept">
17378 <primary>expansion</primary>
17379 <secondary>SHA-1 hashing</secondary>
17380 </indexterm>
17381 <indexterm role="concept">
17382 <primary>certificate</primary>
17383 <secondary>fingerprint</secondary>
17384 </indexterm>
17385 <indexterm role="concept">
17386 <primary><option>sha1</option> expansion item</primary>
17387 </indexterm>
17388 The <option>sha1</option> operator computes the SHA-1 hash value of the string, and returns
17389 it as a 40-digit hexadecimal number, in which any letters are in upper case.
17390 </para>
17391 <para>
17392 If the string is a single variable of type certificate,
17393 returns the SHA-1 hash fingerprint of the certificate.
17394 </para>
17395 </listitem></varlistentry>
17396 <varlistentry>
17397 <term><emphasis role="bold">${sha256:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17398 <term><emphasis role="bold">${sha2:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17399 <term><emphasis role="bold">${sha2_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17400 <listitem>
17401 <para>
17402 <indexterm role="concept">
17403 <primary>SHA-256 hash</primary>
17404 </indexterm>
17405 <indexterm role="concept">
17406 <primary>SHA-2 hash</primary>
17407 </indexterm>
17408 <indexterm role="concept">
17409 <primary>certificate</primary>
17410 <secondary>fingerprint</secondary>
17411 </indexterm>
17412 <indexterm role="concept">
17413 <primary>expansion</primary>
17414 <secondary>SHA-256 hashing</secondary>
17415 </indexterm>
17416 <indexterm role="concept">
17417 <primary><option>sha256</option> expansion item</primary>
17418 </indexterm>
17419 <indexterm role="concept">
17420 <primary><option>sha2</option> expansion item</primary>
17421 </indexterm>
17422 The <option>sha256</option> operator computes the SHA-256 hash value of the string
17423 and returns
17424 it as a 64-digit hexadecimal number, in which any letters are in upper case.
17425 </para>
17426 <para>
17427 If the string is a single variable of type certificate,
17428 returns the SHA-256 hash fingerprint of the certificate.
17429 </para>
17430 <para>
17431 The operator can also be spelled <option>sha2</option> and does the same as <option>sha256</option>
17432 (except for certificates, which are not supported).
17433 Finally, if an underbar
17434 and a number is appended it specifies the output length, selecting a
17435 member of the SHA-2 family of hash functions.
17436 Values of 256, 384 and 512 are accepted, with 256 being the default.
17437 </para>
17438 </listitem></varlistentry>
17439 <varlistentry>
17440 <term><emphasis role="bold">${sha3:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17441 <term><emphasis role="bold">${sha3_&lt;n&gt;:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17442 <listitem>
17443 <para>
17444 <indexterm role="concept">
17445 <primary>SHA3 hash</primary>
17446 </indexterm>
17447 <indexterm role="concept">
17448 <primary>expansion</primary>
17449 <secondary>SHA3 hashing</secondary>
17450 </indexterm>
17451 <indexterm role="concept">
17452 <primary><option>sha3</option> expansion item</primary>
17453 </indexterm>
17454 The <option>sha3</option> operator computes the SHA3-256 hash value of the string
17455 and returns
17456 it as a 64-digit hexadecimal number, in which any letters are in upper case.
17457 </para>
17458 <para>
17459 If a number is appended, separated by an underbar, it specifies
17460 the output length.  Values of 224, 256, 384 and 512 are accepted;
17461 with 256 being the default.
17462 </para>
17463 <para>
17464 The <option>sha3</option> expansion item is only supported if Exim has been
17465 compiled with GnuTLS 3.5.0 or later,
17466 or OpenSSL 1.1.1 or later.
17467 The macro "_CRYPTO_HASH_SHA3" will be defined if it is supported.
17468 </para>
17469 </listitem></varlistentry>
17470 <varlistentry>
17471 <term><emphasis role="bold">${stat:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17472 <listitem>
17473 <para>
17474 <indexterm role="concept">
17475 <primary>expansion</primary>
17476 <secondary>statting a file</secondary>
17477 </indexterm>
17478 <indexterm role="concept">
17479 <primary>file</primary>
17480 <secondary>extracting characteristics</secondary>
17481 </indexterm>
17482 <indexterm role="concept">
17483 <primary><option>stat</option> expansion item</primary>
17484 </indexterm>
17485 The string, after expansion, must be a file path. A call to the <function>stat()</function>
17486 function is made for this path. If <function>stat()</function> fails, an error occurs and the
17487 expansion fails. If it succeeds, the data from the stat replaces the item, as a
17488 series of &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt; pairs, where the values are all numerical,
17489 except for the value of <quote>smode</quote>. The names are: <quote>mode</quote> (giving the mode as
17490 a 4-digit octal number), <quote>smode</quote> (giving the mode in symbolic format as a
17491 10-character string, as for the <emphasis>ls</emphasis> command), <quote>inode</quote>, <quote>device</quote>,
17492 <quote>links</quote>, <quote>uid</quote>, <quote>gid</quote>, <quote>size</quote>, <quote>atime</quote>, <quote>mtime</quote>, and <quote>ctime</quote>. You
17493 can extract individual fields using the <option>extract</option> expansion item.
17494 </para>
17495 <para>
17496 The use of the <option>stat</option> expansion in users&#x2019; filter files can be locked out by
17497 the system administrator. <emphasis role="bold">Warning</emphasis>: The file size may be incorrect on 32-bit
17498 systems for files larger than 2GB.
17499 </para>
17500 </listitem></varlistentry>
17501 <varlistentry>
17502 <term><emphasis role="bold">${str2b64:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17503 <listitem>
17504 <para>
17505 <indexterm role="concept">
17506 <primary><option>str2b64</option> expansion item</primary>
17507 </indexterm>
17508 Now deprecated, a synonym for the <option>base64</option> expansion operator.
17509 </para>
17510 </listitem></varlistentry>
17511 <varlistentry>
17512 <term><emphasis role="bold">${strlen:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17513 <listitem>
17514 <para>
17515 <indexterm role="concept">
17516 <primary>expansion</primary>
17517 <secondary>string length</secondary>
17518 </indexterm>
17519 <indexterm role="concept">
17520 <primary>string</primary>
17521 <secondary>length in expansion</secondary>
17522 </indexterm>
17523 <indexterm role="concept">
17524 <primary><option>strlen</option> expansion item</primary>
17525 </indexterm>
17526 The item is replaced by the length of the expanded string, expressed as a
17527 decimal number. <emphasis role="bold">Note</emphasis>: Do not confuse <option>strlen</option> with <option>length</option>.
17528 All measurement is done in bytes and is not UTF-8 aware.
17529 </para>
17530 </listitem></varlistentry>
17531 <varlistentry>
17532 <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>
17533 <listitem>
17534 <para>
17535 <indexterm role="concept">
17536 <primary><option>substr</option> expansion item</primary>
17537 </indexterm>
17538 <indexterm role="concept">
17539 <primary>substring extraction</primary>
17540 </indexterm>
17541 <indexterm role="concept">
17542 <primary>expansion</primary>
17543 <secondary>substring expansion</secondary>
17544 </indexterm>
17545 The <option>substr</option> operator is a simpler interface to the <option>substr</option> function that
17546 can be used when the two parameters are fixed numbers (as opposed to strings
17547 that change when expanded). The effect is the same as
17548 </para>
17549 <literallayout class="monospaced">
17550 ${substr{&lt;start&gt;}{&lt;length&gt;}{&lt;string&gt;}}
17551 </literallayout>
17552 <para>
17553 See the description of the general <option>substr</option> item above for details. The
17554 abbreviation <option>s</option> can be used when <option>substr</option> is used as an operator.
17555 All measurement is done in bytes and is not UTF-8 aware.
17556 </para>
17557 </listitem></varlistentry>
17558 <varlistentry>
17559 <term><emphasis role="bold">${time_eval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17560 <listitem>
17561 <para>
17562 <indexterm role="concept">
17563 <primary><option>time_eval</option> expansion item</primary>
17564 </indexterm>
17565 <indexterm role="concept">
17566 <primary>time interval</primary>
17567 <secondary>decoding</secondary>
17568 </indexterm>
17569 This item converts an Exim time interval such as <literal>2d4h5m</literal> into a number of
17570 seconds.
17571 </para>
17572 </listitem></varlistentry>
17573 <varlistentry>
17574 <term><emphasis role="bold">${time_interval:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17575 <listitem>
17576 <para>
17577 <indexterm role="concept">
17578 <primary><option>time_interval</option> expansion item</primary>
17579 </indexterm>
17580 <indexterm role="concept">
17581 <primary>time interval</primary>
17582 <secondary>formatting</secondary>
17583 </indexterm>
17584 The argument (after sub-expansion) must be a sequence of decimal digits that
17585 represents an interval of time as a number of seconds. It is converted into a
17586 number of larger units and output in Exim&#x2019;s normal time format, for example,
17587 <literal>1w3d4h2m6s</literal>.
17588 </para>
17589 </listitem></varlistentry>
17590 <varlistentry>
17591 <term><emphasis role="bold">${uc:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17592 <listitem>
17593 <para>
17594 <indexterm role="concept">
17595 <primary>case forcing in strings</primary>
17596 </indexterm>
17597 <indexterm role="concept">
17598 <primary>string</primary>
17599 <secondary>case forcing</secondary>
17600 </indexterm>
17601 <indexterm role="concept">
17602 <primary>upper casing</primary>
17603 </indexterm>
17604 <indexterm role="concept">
17605 <primary>expansion</primary>
17606 <secondary>case forcing</secondary>
17607 </indexterm>
17608 <indexterm role="concept">
17609 <primary><option>uc</option> expansion item</primary>
17610 </indexterm>
17611 This forces the letters in the string into upper-case.
17612 Case is defined per the system C locale.
17613 </para>
17614 </listitem></varlistentry>
17615 <varlistentry>
17616 <term><emphasis role="bold">${utf8clean:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17617 <listitem>
17618 <para>
17619 <indexterm role="concept">
17620 <primary>correction of invalid utf-8 sequences in strings</primary>
17621 </indexterm>
17622 <indexterm role="concept">
17623 <primary>utf-8</primary>
17624 <secondary>utf-8 sequences</secondary>
17625 </indexterm>
17626 <indexterm role="concept">
17627 <primary>incorrect utf-8</primary>
17628 </indexterm>
17629 <indexterm role="concept">
17630 <primary>expansion</primary>
17631 <secondary>utf-8 forcing</secondary>
17632 </indexterm>
17633 <indexterm role="concept">
17634 <primary><option>utf8clean</option> expansion item</primary>
17635 </indexterm>
17636 This replaces any invalid utf-8 sequence in the string by the character <literal>?</literal>.
17637 In versions of Exim before 4.92, this did not correctly do so for a truncated
17638 final codepoint&#x2019;s encoding, and the character would be silently dropped.
17639 If you must handle detection of this scenario across both sets of Exim behavior,
17640 the complexity will depend upon the task.
17641 For instance, to detect if the first character is multibyte and a 1-byte
17642 extraction can be successfully used as a path component (as is common for
17643 dividing up delivery folders), you might use:
17644 </para>
17645 <literallayout class="monospaced">
17646 condition = ${if inlist{${utf8clean:${length_1:$local_part}}}{:?}{yes}{no}}
17647 </literallayout>
17648 <para>
17649 (which will false-positive if the first character of the local part is a
17650 literal question mark).
17651 </para>
17652 </listitem></varlistentry>
17653 <varlistentry>
17654 <term><emphasis role="bold">${utf8_domain_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17655 <term><emphasis role="bold">${utf8_domain_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17656 <term><emphasis role="bold">${utf8_localpart_to_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17657 <term><emphasis role="bold">${utf8_localpart_from_alabel:</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17658 <listitem>
17659 <para>
17660 <indexterm role="concept">
17661 <primary>expansion</primary>
17662 <secondary>UTF-8</secondary>
17663 </indexterm>
17664 <indexterm role="concept">
17665 <primary>UTF-8</primary>
17666 <secondary>expansion</secondary>
17667 </indexterm>
17668 <indexterm role="concept">
17669 <primary>EAI</primary>
17670 </indexterm>
17671 <indexterm role="concept">
17672 <primary>internationalisation</primary>
17673 </indexterm>
17674 <indexterm role="concept">
17675 <primary><option>utf8_domain_to_alabel</option> expansion item</primary>
17676 </indexterm>
17677 <indexterm role="concept">
17678 <primary><option>utf8_domain_from_alabel</option> expansion item</primary>
17679 </indexterm>
17680 <indexterm role="concept">
17681 <primary><option>utf8_localpart_to_alabel</option> expansion item</primary>
17682 </indexterm>
17683 <indexterm role="concept">
17684 <primary><option>utf8_localpart_from_alabel</option> expansion item</primary>
17685 </indexterm>
17686 These convert EAI mail name components between UTF-8 and a-label forms.
17687 For information on internationalisation support see <xref linkend="SECTi18nMTA"/>.
17688 </para>
17689 </listitem></varlistentry>
17690 </variablelist>
17691 </section>
17692 <section id="SECTexpcond">
17693 <title>Expansion conditions</title>
17694 <para>
17695 <indexterm role="concept" id="IIDexpcond" class="startofrange">
17696 <primary>expansion</primary>
17697 <secondary>conditions</secondary>
17698 </indexterm>
17699 The following conditions are available for testing by the <option>${if</option> construct
17700 while expanding strings:
17701 </para>
17702 <variablelist>
17703 <varlistentry>
17704 <term><emphasis role="bold">!</emphasis>&lt;<emphasis>condition</emphasis>&gt;</term>
17705 <listitem>
17706 <para>
17707 <indexterm role="concept">
17708 <primary>expansion</primary>
17709 <secondary>negating a condition</secondary>
17710 </indexterm>
17711 <indexterm role="concept">
17712 <primary>negation</primary>
17713 <secondary>in expansion condition</secondary>
17714 </indexterm>
17715 Preceding any condition with an exclamation mark negates the result of the
17716 condition.
17717 </para>
17718 </listitem></varlistentry>
17719 <varlistentry>
17720 <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>
17721 <listitem>
17722 <para>
17723 <indexterm role="concept">
17724 <primary>numeric comparison</primary>
17725 </indexterm>
17726 <indexterm role="concept">
17727 <primary>expansion</primary>
17728 <secondary>numeric comparison</secondary>
17729 </indexterm>
17730 There are a number of symbolic operators for doing numeric comparisons. They
17731 are:
17732 </para>
17733 <informaltable frame="none">
17734 <tgroup cols="2" colsep="0" rowsep="0">
17735 <colspec colwidth="1pt" align="left"/>
17736 <colspec colwidth="1pt" align="left"/>
17737 <tbody>
17738 <row>
17739 <entry>&nbsp;&nbsp;&nbsp;&nbsp;=   </entry>
17740 <entry>equal</entry>
17741 </row>
17742 <row>
17743 <entry>&nbsp;&nbsp;&nbsp;&nbsp;==  </entry>
17744 <entry>equal</entry>
17745 </row>
17746 <row>
17747 <entry>&nbsp;&nbsp;&nbsp;&nbsp;&gt;   </entry>
17748 <entry>greater</entry>
17749 </row>
17750 <row>
17751 <entry>&nbsp;&nbsp;&nbsp;&nbsp;&gt;=  </entry>
17752 <entry>greater or equal</entry>
17753 </row>
17754 <row>
17755 <entry>&nbsp;&nbsp;&nbsp;&nbsp;&lt;   </entry>
17756 <entry>less</entry>
17757 </row>
17758 <row>
17759 <entry>&nbsp;&nbsp;&nbsp;&nbsp;&lt;=  </entry>
17760 <entry>less or equal</entry>
17761 </row>
17762 </tbody>
17763 </tgroup>
17764 </informaltable>
17765 <para>
17766 For example:
17767 </para>
17768 <literallayout class="monospaced">
17769 ${if &gt;{$message_size}{10M} ...
17770 </literallayout>
17771 <para>
17772 Note that the general negation operator provides for inequality testing. The
17773 two strings must take the form of optionally signed decimal integers,
17774 optionally followed by one of the letters <quote>K</quote>, <quote>M</quote> or <quote>G</quote> (in either upper or
17775 lower case), signifying multiplication by 1024, 1024*1024 or 1024*1024*1024, respectively.
17776 As a special case, the numerical value of an empty string is taken as
17777 zero.
17778 </para>
17779 <para>
17780 In all cases, a relative comparator OP is testing if &lt;<emphasis>string1</emphasis>&gt; OP
17781 &lt;<emphasis>string2</emphasis>&gt;; the above example is checking if <varname>$message_size</varname> is larger than
17782 10M, not if 10M is larger than <varname>$message_size</varname>.
17783 </para>
17784 </listitem></varlistentry>
17785 <varlistentry>
17786 <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>
17787 <listitem>
17788 <para>
17789 <indexterm role="concept">
17790 <primary>expansion</primary>
17791 <secondary>calling an acl</secondary>
17792 </indexterm>
17793 <indexterm role="concept">
17794 <primary><option>acl</option></primary>
17795 <secondary>expansion condition</secondary>
17796 </indexterm>
17797 The name and zero to nine argument strings are first expanded separately.  The expanded
17798 arguments are assigned to the variables <varname>$acl_arg1</varname> to <varname>$acl_arg9</varname> in order.
17799 Any unused are made empty.  The variable <varname>$acl_narg</varname> is set to the number of
17800 arguments.  The named ACL (see chapter <xref linkend="CHAPACL"/>) is called
17801 and may use the variables; if another acl expansion is used the values
17802 are restored after it returns.  If the ACL sets
17803 a value using a "message =" modifier the variable $value becomes
17804 the result of the expansion, otherwise it is empty.
17805 If the ACL returns accept the condition is true; if deny, false.
17806 If the ACL returns defer the result is a forced-fail.
17807 </para>
17808 </listitem></varlistentry>
17809 <varlistentry>
17810 <term><emphasis role="bold">bool&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17811 <listitem>
17812 <para>
17813 <indexterm role="concept">
17814 <primary>expansion</primary>
17815 <secondary>boolean parsing</secondary>
17816 </indexterm>
17817 <indexterm role="concept">
17818 <primary><option>bool</option> expansion condition</primary>
17819 </indexterm>
17820 This condition turns a string holding a true or false representation into
17821 a boolean state.  It parses <quote>true</quote>, <quote>false</quote>, <quote>yes</quote> and <quote>no</quote>
17822 (case-insensitively); also integer numbers map to true if non-zero,
17823 false if zero.
17824 An empty string is treated as false.
17825 Leading and trailing whitespace is ignored;
17826 thus a string consisting only of whitespace is false.
17827 All other string values will result in expansion failure.
17828 </para>
17829 <para>
17830 When combined with ACL variables, this expansion condition will let you
17831 make decisions in one place and act on those decisions in another place.
17832 For example:
17833 </para>
17834 <literallayout class="monospaced">
17835 ${if bool{$acl_m_privileged_sender} ...
17836 </literallayout>
17837 </listitem></varlistentry>
17838 <varlistentry>
17839 <term><emphasis role="bold">bool_lax&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
17840 <listitem>
17841 <para>
17842 <indexterm role="concept">
17843 <primary>expansion</primary>
17844 <secondary>boolean parsing</secondary>
17845 </indexterm>
17846 <indexterm role="concept">
17847 <primary><option>bool_lax</option> expansion condition</primary>
17848 </indexterm>
17849 Like <option>bool</option>, this condition turns a string into a boolean state.  But
17850 where <option>bool</option> accepts a strict set of strings, <option>bool_lax</option> uses the same
17851 loose definition that the Router <option>condition</option> option uses.  The empty string
17852 and the values <quote>false</quote>, <quote>no</quote> and <quote>0</quote> map to false, all others map to
17853 true.  Leading and trailing whitespace is ignored.
17854 </para>
17855 <para>
17856 Note that where <quote>bool{00}</quote> is false, <quote>bool_lax{00}</quote> is true.
17857 </para>
17858 </listitem></varlistentry>
17859 <varlistentry>
17860 <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>
17861 <listitem>
17862 <para>
17863 <indexterm role="concept">
17864 <primary>expansion</primary>
17865 <secondary>encrypted comparison</secondary>
17866 </indexterm>
17867 <indexterm role="concept">
17868 <primary>encrypted strings, comparing</primary>
17869 </indexterm>
17870 <indexterm role="concept">
17871 <primary><option>crypteq</option> expansion condition</primary>
17872 </indexterm>
17873 This condition is included in the Exim binary if it is built to support any
17874 authentication mechanisms (see chapter <xref linkend="CHAPSMTPAUTH"/>). Otherwise, it is
17875 necessary to define SUPPORT_CRYPTEQ in <filename>Local/Makefile</filename> to get <option>crypteq</option>
17876 included in the binary.
17877 </para>
17878 <para>
17879 The <option>crypteq</option> condition has two arguments. The first is encrypted and
17880 compared against the second, which is already encrypted. The second string may
17881 be in the LDAP form for storing encrypted strings, which starts with the
17882 encryption type in curly brackets, followed by the data. If the second string
17883 does not begin with <quote>{</quote> it is assumed to be encrypted with <function>crypt()</function> or
17884 <function>crypt16()</function> (see below), since such strings cannot begin with <quote>{</quote>.
17885 Typically this will be a field from a password file. An example of an encrypted
17886 string in LDAP form is:
17887 </para>
17888 <literallayout class="monospaced">
17889 {md5}CY9rzUYh03PK3k6DJie09g==
17890 </literallayout>
17891 <para>
17892 If such a string appears directly in an expansion, the curly brackets have to
17893 be quoted, because they are part of the expansion syntax. For example:
17894 </para>
17895 <literallayout class="monospaced">
17896 ${if crypteq {test}{\{md5\}CY9rzUYh03PK3k6DJie09g==}{yes}{no}}
17897 </literallayout>
17898 <para>
17899 The following encryption types (whose names are matched case-independently) are
17900 supported:
17901 </para>
17902 <itemizedlist>
17903 <listitem>
17904 <para>
17905 <indexterm role="concept">
17906 <primary>MD5 hash</primary>
17907 </indexterm>
17908 <indexterm role="concept">
17909 <primary>base64 encoding</primary>
17910 <secondary>in encrypted password</secondary>
17911 </indexterm>
17912 <option>{md5}</option> computes the MD5 digest of the first string, and expresses this as
17913 printable characters to compare with the remainder of the second string. If the
17914 length of the comparison string is 24, Exim assumes that it is base64 encoded
17915 (as in the above example). If the length is 32, Exim assumes that it is a
17916 hexadecimal encoding of the MD5 digest. If the length not 24 or 32, the
17917 comparison fails.
17918 </para>
17919 </listitem>
17920 <listitem>
17921 <para>
17922 <indexterm role="concept">
17923 <primary>SHA-1 hash</primary>
17924 </indexterm>
17925 <option>{sha1}</option> computes the SHA-1 digest of the first string, and expresses this as
17926 printable characters to compare with the remainder of the second string. If the
17927 length of the comparison string is 28, Exim assumes that it is base64 encoded.
17928 If the length is 40, Exim assumes that it is a hexadecimal encoding of the
17929 SHA-1 digest. If the length is not 28 or 40, the comparison fails.
17930 </para>
17931 </listitem>
17932 <listitem>
17933 <para>
17934 <indexterm role="concept">
17935 <primary><function>crypt()</function></primary>
17936 </indexterm>
17937 <option>{crypt}</option> calls the <function>crypt()</function> function, which traditionally used to use
17938 only the first eight characters of the password. However, in modern operating
17939 systems this is no longer true, and in many cases the entire password is used,
17940 whatever its length.
17941 </para>
17942 </listitem>
17943 <listitem>
17944 <para>
17945 <indexterm role="concept">
17946 <primary><function>crypt16()</function></primary>
17947 </indexterm>
17948 <option>{crypt16}</option> calls the <function>crypt16()</function> function, which was originally created to
17949 use up to 16 characters of the password in some operating systems. Again, in
17950 modern operating systems, more characters may be used.
17951 </para>
17952 </listitem>
17953 </itemizedlist>
17954 <para>
17955 Exim has its own version of <function>crypt16()</function>, which is just a double call to
17956 <function>crypt()</function>. For operating systems that have their own version, setting
17957 HAVE_CRYPT16 in <filename>Local/Makefile</filename> when building Exim causes it to use the
17958 operating system version instead of its own. This option is set by default in
17959 the OS-dependent <filename>Makefile</filename> for those operating systems that are known to
17960 support <function>crypt16()</function>.
17961 </para>
17962 <para>
17963 Some years after Exim&#x2019;s <function>crypt16()</function> was implemented, a user discovered that
17964 it was not using the same algorithm as some operating systems&#x2019; versions. It
17965 turns out that as well as <function>crypt16()</function> there is a function called
17966 <function>bigcrypt()</function> in some operating systems. This may or may not use the same
17967 algorithm, and both of them may be different to Exim&#x2019;s built-in <function>crypt16()</function>.
17968 </para>
17969 <para>
17970 However, since there is now a move away from the traditional <function>crypt()</function>
17971 functions towards using SHA1 and other algorithms, tidying up this area of
17972 Exim is seen as very low priority.
17973 </para>
17974 <para>
17975 If you do not put a encryption type (in curly brackets) in a <option>crypteq</option>
17976 comparison, the default is usually either <literal>{crypt}</literal> or <literal>{crypt16}</literal>, as
17977 determined by the setting of DEFAULT_CRYPT in <filename>Local/Makefile</filename>. The default
17978 default is <literal>{crypt}</literal>. Whatever the default, you can always use either
17979 function by specifying it explicitly in curly brackets.
17980 </para>
17981 </listitem></varlistentry>
17982 <varlistentry>
17983 <term><emphasis role="bold">def:</emphasis>&lt;<emphasis>variable&nbsp;name</emphasis>&gt;</term>
17984 <listitem>
17985 <para>
17986 <indexterm role="concept">
17987 <primary>expansion</primary>
17988 <secondary>checking for empty variable</secondary>
17989 </indexterm>
17990 <indexterm role="concept">
17991 <primary><option>def</option> expansion condition</primary>
17992 </indexterm>
17993 The <option>def</option> condition must be followed by the name of one of the expansion
17994 variables defined in section <xref linkend="SECTexpvar"/>. The condition is true if the
17995 variable does not contain the empty string. For example:
17996 </para>
17997 <literallayout class="monospaced">
17998 ${if def:sender_ident {from $sender_ident}}
17999 </literallayout>
18000 <para>
18001 Note that the variable name is given without a leading <option>$</option> character. If the
18002 variable does not exist, the expansion fails.
18003 </para>
18004 </listitem></varlistentry>
18005 <varlistentry>
18006 <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>
18007 <listitem>
18008 <para>
18009 <indexterm role="concept">
18010 <primary>expansion</primary>
18011 <secondary>checking header line existence</secondary>
18012 </indexterm>
18013 This condition is true if a message is being processed and the named header
18014 exists in the message. For example,
18015 </para>
18016 <literallayout class="monospaced">
18017 ${if def:header_reply-to:{$h_reply-to:}{$h_from:}}
18018 </literallayout>
18019 <para>
18020 <emphasis role="bold">Note</emphasis>: No <option>$</option> appears before <option>header_</option> or <option>h_</option> in the condition, and
18021 the header name must be terminated by a colon if white space does not follow.
18022 </para>
18023 </listitem></varlistentry>
18024 <varlistentry>
18025 <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>
18026 <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>
18027 <listitem>
18028 <para>
18029 <indexterm role="concept">
18030 <primary>string</primary>
18031 <secondary>comparison</secondary>
18032 </indexterm>
18033 <indexterm role="concept">
18034 <primary>expansion</primary>
18035 <secondary>string comparison</secondary>
18036 </indexterm>
18037 <indexterm role="concept">
18038 <primary><option>eq</option> expansion condition</primary>
18039 </indexterm>
18040 <indexterm role="concept">
18041 <primary><option>eqi</option> expansion condition</primary>
18042 </indexterm>
18043 The two substrings are first expanded. The condition is true if the two
18044 resulting strings are identical. For <option>eq</option> the comparison includes the case of
18045 letters, whereas for <option>eqi</option> the comparison is case-independent, where
18046 case is defined per the system C locale.
18047 </para>
18048 </listitem></varlistentry>
18049 <varlistentry>
18050 <term><emphasis role="bold">exists&nbsp;{</emphasis>&lt;<emphasis>file&nbsp;name</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18051 <listitem>
18052 <para>
18053 <indexterm role="concept">
18054 <primary>expansion</primary>
18055 <secondary>file existence test</secondary>
18056 </indexterm>
18057 <indexterm role="concept">
18058 <primary>file</primary>
18059 <secondary>existence test</secondary>
18060 </indexterm>
18061 <indexterm role="concept">
18062 <primary><option>exists</option>, expansion condition</primary>
18063 </indexterm>
18064 The substring is first expanded and then interpreted as an absolute path. The
18065 condition is true if the named file (or directory) exists. The existence test
18066 is done by calling the <function>stat()</function> function. The use of the <option>exists</option> test in
18067 users&#x2019; filter files may be locked out by the system administrator.
18068 </para>
18069 <para>
18070 <emphasis role="bold">Note:</emphasis> Testing a path using this condition is not a sufficient way of
18071 de-tainting it.
18072 Consider using a dsearch lookup.
18073 </para>
18074 </listitem></varlistentry>
18075 <varlistentry>
18076 <term><emphasis role="bold">first_delivery</emphasis></term>
18077 <listitem>
18078 <para>
18079 <indexterm role="concept">
18080 <primary>delivery</primary>
18081 <secondary>first</secondary>
18082 </indexterm>
18083 <indexterm role="concept">
18084 <primary>first delivery</primary>
18085 </indexterm>
18086 <indexterm role="concept">
18087 <primary>expansion</primary>
18088 <secondary>first delivery test</secondary>
18089 </indexterm>
18090 <indexterm role="concept">
18091 <primary><option>first_delivery</option> expansion condition</primary>
18092 </indexterm>
18093 This condition, which has no data, is true during a message&#x2019;s first delivery
18094 attempt. It is false during any subsequent delivery attempts.
18095 </para>
18096 </listitem></varlistentry>
18097 <varlistentry>
18098 <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>
18099 <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>
18100 <listitem>
18101 <para>
18102 <indexterm role="concept">
18103 <primary>list</primary>
18104 <secondary>iterative conditions</secondary>
18105 </indexterm>
18106 <indexterm role="concept">
18107 <primary>expansion</primary>
18108 <secondary><emphasis role="bold">forall</emphasis> condition</secondary>
18109 </indexterm>
18110 <indexterm role="concept">
18111 <primary>expansion</primary>
18112 <secondary><emphasis role="bold">forany</emphasis> condition</secondary>
18113 </indexterm>
18114 <indexterm role="variable">
18115 <primary><varname>$item</varname></primary>
18116 </indexterm>
18117 These conditions iterate over a list. The first argument is expanded to form
18118 the list. By default, the list separator is a colon, but it can be changed by
18119 the normal method (<xref linkend="SECTlistsepchange"/>).
18120 The second argument is interpreted as a condition that is to
18121 be applied to each item in the list in turn. During the interpretation of the
18122 condition, the current list item is placed in a variable called <varname>$item</varname>.
18123 </para>
18124 <itemizedlist>
18125 <listitem>
18126 <para>
18127 For <emphasis role="bold">forany</emphasis>, interpretation stops if the condition is true for any item, and
18128 the result of the whole condition is true. If the condition is false for all
18129 items in the list, the overall condition is false.
18130 </para>
18131 </listitem>
18132 <listitem>
18133 <para>
18134 For <emphasis role="bold">forall</emphasis>, interpretation stops if the condition is false for any item,
18135 and the result of the whole condition is false. If the condition is true for
18136 all items in the list, the overall condition is true.
18137 </para>
18138 </listitem>
18139 </itemizedlist>
18140 <para>
18141 Note that negation of <emphasis role="bold">forany</emphasis> means that the condition must be false for all
18142 items for the overall condition to succeed, and negation of <emphasis role="bold">forall</emphasis> means
18143 that the condition must be false for at least one item. In this example, the
18144 list separator is changed to a comma:
18145 </para>
18146 <literallayout class="monospaced">
18147 ${if forany{&lt;, $recipients}{match{$item}{^user3@}}{yes}{no}}
18148 </literallayout>
18149 <para>
18150 The value of <varname>$item</varname> is saved and restored while <option>forany</option> or <option>forall</option> is
18151 being processed, to enable these expansion items to be nested.
18152 </para>
18153 <para>
18154 To scan a named list, expand it with the <emphasis role="bold">listnamed</emphasis> operator.
18155 </para>
18156 </listitem></varlistentry>
18157 <varlistentry>
18158 <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>
18159 <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>
18160 <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>
18161 <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>
18162 <listitem>
18163 <para>
18164 <indexterm role="concept">
18165 <primary>JSON</primary>
18166 <secondary>iterative conditions</secondary>
18167 </indexterm>
18168 <indexterm role="concept">
18169 <primary>JSON</primary>
18170 <secondary>expansions</secondary>
18171 </indexterm>
18172 <indexterm role="concept">
18173 <primary>expansion</primary>
18174 <secondary><emphasis role="bold">forall_json</emphasis> condition</secondary>
18175 </indexterm>
18176 <indexterm role="concept">
18177 <primary>expansion</primary>
18178 <secondary><emphasis role="bold">forany_json</emphasis> condition</secondary>
18179 </indexterm>
18180 <indexterm role="concept">
18181 <primary>expansion</primary>
18182 <secondary><emphasis role="bold">forall_jsons</emphasis> condition</secondary>
18183 </indexterm>
18184 <indexterm role="concept">
18185 <primary>expansion</primary>
18186 <secondary><emphasis role="bold">forany_jsons</emphasis> condition</secondary>
18187 </indexterm>
18188 As for the above, except that the first argument must, after expansion,
18189 be a JSON array.
18190 The array separator is not changeable.
18191 For the <quote>jsons</quote> variants the elements are expected to be JSON strings
18192 and have their quotes removed before the evaluation of the condition.
18193 </para>
18194 </listitem></varlistentry>
18195 <varlistentry>
18196 <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>
18197 <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>
18198 <listitem>
18199 <para>
18200 <indexterm role="concept">
18201 <primary>string</primary>
18202 <secondary>comparison</secondary>
18203 </indexterm>
18204 <indexterm role="concept">
18205 <primary>expansion</primary>
18206 <secondary>string comparison</secondary>
18207 </indexterm>
18208 <indexterm role="concept">
18209 <primary><option>ge</option> expansion condition</primary>
18210 </indexterm>
18211 <indexterm role="concept">
18212 <primary><option>gei</option> expansion condition</primary>
18213 </indexterm>
18214 The two substrings are first expanded. The condition is true if the first
18215 string is lexically greater than or equal to the second string. For <option>ge</option> the
18216 comparison includes the case of letters, whereas for <option>gei</option> the comparison is
18217 case-independent.
18218 Case and collation order are defined per the system C locale.
18219 </para>
18220 </listitem></varlistentry>
18221 <varlistentry>
18222 <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>
18223 <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>
18224 <listitem>
18225 <para>
18226 <indexterm role="concept">
18227 <primary>string</primary>
18228 <secondary>comparison</secondary>
18229 </indexterm>
18230 <indexterm role="concept">
18231 <primary>expansion</primary>
18232 <secondary>string comparison</secondary>
18233 </indexterm>
18234 <indexterm role="concept">
18235 <primary><option>gt</option> expansion condition</primary>
18236 </indexterm>
18237 <indexterm role="concept">
18238 <primary><option>gti</option> expansion condition</primary>
18239 </indexterm>
18240 The two substrings are first expanded. The condition is true if the first
18241 string is lexically greater than the second string. For <option>gt</option> the comparison
18242 includes the case of letters, whereas for <option>gti</option> the comparison is
18243 case-independent.
18244 Case and collation order are defined per the system C locale.
18245 </para>
18246 </listitem></varlistentry>
18247 <varlistentry>
18248 <term><emphasis role="bold">inbound_srs&nbsp;{</emphasis>&lt;<emphasis>local&nbsp;part</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18249 <listitem>
18250 <para>
18251 SRS decode.  See SECT <xref linkend="SECTSRS"/> for details.
18252 </para>
18253 </listitem></varlistentry>
18254 <varlistentry>
18255 <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>
18256 <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>
18257 <listitem>
18258 <para>
18259 <indexterm role="concept">
18260 <primary>string</primary>
18261 <secondary>comparison</secondary>
18262 </indexterm>
18263 <indexterm role="concept">
18264 <primary>list</primary>
18265 <secondary>iterative conditions</secondary>
18266 </indexterm>
18267 Both strings are expanded; the second string is treated as a list of simple
18268 strings; if the first string is a member of the second, then the condition
18269 is true.
18270 For the case-independent <option>inlisti</option> condition, case is defined per the system C locale.
18271 </para>
18272 <para>
18273 These are simpler to use versions of the more powerful <emphasis role="bold">forany</emphasis> condition.
18274 Examples, and the <emphasis role="bold">forany</emphasis> equivalents:
18275 </para>
18276 <literallayout class="monospaced">
18277 ${if inlist{needle}{foo:needle:bar}}
18278   ${if forany{foo:needle:bar}{eq{$item}{needle}}}
18279 ${if inlisti{Needle}{fOo:NeeDLE:bAr}}
18280   ${if forany{fOo:NeeDLE:bAr}{eqi{$item}{Needle}}}
18281 </literallayout>
18282 <para revisionflag="changed">
18283 The variable <varname>$value</varname> will be set for a successful match and can be
18284 used in the success clause of an <option>if</option> expansion item using the condition.
18285 <indexterm role="concept">
18286 <primary>tainted data</primary>
18287 <secondary>de-tainting</secondary>
18288 </indexterm>
18289 <indexterm role="concept">
18290 <primary>de-tainting</primary>
18291 <secondary>using an inlist expansion condition</secondary>
18292 </indexterm>
18293 It will have the same taint status as the list; expansions such as
18294 </para>
18295 <literallayout class="monospaced" revisionflag="changed">
18296 ${if inlist {$h_mycode:} {0 : 1 : 42} {$value}}
18297 </literallayout>
18298 <para revisionflag="changed">
18299 can be used for de-tainting.
18300 Any previous <varname>$value</varname> is restored after the if.
18301 </para>
18302 </listitem></varlistentry>
18303 <varlistentry>
18304 <term><emphasis role="bold">isip&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18305 <term><emphasis role="bold">isip4&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18306 <term><emphasis role="bold">isip6&nbsp;{</emphasis>&lt;<emphasis>string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18307 <listitem>
18308 <para>
18309 <indexterm role="concept">
18310 <primary>IP address</primary>
18311 <secondary>testing string format</secondary>
18312 </indexterm>
18313 <indexterm role="concept">
18314 <primary>string</primary>
18315 <secondary>testing for IP address</secondary>
18316 </indexterm>
18317 <indexterm role="concept">
18318 <primary><option>isip</option> expansion condition</primary>
18319 </indexterm>
18320 <indexterm role="concept">
18321 <primary><option>isip4</option> expansion condition</primary>
18322 </indexterm>
18323 <indexterm role="concept">
18324 <primary><option>isip6</option> expansion condition</primary>
18325 </indexterm>
18326 The substring is first expanded, and then tested to see if it has the form of
18327 an IP address. Both IPv4 and IPv6 addresses are valid for <option>isip</option>, whereas
18328 <option>isip4</option> and <option>isip6</option> test specifically for IPv4 or IPv6 addresses.
18329 </para>
18330 <para>
18331 For an IPv4 address, the test is for four dot-separated components, each of
18332 which consists of from one to three digits. For an IPv6 address, up to eight
18333 colon-separated components are permitted, each containing from one to four
18334 hexadecimal digits. There may be fewer than eight components if an empty
18335 component (adjacent colons) is present. Only one empty component is permitted.
18336 </para>
18337 <para>
18338 <emphasis role="bold">Note</emphasis>: The checks used to be just on the form of the address; actual numerical
18339 values were not considered. Thus, for example, 999.999.999.999 passed the IPv4
18340 check.
18341 This is no longer the case.
18342 </para>
18343 <para>
18344 The main use of these tests is to distinguish between IP addresses and
18345 host names, or between IPv4 and IPv6 addresses. For example, you could use
18346 </para>
18347 <literallayout class="monospaced">
18348 ${if isip4{$sender_host_address}...
18349 </literallayout>
18350 <para>
18351 to test which IP version an incoming SMTP connection is using.
18352 </para>
18353 </listitem></varlistentry>
18354 <varlistentry>
18355 <term><emphasis role="bold">ldapauth&nbsp;{</emphasis>&lt;<emphasis>ldap&nbsp;query</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18356 <listitem>
18357 <para>
18358 <indexterm role="concept">
18359 <primary>LDAP</primary>
18360 <secondary>use for authentication</secondary>
18361 </indexterm>
18362 <indexterm role="concept">
18363 <primary>expansion</primary>
18364 <secondary>LDAP authentication test</secondary>
18365 </indexterm>
18366 <indexterm role="concept">
18367 <primary><option>ldapauth</option> expansion condition</primary>
18368 </indexterm>
18369 This condition supports user authentication using LDAP. See section
18370 <xref linkend="SECTldap"/> for details of how to use LDAP in lookups and the syntax of
18371 queries. For this use, the query must contain a user name and password. The
18372 query itself is not used, and can be empty. The condition is true if the
18373 password is not empty, and the user name and password are accepted by the LDAP
18374 server. An empty password is rejected without calling LDAP because LDAP binds
18375 with an empty password are considered anonymous regardless of the username, and
18376 will succeed in most configurations. See chapter <xref linkend="CHAPSMTPAUTH"/> for details
18377 of SMTP authentication, and chapter <xref linkend="CHAPplaintext"/> for an example of how
18378 this can be used.
18379 </para>
18380 </listitem></varlistentry>
18381 <varlistentry>
18382 <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>
18383 <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>
18384 <listitem>
18385 <para>
18386 <indexterm role="concept">
18387 <primary>string</primary>
18388 <secondary>comparison</secondary>
18389 </indexterm>
18390 <indexterm role="concept">
18391 <primary>expansion</primary>
18392 <secondary>string comparison</secondary>
18393 </indexterm>
18394 <indexterm role="concept">
18395 <primary><option>le</option> expansion condition</primary>
18396 </indexterm>
18397 <indexterm role="concept">
18398 <primary><option>lei</option> expansion condition</primary>
18399 </indexterm>
18400 The two substrings are first expanded. The condition is true if the first
18401 string is lexically less than or equal to the second string. For <option>le</option> the
18402 comparison includes the case of letters, whereas for <option>lei</option> the comparison is
18403 case-independent.
18404 Case and collation order are defined per the system C locale.
18405 </para>
18406 </listitem></varlistentry>
18407 <varlistentry>
18408 <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>
18409 <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>
18410 <listitem>
18411 <para>
18412 <indexterm role="concept">
18413 <primary>string</primary>
18414 <secondary>comparison</secondary>
18415 </indexterm>
18416 <indexterm role="concept">
18417 <primary>expansion</primary>
18418 <secondary>string comparison</secondary>
18419 </indexterm>
18420 <indexterm role="concept">
18421 <primary><option>lt</option> expansion condition</primary>
18422 </indexterm>
18423 <indexterm role="concept">
18424 <primary><option>lti</option> expansion condition</primary>
18425 </indexterm>
18426 The two substrings are first expanded. The condition is true if the first
18427 string is lexically less than the second string. For <option>lt</option> the comparison
18428 includes the case of letters, whereas for <option>lti</option> the comparison is
18429 case-independent.
18430 Case and collation order are defined per the system C locale.
18431 </para>
18432 </listitem></varlistentry>
18433 <varlistentry>
18434 <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>
18435 <listitem>
18436 <para>
18437 <indexterm role="concept">
18438 <primary>expansion</primary>
18439 <secondary>regular expression comparison</secondary>
18440 </indexterm>
18441 <indexterm role="concept">
18442 <primary>regular expressions</primary>
18443 <secondary>match in expanded string</secondary>
18444 </indexterm>
18445 <indexterm role="concept">
18446 <primary><option>match</option> expansion condition</primary>
18447 </indexterm>
18448 The two substrings are first expanded. The second is then treated as a regular
18449 expression and applied to the first. Because of the pre-expansion, if the
18450 regular expression contains dollar, or backslash characters, they must be
18451 escaped. Care must also be taken if the regular expression contains braces
18452 (curly brackets). A closing brace must be escaped so that it is not taken as a
18453 premature termination of &lt;<emphasis>string2</emphasis>&gt;. The easiest approach is to use the
18454 <literal>\N</literal> feature to disable expansion of the regular expression.
18455 For example,
18456 </para>
18457 <literallayout class="monospaced">
18458 ${if match {$local_part}{\N^\d{3}\N} ...
18459 </literallayout>
18460 <para>
18461 If the whole expansion string is in double quotes, further escaping of
18462 backslashes is also required.
18463 </para>
18464 <para>
18465 The condition is true if the regular expression match succeeds.
18466 The regular expression is not required to begin with a circumflex
18467 metacharacter, but if there is no circumflex, the expression is not anchored,
18468 and it may match anywhere in the subject, not just at the start. If you want
18469 the pattern to match at the end of the subject, you must include the <literal>$</literal>
18470 metacharacter at an appropriate point.
18471 All character handling is done in bytes and is not UTF-8 aware,
18472 but we might change this in a future Exim release.
18473 </para>
18474 <para>
18475 <indexterm role="concept">
18476 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
18477 <secondary>in <option>if</option> expansion</secondary>
18478 </indexterm>
18479 At the start of an <option>if</option> expansion the values of the numeric variable
18480 substitutions <varname>$1</varname> etc. are remembered. Obeying a <option>match</option> condition that
18481 succeeds causes them to be reset to the substrings of that condition and they
18482 will have these values during the expansion of the success string. At the end
18483 of the <option>if</option> expansion, the previous values are restored. After testing a
18484 combination of conditions using <option>or</option>, the subsequent values of the numeric
18485 variables are those of the condition that succeeded.
18486 </para>
18487 </listitem></varlistentry>
18488 <varlistentry>
18489 <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>
18490 <listitem>
18491 <para>
18492 <indexterm role="concept">
18493 <primary><option>match_address</option> expansion condition</primary>
18494 </indexterm>
18495 See <emphasis role="bold">match_local_part</emphasis>.
18496 </para>
18497 </listitem></varlistentry>
18498 <varlistentry>
18499 <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>
18500 <listitem>
18501 <para>
18502 <indexterm role="concept">
18503 <primary><option>match_domain</option> expansion condition</primary>
18504 </indexterm>
18505 See <emphasis role="bold">match_local_part</emphasis>.
18506 </para>
18507 </listitem></varlistentry>
18508 <varlistentry>
18509 <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>
18510 <listitem>
18511 <para>
18512 <indexterm role="concept">
18513 <primary><option>match_ip</option> expansion condition</primary>
18514 </indexterm>
18515 This condition matches an IP address to a list of IP address patterns. It must
18516 be followed by two argument strings. The first (after expansion) must be an IP
18517 address or an empty string. The second (not expanded) is a restricted host
18518 list that can match only an IP address, not a host name. For example:
18519 </para>
18520 <literallayout class="monospaced">
18521 ${if match_ip{$sender_host_address}{1.2.3.4:5.6.7.8}{...}{...}}
18522 </literallayout>
18523 <para>
18524 The specific types of host list item that are permitted in the list are:
18525 </para>
18526 <itemizedlist>
18527 <listitem>
18528 <para>
18529 An IP address, optionally with a CIDR mask.
18530 </para>
18531 </listitem>
18532 <listitem>
18533 <para>
18534 A single asterisk, which matches any IP address.
18535 </para>
18536 </listitem>
18537 <listitem>
18538 <para>
18539 An empty item, which matches only if the IP address is empty. This could be
18540 useful for testing for a locally submitted message or one from specific hosts
18541 in a single test such as
18542 </para>
18543 <literallayout class="monospaced">
18544   ${if match_ip{$sender_host_address}{:4.3.2.1:...}{...}{...}}
18545 </literallayout>
18546 <para>
18547 where the first item in the list is the empty string.
18548 </para>
18549 </listitem>
18550 <listitem>
18551 <para>
18552 The item @[] matches any of the local host&#x2019;s interface addresses.
18553 </para>
18554 </listitem>
18555 <listitem>
18556 <para>
18557 Single-key lookups are assumed to be like <quote>net-</quote> style lookups in host lists,
18558 even if <literal>net-</literal> is not specified. There is never any attempt to turn the IP
18559 address into a host name. The most common type of linear search for
18560 <emphasis role="bold">match_ip</emphasis> is likely to be <emphasis role="bold">iplsearch</emphasis>, in which the file can contain CIDR
18561 masks. For example:
18562 </para>
18563 <literallayout class="monospaced">
18564   ${if match_ip{$sender_host_address}{iplsearch;/some/file}...
18565 </literallayout>
18566 <para>
18567 It is of course possible to use other kinds of lookup, and in such a case, you
18568 do need to specify the <literal>net-</literal> prefix if you want to specify a specific
18569 address mask, for example:
18570 </para>
18571 <literallayout class="monospaced">
18572   ${if match_ip{$sender_host_address}{net24-dbm;/some/file}...
18573 </literallayout>
18574 <para>
18575 However, unless you are combining a <option>match_ip</option> condition with others, it is
18576 just as easy to use the fact that a lookup is itself a condition, and write:
18577 </para>
18578 <literallayout class="monospaced">
18579   ${lookup{${mask:$sender_host_address/24}}dbm{/a/file}...
18580 </literallayout>
18581 </listitem>
18582 </itemizedlist>
18583 <para>
18584 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
18585 Exim was built with the EXPAND_LISTMATCH_RHS option.
18586 </para>
18587 <para>
18588 Consult section <xref linkend="SECThoslispatip"/> for further details of these patterns.
18589 </para>
18590 </listitem></varlistentry>
18591 <varlistentry>
18592 <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>
18593 <listitem>
18594 <para>
18595 <indexterm role="concept">
18596 <primary>domain list</primary>
18597 <secondary>in expansion condition</secondary>
18598 </indexterm>
18599 <indexterm role="concept">
18600 <primary>address list</primary>
18601 <secondary>in expansion condition</secondary>
18602 </indexterm>
18603 <indexterm role="concept">
18604 <primary>local part</primary>
18605 <secondary>list, in expansion condition</secondary>
18606 </indexterm>
18607 <indexterm role="concept">
18608 <primary><option>match_local_part</option> expansion condition</primary>
18609 </indexterm>
18610 This condition, together with <option>match_address</option> and <option>match_domain</option>, make it
18611 possible to test domain, address, and local part lists within expansions. Each
18612 condition requires two arguments: an item and a list to match. A trivial
18613 example is:
18614 </para>
18615 <literallayout class="monospaced">
18616 ${if match_domain{a.b.c}{x.y.z:a.b.c:p.q.r}{yes}{no}}
18617 </literallayout>
18618 <para>
18619 In each case, the second argument may contain any of the allowable items for a
18620 list of the appropriate type. Also, because the second argument
18621 is a standard form of list, it is possible to refer to a named list.
18622 Thus, you can use conditions like this:
18623 </para>
18624 <literallayout class="monospaced">
18625 ${if match_domain{$domain}{+local_domains}{...
18626 </literallayout>
18627 <para>
18628 <indexterm role="concept">
18629 <primary><literal>+caseful</literal></primary>
18630 </indexterm>
18631 For address lists, the matching starts off caselessly, but the <literal>+caseful</literal>
18632 item can be used, as in all address lists, to cause subsequent items to
18633 have their local parts matched casefully. Domains are always matched
18634 caselessly.
18635 </para>
18636 <para revisionflag="changed">
18637 The variable <varname>$value</varname> will be set for a successful match and can be
18638 used in the success clause of an <option>if</option> expansion item using the condition.
18639 <indexterm role="concept">
18640 <primary>tainted data</primary>
18641 <secondary>de-tainting</secondary>
18642 </indexterm>
18643 <indexterm role="concept">
18644 <primary>de-tainting</primary>
18645 <secondary>using a match_local_part expansion condition</secondary>
18646 </indexterm>
18647 It will have the same taint status as the list; expansions such as
18648 </para>
18649 <literallayout class="monospaced" revisionflag="changed">
18650 ${if match_local_part {$local_part} {alice : bill : charlotte : dave} {$value}}
18651 </literallayout>
18652 <para revisionflag="changed">
18653 can be used for de-tainting.
18654 Any previous <varname>$value</varname> is restored after the if.
18655 </para>
18656 <para>
18657 Note that &lt;<emphasis>string2</emphasis>&gt; is not itself subject to string expansion, unless
18658 Exim was built with the EXPAND_LISTMATCH_RHS option.
18659 </para>
18660 <para>
18661 <emphasis role="bold">Note</emphasis>: Host lists are <emphasis>not</emphasis> supported in this way. This is because
18662 hosts have two identities: a name and an IP address, and it is not clear
18663 how to specify cleanly how such a test would work. However, IP addresses can be
18664 matched using <option>match_ip</option>.
18665 </para>
18666 </listitem></varlistentry>
18667 <varlistentry>
18668 <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>
18669 <listitem>
18670 <para>
18671 <indexterm role="concept">
18672 <primary>PAM authentication</primary>
18673 </indexterm>
18674 <indexterm role="concept">
18675 <primary>AUTH</primary>
18676 <secondary>with PAM</secondary>
18677 </indexterm>
18678 <indexterm role="concept">
18679 <primary>Solaris</primary>
18680 <secondary>PAM support</secondary>
18681 </indexterm>
18682 <indexterm role="concept">
18683 <primary>expansion</primary>
18684 <secondary>PAM authentication test</secondary>
18685 </indexterm>
18686 <indexterm role="concept">
18687 <primary><option>pam</option> expansion condition</primary>
18688 </indexterm>
18689 <emphasis>Pluggable Authentication Modules</emphasis>
18690 (<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
18691 available in Solaris
18692 and in some GNU/Linux distributions.
18693 The Exim support, which is intended for use in conjunction with
18694 the SMTP AUTH command, is available only if Exim is compiled with
18695 </para>
18696 <literallayout class="monospaced">
18697 SUPPORT_PAM=yes
18698 </literallayout>
18699 <para>
18700 in <filename>Local/Makefile</filename>. You probably need to add <option>-lpam</option> to EXTRALIBS, and
18701 in some releases of GNU/Linux <option>-ldl</option> is also needed.
18702 </para>
18703 <para>
18704 The argument string is first expanded, and the result must be a
18705 colon-separated list of strings. Leading and trailing white space is ignored.
18706 The PAM module is initialized with the service name <quote>exim</quote> and the user name
18707 taken from the first item in the colon-separated data string (&lt;<emphasis>string1</emphasis>&gt;).
18708 The remaining items in the data string are passed over in response to requests
18709 from the authentication function. In the simple case there will only be one
18710 request, for a password, so the data consists of just two strings.
18711 </para>
18712 <para>
18713 There can be problems if any of the strings are permitted to contain colon
18714 characters. In the usual way, these have to be doubled to avoid being taken as
18715 separators.
18716 The <option>listquote</option> expansion item can be used for this.
18717 For example, the configuration
18718 of a LOGIN authenticator might contain this setting:
18719 </para>
18720 <literallayout class="monospaced">
18721 server_condition = ${if pam{$auth1:${listquote{:}{$auth2}}}}
18722 </literallayout>
18723 <para>
18724 In some operating systems, PAM authentication can be done only from a process
18725 running as root. Since Exim is running as the Exim user when receiving
18726 messages, this means that PAM cannot be used directly in those systems.
18727 </para>
18728 </listitem></varlistentry>
18729 <varlistentry>
18730 <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>
18731 <listitem>
18732 <para>
18733 <indexterm role="concept">
18734 <primary><emphasis>pwcheck</emphasis> daemon</primary>
18735 </indexterm>
18736 <indexterm role="concept">
18737 <primary>Cyrus</primary>
18738 </indexterm>
18739 <indexterm role="concept">
18740 <primary>expansion</primary>
18741 <secondary><emphasis>pwcheck</emphasis> authentication test</secondary>
18742 </indexterm>
18743 <indexterm role="concept">
18744 <primary><option>pwcheck</option> expansion condition</primary>
18745 </indexterm>
18746 This condition supports user authentication using the Cyrus <emphasis>pwcheck</emphasis> daemon.
18747 This is one way of making it possible for passwords to be checked by a process
18748 that is not running as root. <emphasis role="bold">Note</emphasis>: The use of <emphasis>pwcheck</emphasis> is now
18749 deprecated. Its replacement is <emphasis>saslauthd</emphasis> (see below).
18750 </para>
18751 <para>
18752 The pwcheck support is not included in Exim by default. You need to specify
18753 the location of the pwcheck daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
18754 building Exim. For example:
18755 </para>
18756 <literallayout class="monospaced">
18757 CYRUS_PWCHECK_SOCKET=/var/pwcheck/pwcheck
18758 </literallayout>
18759 <para>
18760 You do not need to install the full Cyrus software suite in order to use
18761 the pwcheck daemon. You can compile and install just the daemon alone
18762 from the Cyrus SASL library. Ensure that <emphasis>exim</emphasis> is the only user that has
18763 access to the <filename>/var/pwcheck</filename> directory.
18764 </para>
18765 <para>
18766 The <option>pwcheck</option> condition takes one argument, which must be the user name and
18767 password, separated by a colon. For example, in a LOGIN authenticator
18768 configuration, you might have this:
18769 </para>
18770 <literallayout class="monospaced">
18771 server_condition = ${if pwcheck{$auth1:$auth2}}
18772 </literallayout>
18773 <para>
18774 Again, for a PLAIN authenticator configuration, this would be:
18775 </para>
18776 <literallayout class="monospaced">
18777 server_condition = ${if pwcheck{$auth2:$auth3}}
18778 </literallayout>
18779 </listitem></varlistentry>
18780 <varlistentry>
18781 <term><emphasis role="bold">queue_running</emphasis></term>
18782 <listitem>
18783 <para>
18784 <indexterm role="concept">
18785 <primary>queue runner</primary>
18786 <secondary>detecting when delivering from</secondary>
18787 </indexterm>
18788 <indexterm role="concept">
18789 <primary>expansion</primary>
18790 <secondary>queue runner test</secondary>
18791 </indexterm>
18792 <indexterm role="concept">
18793 <primary><option>queue_running</option> expansion condition</primary>
18794 </indexterm>
18795 This condition, which has no data, is true during delivery attempts that are
18796 initiated by queue runner processes, and false otherwise.
18797 </para>
18798 </listitem></varlistentry>
18799 <varlistentry>
18800 <term><emphasis role="bold">radius&nbsp;{</emphasis>&lt;<emphasis>authentication&nbsp;string</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
18801 <listitem>
18802 <para>
18803 <indexterm role="concept">
18804 <primary>Radius</primary>
18805 </indexterm>
18806 <indexterm role="concept">
18807 <primary>expansion</primary>
18808 <secondary>Radius authentication</secondary>
18809 </indexterm>
18810 <indexterm role="concept">
18811 <primary><option>radius</option> expansion condition</primary>
18812 </indexterm>
18813 Radius authentication (RFC 2865) is supported in a similar way to PAM. You must
18814 set RADIUS_CONFIG_FILE in <filename>Local/Makefile</filename> to specify the location of
18815 the Radius client configuration file in order to build Exim with Radius
18816 support.
18817 </para>
18818 <para>
18819 With just that one setting, Exim expects to be linked with the <option>radiusclient</option>
18820 library, using the original API. If you are using release 0.4.0 or later of
18821 this library, you need to set
18822 </para>
18823 <literallayout class="monospaced">
18824 RADIUS_LIB_TYPE=RADIUSCLIENTNEW
18825 </literallayout>
18826 <para>
18827 in <filename>Local/Makefile</filename> when building Exim. You can also link Exim with the
18828 <option>libradius</option> library that comes with FreeBSD. To do this, set
18829 </para>
18830 <literallayout class="monospaced">
18831 RADIUS_LIB_TYPE=RADLIB
18832 </literallayout>
18833 <para>
18834 in <filename>Local/Makefile</filename>, in addition to setting RADIUS_CONFIGURE_FILE.
18835 You may also have to supply a suitable setting in EXTRALIBS so that the
18836 Radius library can be found when Exim is linked.
18837 </para>
18838 <para>
18839 The string specified by RADIUS_CONFIG_FILE is expanded and passed to the
18840 Radius client library, which calls the Radius server. The condition is true if
18841 the authentication is successful. For example:
18842 </para>
18843 <literallayout class="monospaced">
18844 server_condition = ${if radius{&lt;arguments&gt;}}
18845 </literallayout>
18846 </listitem></varlistentry>
18847 <varlistentry>
18848 <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>
18849 <listitem>
18850 <para>
18851 <indexterm role="concept">
18852 <primary><emphasis>saslauthd</emphasis> daemon</primary>
18853 </indexterm>
18854 <indexterm role="concept">
18855 <primary>Cyrus</primary>
18856 </indexterm>
18857 <indexterm role="concept">
18858 <primary>expansion</primary>
18859 <secondary><emphasis>saslauthd</emphasis> authentication test</secondary>
18860 </indexterm>
18861 <indexterm role="concept">
18862 <primary><option>saslauthd</option> expansion condition</primary>
18863 </indexterm>
18864 This condition supports user authentication using the Cyrus <emphasis>saslauthd</emphasis>
18865 daemon. This replaces the older <emphasis>pwcheck</emphasis> daemon, which is now deprecated.
18866 Using this daemon is one way of making it possible for passwords to be checked
18867 by a process that is not running as root.
18868 </para>
18869 <para>
18870 The saslauthd support is not included in Exim by default. You need to specify
18871 the location of the saslauthd daemon&#x2019;s socket in <filename>Local/Makefile</filename> before
18872 building Exim. For example:
18873 </para>
18874 <literallayout class="monospaced">
18875 CYRUS_SASLAUTHD_SOCKET=/var/state/saslauthd/mux
18876 </literallayout>
18877 <para>
18878 You do not need to install the full Cyrus software suite in order to use
18879 the saslauthd daemon. You can compile and install just the daemon alone
18880 from the Cyrus SASL library.
18881 </para>
18882 <para>
18883 Up to four arguments can be supplied to the <option>saslauthd</option> condition, but only
18884 two are mandatory. For example:
18885 </para>
18886 <literallayout class="monospaced">
18887 server_condition = ${if saslauthd{{$auth1}{$auth2}}}
18888 </literallayout>
18889 <para>
18890 The service and the realm are optional (which is why the arguments are enclosed
18891 in their own set of braces). For details of the meaning of the service and
18892 realm, and how to run the daemon, consult the Cyrus documentation.
18893 </para>
18894 </listitem></varlistentry>
18895 </variablelist>
18896 </section>
18897 <section id="SECID84">
18898 <title>Combining expansion conditions</title>
18899 <para>
18900 <indexterm role="concept">
18901 <primary>expansion</primary>
18902 <secondary>combining conditions</secondary>
18903 </indexterm>
18904 Several conditions can be tested at once by combining them using the <option>and</option>
18905 and <option>or</option> combination conditions. Note that <option>and</option> and <option>or</option> are complete
18906 conditions on their own, and precede their lists of sub-conditions. Each
18907 sub-condition must be enclosed in braces within the overall braces that contain
18908 the list. No repetition of <option>if</option> is used.
18909 </para>
18910 <variablelist>
18911 <varlistentry>
18912 <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>
18913 <listitem>
18914 <para>
18915 <indexterm role="concept">
18916 <primary><quote>or</quote> expansion condition</primary>
18917 </indexterm>
18918 <indexterm role="concept">
18919 <primary>expansion</primary>
18920 <secondary><quote>or</quote> of conditions</secondary>
18921 </indexterm>
18922 The sub-conditions are evaluated from left to right. The condition is true if
18923 any one of the sub-conditions is true.
18924 For example,
18925 </para>
18926 <literallayout class="monospaced">
18927 ${if or {{eq{$local_part}{spqr}}{eq{$domain}{testing.com}}}...
18928 </literallayout>
18929 <para>
18930 When a true sub-condition is found, the following ones are parsed but not
18931 evaluated. If there are several <quote>match</quote> sub-conditions the values of the
18932 numeric variables afterwards are taken from the first one that succeeds.
18933 </para>
18934 </listitem></varlistentry>
18935 <varlistentry>
18936 <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>
18937 <listitem>
18938 <para>
18939 <indexterm role="concept">
18940 <primary><quote>and</quote> expansion condition</primary>
18941 </indexterm>
18942 <indexterm role="concept">
18943 <primary>expansion</primary>
18944 <secondary><quote>and</quote> of conditions</secondary>
18945 </indexterm>
18946 The sub-conditions are evaluated from left to right. The condition is true if
18947 all of the sub-conditions are true. If there are several <quote>match</quote>
18948 sub-conditions, the values of the numeric variables afterwards are taken from
18949 the last one. When a false sub-condition is found, the following ones are
18950 parsed but not evaluated.
18951 </para>
18952 </listitem></varlistentry>
18953 </variablelist>
18954 <para>
18955 <indexterm role="concept" startref="IIDexpcond" class="endofrange"/>
18956 </para>
18957 </section>
18958 <section id="SECTexpvar">
18959 <title>Expansion variables</title>
18960 <para>
18961 <indexterm role="concept">
18962 <primary>expansion</primary>
18963 <secondary>variables, list of</secondary>
18964 </indexterm>
18965 This section contains an alphabetical list of all the expansion variables. Some
18966 of them are available only when Exim is compiled with specific options such as
18967 support for TLS or the content scanning extension.
18968 </para>
18969 <para revisionflag="changed">
18970 <indexterm role="concept">
18971 <primary>tainted data</primary>
18972 </indexterm>
18973 Variables marked as <emphasis>tainted</emphasis> are likely to carry data supplied by
18974 a potential attacker.
18975 Variables without such marking may also, depending on how their
18976 values are created.
18977 Such variables should not be further expanded,
18978 used as filenames
18979 or used as command-line arguments for external commands.
18980 </para>
18981 <variablelist>
18982 <varlistentry>
18983 <term><varname>$0</varname>, <varname>$1</varname>, etc</term>
18984 <listitem>
18985 <para>
18986 <indexterm role="concept">
18987 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
18988 </indexterm>
18989 When a <option>match</option> expansion condition succeeds, these variables contain the
18990 captured substrings identified by the regular expression during subsequent
18991 processing of the success string of the containing <option>if</option> expansion item.
18992 In the expansion condition case
18993 they do not retain their values afterwards; in fact, their previous
18994 values are restored at the end of processing an <option>if</option> item. The numerical
18995 variables may also be set externally by some other matching process which
18996 precedes the expansion of the string. For example, the commands available in
18997 Exim filter files include an <option>if</option> command with its own regular expression
18998 matching condition.
18999 </para>
19000 <para revisionflag="changed">
19001 If the subject string was tainted then any captured substring will also be.
19002 </para>
19003 </listitem></varlistentry>
19004 <varlistentry>
19005 <term><varname>$acl_arg1</varname>, <varname>$acl_arg2</varname>, etc</term>
19006 <listitem>
19007 <para>
19008 Within an acl condition, expansion condition or expansion item
19009 any arguments are copied to these variables,
19010 any unused variables being made empty.
19011 </para>
19012 </listitem></varlistentry>
19013 <varlistentry>
19014 <term><varname>$acl_c...</varname></term>
19015 <listitem>
19016 <para>
19017 Values can be placed in these variables by the <option>set</option> modifier in an ACL. They
19018 can be given any name that starts with <varname>$acl_c</varname> and is at least six characters
19019 long, but the sixth character must be either a digit or an underscore. For
19020 example: <varname>$acl_c5</varname>, <varname>$acl_c_mycount</varname>. The values of the <varname>$acl_c...</varname>
19021 variables persist throughout the lifetime of an SMTP connection. They can be
19022 used to pass information between ACLs and between different invocations of the
19023 same ACL. When a message is received, the values of these variables are saved
19024 with the message, and can be accessed by filters, routers, and transports
19025 during subsequent delivery.
19026 </para>
19027 </listitem></varlistentry>
19028 <varlistentry>
19029 <term><varname>$acl_m...</varname></term>
19030 <listitem>
19031 <para>
19032 These variables are like the <varname>$acl_c...</varname> variables, except that their values
19033 are reset after a message has been received. Thus, if several messages are
19034 received in one SMTP connection, <varname>$acl_m...</varname> values are not passed on from one
19035 message to the next, as <varname>$acl_c...</varname> values are. The <varname>$acl_m...</varname> variables are
19036 also reset by MAIL, RSET, EHLO, HELO, and after starting a TLS session. When a
19037 message is received, the values of these variables are saved with the message,
19038 and can be accessed by filters, routers, and transports during subsequent
19039 delivery.
19040 </para>
19041 </listitem></varlistentry>
19042 <varlistentry>
19043 <term><varname>$acl_narg</varname></term>
19044 <listitem>
19045 <para>
19046 Within an acl condition, expansion condition or expansion item
19047 this variable has the number of arguments.
19048 </para>
19049 </listitem></varlistentry>
19050 <varlistentry>
19051 <term><varname>$acl_verify_message</varname></term>
19052 <listitem>
19053 <para>
19054 <indexterm role="variable">
19055 <primary><varname>$acl_verify_message</varname></primary>
19056 </indexterm>
19057 After an address verification has failed, this variable contains the failure
19058 message. It retains its value for use in subsequent modifiers of the verb.
19059 The message can be preserved by coding like this:
19060 </para>
19061 <literallayout class="monospaced">
19062 warn !verify = sender
19063      set acl_m0 = $acl_verify_message
19064 </literallayout>
19065 <para>
19066 You can use <varname>$acl_verify_message</varname> during the expansion of the <option>message</option> or
19067 <option>log_message</option> modifiers, to include information about the verification
19068 failure.
19069 <emphasis role="bold">Note</emphasis>: The variable is cleared at the end of processing the ACL verb.
19070 </para>
19071 </listitem></varlistentry>
19072 <varlistentry>
19073 <term><varname>$address_data</varname></term>
19074 <listitem>
19075 <para>
19076 <indexterm role="variable">
19077 <primary><varname>$address_data</varname></primary>
19078 </indexterm>
19079 This variable is set by means of the <option>address_data</option> option in routers. The
19080 value then remains with the address while it is processed by subsequent routers
19081 and eventually a transport. If the transport is handling multiple addresses,
19082 the value from the first address is used. See chapter <xref linkend="CHAProutergeneric"/>
19083 for more details. <emphasis role="bold">Note</emphasis>: The contents of <varname>$address_data</varname> are visible in
19084 user filter files.
19085 </para>
19086 <para>
19087 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify
19088 a recipient address, the final value is still in the variable for subsequent
19089 conditions and modifiers of the ACL statement. If routing the address caused it
19090 to be redirected to just one address, the child address is also routed as part
19091 of the verification, and in this case the final value of <varname>$address_data</varname> is
19092 from the child&#x2019;s routing.
19093 </para>
19094 <para>
19095 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
19096 sender address, the final value is also preserved, but this time in
19097 <varname>$sender_address_data</varname>, to distinguish it from data from a recipient
19098 address.
19099 </para>
19100 <para>
19101 In both cases (recipient and sender verification), the value does not persist
19102 after the end of the current ACL statement. If you want to preserve
19103 these values for longer, you can save them in ACL variables.
19104 </para>
19105 </listitem></varlistentry>
19106 <varlistentry>
19107 <term><varname>$address_file</varname></term>
19108 <listitem>
19109 <para>
19110 <indexterm role="variable">
19111 <primary><varname>$address_file</varname></primary>
19112 </indexterm>
19113 When, as a result of aliasing, forwarding, or filtering, a message is directed
19114 to a specific file, this variable holds the name of the file when the transport
19115 is running. At other times, the variable is empty. For example, using the
19116 default configuration, if user <option>r2d2</option> has a <filename>.forward</filename> file containing
19117 </para>
19118 <literallayout class="monospaced">
19119 /home/r2d2/savemail
19120 </literallayout>
19121 <para>
19122 then when the <command>address_file</command> transport is running, <varname>$address_file</varname>
19123 contains the text string <literal>/home/r2d2/savemail</literal>.
19124 <indexterm role="concept">
19125 <primary>Sieve filter</primary>
19126 <secondary>value of <varname>$address_file</varname></secondary>
19127 </indexterm>
19128 For Sieve filters, the value may be <quote>inbox</quote> or a relative folder name. It is
19129 then up to the transport configuration to generate an appropriate absolute path
19130 to the relevant file.
19131 </para>
19132 </listitem></varlistentry>
19133 <varlistentry>
19134 <term><varname>$address_pipe</varname></term>
19135 <listitem>
19136 <para>
19137 <indexterm role="variable">
19138 <primary><varname>$address_pipe</varname></primary>
19139 </indexterm>
19140 When, as a result of aliasing or forwarding, a message is directed to a pipe,
19141 this variable holds the pipe command when the transport is running.
19142 </para>
19143 </listitem></varlistentry>
19144 <varlistentry>
19145 <term><varname>$auth1</varname> &ndash; <varname>$auth4</varname></term>
19146 <listitem>
19147 <para>
19148 <indexterm role="variable">
19149 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
19150 </indexterm>
19151 These variables are used in SMTP authenticators (see chapters
19152 <xref linkend="CHAPplaintext"/>&ndash;<xref linkend="CHAPtlsauth"/>). Elsewhere, they are empty.
19153 </para>
19154 </listitem></varlistentry>
19155 <varlistentry>
19156 <term><varname>$authenticated_id</varname></term>
19157 <listitem>
19158 <para>
19159 <indexterm role="concept">
19160 <primary>authentication</primary>
19161 <secondary>id</secondary>
19162 </indexterm>
19163 <indexterm role="variable">
19164 <primary><varname>$authenticated_id</varname></primary>
19165 </indexterm>
19166 When a server successfully authenticates a client it may be configured to
19167 preserve some of the authentication information in the variable
19168 <varname>$authenticated_id</varname> (see chapter <xref linkend="CHAPSMTPAUTH"/>). For example, a
19169 user/password authenticator configuration might preserve the user name for use
19170 in the routers. Note that this is not the same information that is saved in
19171 <varname>$sender_host_authenticated</varname>.
19172 </para>
19173 <para>
19174 When a message is submitted locally (that is, not over a TCP connection)
19175 the value of <varname>$authenticated_id</varname> is normally the login name of the calling
19176 process. However, a trusted user can override this by means of the <option>-oMai</option>
19177 command line option.
19178 This second case also sets up information used by the
19179 <varname>$authresults</varname> expansion item.
19180 </para>
19181 </listitem></varlistentry>
19182 <varlistentry>
19183 <term><varname>$authenticated_fail_id</varname></term>
19184 <listitem>
19185 <para>
19186 <indexterm role="concept">
19187 <primary>authentication</primary>
19188 <secondary>fail</secondary>
19189 </indexterm>
19190 <indexterm role="variable">
19191 <primary><varname>$authenticated_fail_id</varname></primary>
19192 </indexterm>
19193 When an authentication attempt fails, the variable <varname>$authenticated_fail_id</varname>
19194 will contain the failed authentication id. If more than one authentication
19195 id is attempted, it will contain only the last one. The variable is
19196 available for processing in the ACL&#x2019;s, generally the quit or notquit ACL.
19197 A message to a local recipient could still be accepted without requiring
19198 authentication, which means this variable could also be visible in all of
19199 the ACL&#x2019;s as well.
19200 </para>
19201 </listitem></varlistentry>
19202 <varlistentry>
19203 <term><varname>$authenticated_sender</varname></term>
19204 <listitem>
19205 <para>
19206 <indexterm role="variable">
19207 <primary><varname>$authenticated_sender</varname></primary>
19208 </indexterm>
19209 </para>
19210 <informaltable frame="none">
19211 <tgroup cols="1" colsep="0" rowsep="0">
19212 <colspec colwidth="10pt" align="left"/>
19213 <tbody>
19214 <row>
19215 <entry><emphasis>Tainted</emphasis></entry>
19216 </row>
19217 </tbody>
19218 </tgroup>
19219 </informaltable>
19220 <para>
19221 <indexterm role="concept">
19222 <primary>sender</primary>
19223 <secondary>authenticated</secondary>
19224 </indexterm>
19225 <indexterm role="concept">
19226 <primary>authentication</primary>
19227 <secondary>sender</secondary>
19228 </indexterm>
19229 <indexterm role="concept">
19230 <primary>AUTH</primary>
19231 <secondary>on MAIL command</secondary>
19232 </indexterm>
19233 When acting as a server, Exim takes note of the AUTH= parameter on an incoming
19234 SMTP MAIL command if it believes the sender is sufficiently trusted, as
19235 described in section <xref linkend="SECTauthparamail"/>. Unless the data is the string
19236 <quote>&lt;&gt;</quote>, it is set as the authenticated sender of the message, and the value is
19237 available during delivery in the <varname>$authenticated_sender</varname> variable. If the
19238 sender is not trusted, Exim accepts the syntax of AUTH=, but ignores the data.
19239 </para>
19240 <para>
19241 <indexterm role="variable">
19242 <primary><varname>$qualify_domain</varname></primary>
19243 </indexterm>
19244 When a message is submitted locally (that is, not over a TCP connection), the
19245 value of <varname>$authenticated_sender</varname> is an address constructed from the login
19246 name of the calling process and <varname>$qualify_domain</varname>, except that a trusted user
19247 can override this by means of the <option>-oMas</option> command line option.
19248 </para>
19249 </listitem></varlistentry>
19250 <varlistentry>
19251 <term><varname>$authentication_failed</varname></term>
19252 <listitem>
19253 <para>
19254 <indexterm role="concept">
19255 <primary>authentication</primary>
19256 <secondary>failure</secondary>
19257 </indexterm>
19258 <indexterm role="variable">
19259 <primary><varname>$authentication_failed</varname></primary>
19260 </indexterm>
19261 This variable is set to <quote>1</quote> in an Exim server if a client issues an AUTH
19262 command that does not succeed. Otherwise it is set to <quote>0</quote>. This makes it
19263 possible to distinguish between <quote>did not try to authenticate</quote>
19264 (<varname>$sender_host_authenticated</varname> is empty and <varname>$authentication_failed</varname> is set to
19265 <quote>0</quote>) and <quote>tried to authenticate but failed</quote> (<varname>$sender_host_authenticated</varname>
19266 is empty and <varname>$authentication_failed</varname> is set to <quote>1</quote>).
19267 Failure includes cancellation of a authentication attempt,
19268 and any negative response to an AUTH command,
19269 (including, for example, an attempt to use an undefined mechanism).
19270 </para>
19271 </listitem></varlistentry>
19272 <varlistentry>
19273 <term><varname>$av_failed</varname></term>
19274 <listitem>
19275 <para>
19276 <indexterm role="concept">
19277 <primary>content scanning</primary>
19278 <secondary>AV scanner failure</secondary>
19279 </indexterm>
19280 This variable is available when Exim is compiled with the content-scanning
19281 extension. It is set to <quote>0</quote> by default, but will be set to <quote>1</quote> if any
19282 problem occurs with the virus scanner (specified by <option>av_scanner</option>) during
19283 the ACL malware condition.
19284 </para>
19285 </listitem></varlistentry>
19286 <varlistentry>
19287 <term><varname>$body_linecount</varname></term>
19288 <listitem>
19289 <para>
19290 <indexterm role="concept">
19291 <primary>message body</primary>
19292 <secondary>line count</secondary>
19293 </indexterm>
19294 <indexterm role="concept">
19295 <primary>body of message</primary>
19296 <secondary>line count</secondary>
19297 </indexterm>
19298 <indexterm role="variable">
19299 <primary><varname>$body_linecount</varname></primary>
19300 </indexterm>
19301 When a message is being received or delivered, this variable contains the
19302 number of lines in the message&#x2019;s body. See also <varname>$message_linecount</varname>.
19303 </para>
19304 </listitem></varlistentry>
19305 <varlistentry>
19306 <term><varname>$body_zerocount</varname></term>
19307 <listitem>
19308 <para>
19309 <indexterm role="concept">
19310 <primary>message body</primary>
19311 <secondary>binary zero count</secondary>
19312 </indexterm>
19313 <indexterm role="concept">
19314 <primary>body of message</primary>
19315 <secondary>binary zero count</secondary>
19316 </indexterm>
19317 <indexterm role="concept">
19318 <primary>binary zero</primary>
19319 <secondary>in message body</secondary>
19320 </indexterm>
19321 <indexterm role="variable">
19322 <primary><varname>$body_zerocount</varname></primary>
19323 </indexterm>
19324 When a message is being received or delivered, this variable contains the
19325 number of binary zero bytes (ASCII NULs) in the message&#x2019;s body.
19326 </para>
19327 </listitem></varlistentry>
19328 <varlistentry>
19329 <term><varname>$bounce_recipient</varname></term>
19330 <listitem>
19331 <para>
19332 <indexterm role="variable">
19333 <primary><varname>$bounce_recipient</varname></primary>
19334 </indexterm>
19335 This is set to the recipient address of a bounce message while Exim is creating
19336 it. It is useful if a customized bounce message text file is in use (see
19337 chapter <xref linkend="CHAPemsgcust"/>).
19338 </para>
19339 </listitem></varlistentry>
19340 <varlistentry>
19341 <term><varname>$bounce_return_size_limit</varname></term>
19342 <listitem>
19343 <para>
19344 <indexterm role="variable">
19345 <primary><varname>$bounce_return_size_limit</varname></primary>
19346 </indexterm>
19347 This contains the value set in the <option>bounce_return_size_limit</option> option, rounded
19348 up to a multiple of 1000. It is useful when a customized error message text
19349 file is in use (see chapter <xref linkend="CHAPemsgcust"/>).
19350 </para>
19351 </listitem></varlistentry>
19352 <varlistentry>
19353 <term><varname>$caller_gid</varname></term>
19354 <listitem>
19355 <para>
19356 <indexterm role="concept">
19357 <primary>gid (group id)</primary>
19358 <secondary>caller</secondary>
19359 </indexterm>
19360 <indexterm role="variable">
19361 <primary><varname>$caller_gid</varname></primary>
19362 </indexterm>
19363 The real group id under which the process that called Exim was running. This is
19364 not the same as the group id of the originator of a message (see
19365 <varname>$originator_gid</varname>). If Exim re-execs itself, this variable in the new
19366 incarnation normally contains the Exim gid.
19367 </para>
19368 </listitem></varlistentry>
19369 <varlistentry>
19370 <term><varname>$caller_uid</varname></term>
19371 <listitem>
19372 <para>
19373 <indexterm role="concept">
19374 <primary>uid (user id)</primary>
19375 <secondary>caller</secondary>
19376 </indexterm>
19377 <indexterm role="variable">
19378 <primary><varname>$caller_uid</varname></primary>
19379 </indexterm>
19380 The real user id under which the process that called Exim was running. This is
19381 not the same as the user id of the originator of a message (see
19382 <varname>$originator_uid</varname>). If Exim re-execs itself, this variable in the new
19383 incarnation normally contains the Exim uid.
19384 </para>
19385 </listitem></varlistentry>
19386 <varlistentry>
19387 <term><varname>$callout_address</varname></term>
19388 <listitem>
19389 <para>
19390 <indexterm role="variable">
19391 <primary><varname>$callout_address</varname></primary>
19392 </indexterm>
19393 After a callout for verification, spamd or malware daemon service, the
19394 address that was connected to.
19395 </para>
19396 </listitem></varlistentry>
19397 <varlistentry>
19398 <term><varname>$compile_number</varname></term>
19399 <listitem>
19400 <para>
19401 <indexterm role="variable">
19402 <primary><varname>$compile_number</varname></primary>
19403 </indexterm>
19404 The building process for Exim keeps a count of the number
19405 of times it has been compiled. This serves to distinguish different
19406 compilations of the same version of Exim.
19407 </para>
19408 </listitem></varlistentry>
19409 <varlistentry>
19410 <term><varname>$config_dir</varname></term>
19411 <listitem>
19412 <para>
19413 <indexterm role="variable">
19414 <primary><varname>$config_dir</varname></primary>
19415 </indexterm>
19416 The directory name of the main configuration file. That is, the content of
19417 <varname>$config_file</varname> with the last component stripped. The value does not
19418 contain the trailing slash. If <varname>$config_file</varname> does not contain a slash,
19419 <varname>$config_dir</varname> is ".".
19420 </para>
19421 </listitem></varlistentry>
19422 <varlistentry>
19423 <term><varname>$config_file</varname></term>
19424 <listitem>
19425 <para>
19426 <indexterm role="variable">
19427 <primary><varname>$config_file</varname></primary>
19428 </indexterm>
19429 The name of the main configuration file Exim is using.
19430 </para>
19431 </listitem></varlistentry>
19432 <varlistentry>
19433 <term><varname>$dkim_verify_status</varname></term>
19434 <listitem>
19435 <para>
19436 Results of DKIM verification.
19437 For details see section <xref linkend="SECDKIMVFY"/>.
19438 </para>
19439 </listitem></varlistentry>
19440 <varlistentry>
19441 <term><varname>$dkim_cur_signer</varname></term>
19442 <term><varname>$dkim_verify_reason</varname></term>
19443 <term><varname>$dkim_domain</varname></term>
19444 <term><varname>$dkim_identity</varname></term>
19445 <term><varname>$dkim_selector</varname></term>
19446 <term><varname>$dkim_algo</varname></term>
19447 <term><varname>$dkim_canon_body</varname></term>
19448 <term><varname>$dkim_canon_headers</varname></term>
19449 <term><varname>$dkim_copiedheaders</varname></term>
19450 <term><varname>$dkim_bodylength</varname></term>
19451 <term><varname>$dkim_created</varname></term>
19452 <term><varname>$dkim_expires</varname></term>
19453 <term><varname>$dkim_headernames</varname></term>
19454 <term><varname>$dkim_key_testing</varname></term>
19455 <term><varname>$dkim_key_nosubdomains</varname></term>
19456 <term><varname>$dkim_key_srvtype</varname></term>
19457 <term><varname>$dkim_key_granularity</varname></term>
19458 <term><varname>$dkim_key_notes</varname></term>
19459 <term><varname>$dkim_key_length</varname></term>
19460 <listitem>
19461 <para>
19462 These variables are only available within the DKIM ACL.
19463 For details see section <xref linkend="SECDKIMVFY"/>.
19464 </para>
19465 </listitem></varlistentry>
19466 <varlistentry>
19467 <term><varname>$dkim_signers</varname></term>
19468 <listitem>
19469 <para>
19470 <indexterm role="variable">
19471 <primary><varname>$dkim_signers</varname></primary>
19472 </indexterm>
19473 When a message has been received this variable contains
19474 a colon-separated list of signer domains and identities for the message.
19475 For details see section <xref linkend="SECDKIMVFY"/>.
19476 </para>
19477 </listitem></varlistentry>
19478 <varlistentry>
19479 <term><varname>$dmarc_domain_policy</varname></term>
19480 <term><varname>$dmarc_status</varname></term>
19481 <term><varname>$dmarc_status_text</varname></term>
19482 <term><varname>$dmarc_used_domains</varname></term>
19483 <listitem>
19484 <para>
19485 Results of DMARC verification.
19486 For details see section <xref linkend="SECDMARC"/>.
19487 </para>
19488 </listitem></varlistentry>
19489 <varlistentry>
19490 <term><varname>$dnslist_domain</varname></term>
19491 <term><varname>$dnslist_matched</varname></term>
19492 <term><varname>$dnslist_text</varname></term>
19493 <term><varname>$dnslist_value</varname></term>
19494 <listitem>
19495 <para>
19496 <indexterm role="variable">
19497 <primary><varname>$dnslist_domain</varname></primary>
19498 </indexterm>
19499 <indexterm role="variable">
19500 <primary><varname>$dnslist_matched</varname></primary>
19501 </indexterm>
19502 <indexterm role="variable">
19503 <primary><varname>$dnslist_text</varname></primary>
19504 </indexterm>
19505 <indexterm role="variable">
19506 <primary><varname>$dnslist_value</varname></primary>
19507 </indexterm>
19508 <indexterm role="concept">
19509 <primary>black list (DNS)</primary>
19510 </indexterm>
19511 When a DNS (black) list lookup succeeds, these variables are set to contain
19512 the following data from the lookup: the list&#x2019;s domain name, the key that was
19513 looked up, the contents of any associated TXT record, and the value from the
19514 main A record. See section <xref linkend="SECID204"/> for more details.
19515 </para>
19516 </listitem></varlistentry>
19517 <varlistentry>
19518 <term><varname>$domain</varname></term>
19519 <listitem>
19520 <para>
19521 <indexterm role="variable">
19522 <primary><varname>$domain</varname></primary>
19523 </indexterm>
19524 </para>
19525 <informaltable frame="none">
19526 <tgroup cols="1" colsep="0" rowsep="0">
19527 <colspec colwidth="10pt" align="left"/>
19528 <tbody>
19529 <row>
19530 <entry><emphasis>Tainted</emphasis></entry>
19531 </row>
19532 </tbody>
19533 </tgroup>
19534 </informaltable>
19535 <para>
19536 When an address is being routed, or delivered on its own, this variable
19537 contains the domain. Uppercase letters in the domain are converted into lower
19538 case for <varname>$domain</varname>.
19539 </para>
19540 <para>
19541 Global address rewriting happens when a message is received, so the value of
19542 <varname>$domain</varname> during routing and delivery is the value after rewriting. <varname>$domain</varname>
19543 is set during user filtering, but not during system filtering, because a
19544 message may have many recipients and the system filter is called just once.
19545 </para>
19546 <para>
19547 When more than one address is being delivered at once (for example, several
19548 RCPT commands in one SMTP delivery), <varname>$domain</varname> is set only if they all
19549 have the same domain. Transports can be restricted to handling only one domain
19550 at a time if the value of <varname>$domain</varname> is required at transport time &ndash; this is
19551 the default for local transports. For further details of the environment in
19552 which local transports are run, see chapter <xref linkend="CHAPenvironment"/>.
19553 </para>
19554 <para>
19555 <indexterm role="option">
19556 <primary><option>delay_warning_condition</option></primary>
19557 </indexterm>
19558 At the end of a delivery, if all deferred addresses have the same domain, it is
19559 set in <varname>$domain</varname> during the expansion of <option>delay_warning_condition</option>.
19560 </para>
19561 <para>
19562 The <varname>$domain</varname> variable is also used in some other circumstances:
19563 </para>
19564 <itemizedlist>
19565 <listitem>
19566 <para>
19567 When an ACL is running for a RCPT command, <varname>$domain</varname> contains the domain of
19568 the recipient address. The domain of the <emphasis>sender</emphasis> address is in
19569 <varname>$sender_address_domain</varname> at both MAIL time and at RCPT time. <varname>$domain</varname> is not
19570 normally set during the running of the MAIL ACL. However, if the sender address
19571 is verified with a callout during the MAIL ACL, the sender domain is placed in
19572 <varname>$domain</varname> during the expansions of <option>hosts</option>, <option>interface</option>, and <option>port</option> in
19573 the <command>smtp</command> transport.
19574 </para>
19575 </listitem>
19576 <listitem>
19577 <para>
19578 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
19579 <varname>$domain</varname> contains the domain portion of the address that is being rewritten;
19580 it can be used in the expansion of the replacement address, for example, to
19581 rewrite domains by file lookup.
19582 </para>
19583 </listitem>
19584 <listitem>
19585 <para>
19586 With one important exception, whenever a domain list is being scanned,
19587 <varname>$domain</varname> contains the subject domain. <emphasis role="bold">Exception</emphasis>: When a domain list in
19588 a <option>sender_domains</option> condition in an ACL is being processed, the subject domain
19589 is in <varname>$sender_address_domain</varname> and not in <varname>$domain</varname>. It works this way so
19590 that, in a RCPT ACL, the sender domain list can be dependent on the
19591 recipient domain (which is what is in <varname>$domain</varname> at this time).
19592 </para>
19593 </listitem>
19594 <listitem>
19595 <para>
19596 <indexterm role="concept">
19597 <primary>ETRN</primary>
19598 <secondary>value of <varname>$domain</varname></secondary>
19599 </indexterm>
19600 <indexterm role="option">
19601 <primary><option>smtp_etrn_command</option></primary>
19602 </indexterm>
19603 When the <option>smtp_etrn_command</option> option is being expanded, <varname>$domain</varname> contains
19604 the complete argument of the ETRN command (see section <xref linkend="SECTETRN"/>).
19605 </para>
19606 </listitem>
19607 </itemizedlist>
19608 <para>
19609 <indexterm role="concept">
19610 <primary>tainted data</primary>
19611 </indexterm>
19612 If the origin of the data is an incoming message,
19613 the result of expanding this variable is tainted and may not
19614 be further expanded or used as a filename.
19615 When an untainted version is needed, one should be obtained from
19616 looking up the value in a local (therefore trusted) database.
19617 Often <varname>$domain_data</varname> is usable in this role.
19618 </para>
19619 </listitem></varlistentry>
19620 <varlistentry>
19621 <term><varname>$domain_data</varname></term>
19622 <listitem>
19623 <para>
19624 <indexterm role="variable">
19625 <primary><varname>$domain_data</varname></primary>
19626 </indexterm>
19627 When the <option>domains</option> condition on a router
19628 or an ACL
19629 matches a domain
19630 against a list, the match value is copied to <varname>$domain_data</varname>.
19631 This is an enhancement over previous versions of Exim, when it only
19632 applied to the data read by a lookup.
19633 For details on match values see section <xref linkend="SECTlistresults"/> et. al.
19634 </para>
19635 <para>
19636 If the router routes the
19637 address to a transport, the value is available in that transport. If the
19638 transport is handling multiple addresses, the value from the first address is
19639 used.
19640 </para>
19641 <para>
19642 <varname>$domain_data</varname> set in an ACL is available during
19643 the rest of the ACL statement.
19644 </para>
19645 </listitem></varlistentry>
19646 <varlistentry>
19647 <term><varname>$exim_gid</varname></term>
19648 <listitem>
19649 <para>
19650 <indexterm role="variable">
19651 <primary><varname>$exim_gid</varname></primary>
19652 </indexterm>
19653 This variable contains the numerical value of the Exim group id.
19654 </para>
19655 </listitem></varlistentry>
19656 <varlistentry>
19657 <term><varname>$exim_path</varname></term>
19658 <listitem>
19659 <para>
19660 <indexterm role="variable">
19661 <primary><varname>$exim_path</varname></primary>
19662 </indexterm>
19663 This variable contains the path to the Exim binary.
19664 </para>
19665 </listitem></varlistentry>
19666 <varlistentry>
19667 <term><varname>$exim_uid</varname></term>
19668 <listitem>
19669 <para>
19670 <indexterm role="variable">
19671 <primary><varname>$exim_uid</varname></primary>
19672 </indexterm>
19673 This variable contains the numerical value of the Exim user id.
19674 </para>
19675 </listitem></varlistentry>
19676 <varlistentry>
19677 <term><varname>$exim_version</varname></term>
19678 <listitem>
19679 <para>
19680 <indexterm role="variable">
19681 <primary><varname>$exim_version</varname></primary>
19682 </indexterm>
19683 This variable contains the version string of the Exim build.
19684 The first character is a major version number, currently 4.
19685 Then after a dot, the next group of digits is a minor version number.
19686 There may be other characters following the minor version.
19687 This value may be overridden by the <option>exim_version</option> main config option.
19688 </para>
19689 </listitem></varlistentry>
19690 <varlistentry>
19691 <term><varname>$header_</varname>&lt;<emphasis>name</emphasis>&gt;</term>
19692 <listitem>
19693 <informaltable frame="none">
19694 <tgroup cols="1" colsep="0" rowsep="0">
19695 <colspec colwidth="10pt" align="left"/>
19696 <tbody>
19697 <row>
19698 <entry><emphasis>Tainted</emphasis></entry>
19699 </row>
19700 </tbody>
19701 </tgroup>
19702 </informaltable>
19703 <para>
19704 This is not strictly an expansion variable. It is expansion syntax for
19705 inserting the message header line with the given name. Note that the name must
19706 be terminated by colon or white space, because it may contain a wide variety of
19707 characters. Note also that braces must <emphasis>not</emphasis> be used.
19708 See the full description in section <xref linkend="SECTexpansionitems"/> above.
19709 </para>
19710 </listitem></varlistentry>
19711 <varlistentry>
19712 <term><varname>$headers_added</varname></term>
19713 <listitem>
19714 <para>
19715 <indexterm role="variable">
19716 <primary><varname>$headers_added</varname></primary>
19717 </indexterm>
19718 Within an ACL this variable contains the headers added so far by
19719 the ACL modifier add_header (section <xref linkend="SECTaddheadacl"/>).
19720 The headers are a newline-separated list.
19721 </para>
19722 </listitem></varlistentry>
19723 <varlistentry>
19724 <term><varname>$home</varname></term>
19725 <listitem>
19726 <para>
19727 <indexterm role="variable">
19728 <primary><varname>$home</varname></primary>
19729 </indexterm>
19730 When the <option>check_local_user</option> option is set for a router, the user&#x2019;s home
19731 directory is placed in <varname>$home</varname> when the check succeeds. In particular, this
19732 means it is set during the running of users&#x2019; filter files. A router may also
19733 explicitly set a home directory for use by a transport; this can be overridden
19734 by a setting on the transport itself.
19735 </para>
19736 <para>
19737 When running a filter test via the <option>-bf</option> option, <varname>$home</varname> is set to the value
19738 of the environment variable HOME, which is subject to the
19739 <option>keep_environment</option> and <option>add_environment</option> main config options.
19740 </para>
19741 </listitem></varlistentry>
19742 <varlistentry>
19743 <term><varname>$host</varname></term>
19744 <listitem>
19745 <para>
19746 <indexterm role="variable">
19747 <primary><varname>$host</varname></primary>
19748 </indexterm>
19749 If a router assigns an address to a transport (any transport), and passes a
19750 list of hosts with the address, the value of <varname>$host</varname> when the transport starts
19751 to run is the name of the first host on the list. Note that this applies both
19752 to local and remote transports.
19753 </para>
19754 <para>
19755 <indexterm role="concept">
19756 <primary>transport</primary>
19757 <secondary>filter</secondary>
19758 </indexterm>
19759 <indexterm role="concept">
19760 <primary>filter</primary>
19761 <secondary>transport filter</secondary>
19762 </indexterm>
19763 For the <command>smtp</command> transport, if there is more than one host, the value of
19764 <varname>$host</varname> changes as the transport works its way through the list. In
19765 particular, when the <command>smtp</command> transport is expanding its options for encryption
19766 using TLS, or for specifying a transport filter (see chapter
19767 <xref linkend="CHAPtransportgeneric"/>), <varname>$host</varname> contains the name of the host to which it
19768 is connected.
19769 </para>
19770 <para>
19771 When used in the client part of an authenticator configuration (see chapter
19772 <xref linkend="CHAPSMTPAUTH"/>), <varname>$host</varname> contains the name of the server to which the
19773 client is connected.
19774 </para>
19775 </listitem></varlistentry>
19776 <varlistentry>
19777 <term><varname>$host_address</varname></term>
19778 <listitem>
19779 <para>
19780 <indexterm role="variable">
19781 <primary><varname>$host_address</varname></primary>
19782 </indexterm>
19783 This variable is set to the remote host&#x2019;s IP address whenever <varname>$host</varname> is set
19784 for a remote connection. It is also set to the IP address that is being checked
19785 when the <option>ignore_target_hosts</option> option is being processed.
19786 </para>
19787 </listitem></varlistentry>
19788 <varlistentry>
19789 <term><varname>$host_data</varname></term>
19790 <listitem>
19791 <para>
19792 <indexterm role="variable">
19793 <primary><varname>$host_data</varname></primary>
19794 </indexterm>
19795 If a <option>hosts</option> condition in an ACL is satisfied by means of a lookup, the
19796 result of the lookup is made available in the <varname>$host_data</varname> variable. This
19797 allows you, for example, to do things like this:
19798 </para>
19799 <literallayout class="monospaced">
19800 deny  hosts = net-lsearch;/some/file
19801       message = $host_data
19802 </literallayout>
19803 </listitem></varlistentry>
19804 <varlistentry>
19805 <term><varname>$host_lookup_deferred</varname></term>
19806 <listitem>
19807 <para>
19808 <indexterm role="concept">
19809 <primary>host name</primary>
19810 <secondary>lookup, failure of</secondary>
19811 </indexterm>
19812 <indexterm role="variable">
19813 <primary><varname>$host_lookup_deferred</varname></primary>
19814 </indexterm>
19815 This variable normally contains <quote>0</quote>, as does <varname>$host_lookup_failed</varname>. When a
19816 message comes from a remote host and there is an attempt to look up the host&#x2019;s
19817 name from its IP address, and the attempt is not successful, one of these
19818 variables is set to <quote>1</quote>.
19819 </para>
19820 <itemizedlist>
19821 <listitem>
19822 <para>
19823 If the lookup receives a definite negative response (for example, a DNS lookup
19824 succeeded, but no records were found), <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
19825 </para>
19826 </listitem>
19827 <listitem>
19828 <para>
19829 If there is any kind of problem during the lookup, such that Exim cannot
19830 tell whether or not the host name is defined (for example, a timeout for a DNS
19831 lookup), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>.
19832 </para>
19833 </listitem>
19834 </itemizedlist>
19835 <para>
19836 Looking up a host&#x2019;s name from its IP address consists of more than just a
19837 single reverse lookup. Exim checks that a forward lookup of at least one of the
19838 names it receives from a reverse lookup yields the original IP address. If this
19839 is not the case, Exim does not accept the looked up name(s), and
19840 <varname>$host_lookup_failed</varname> is set to <quote>1</quote>. Thus, being able to find a name from an
19841 IP address (for example, the existence of a PTR record in the DNS) is not
19842 sufficient on its own for the success of a host name lookup. If the reverse
19843 lookup succeeds, but there is a lookup problem such as a timeout when checking
19844 the result, the name is not accepted, and <varname>$host_lookup_deferred</varname> is set to
19845 <quote>1</quote>. See also <varname>$sender_host_name</varname>.
19846 </para>
19847 <para>
19848 <indexterm role="concept">
19849 <primary>authentication</primary>
19850 <secondary>expansion item</secondary>
19851 </indexterm>
19852 Performing these checks sets up information used by the
19853 <option>authresults</option> expansion item.
19854 </para>
19855 </listitem></varlistentry>
19856 <varlistentry>
19857 <term><varname>$host_lookup_failed</varname></term>
19858 <listitem>
19859 <para>
19860 <indexterm role="variable">
19861 <primary><varname>$host_lookup_failed</varname></primary>
19862 </indexterm>
19863 See <varname>$host_lookup_deferred</varname>.
19864 </para>
19865 </listitem></varlistentry>
19866 <varlistentry>
19867 <term><varname>$host_port</varname></term>
19868 <listitem>
19869 <para>
19870 <indexterm role="variable">
19871 <primary><varname>$host_port</varname></primary>
19872 </indexterm>
19873 This variable is set to the remote host&#x2019;s TCP port whenever <varname>$host</varname> is set
19874 for an outbound connection.
19875 </para>
19876 </listitem></varlistentry>
19877 <varlistentry>
19878 <term><varname>$initial_cwd</varname></term>
19879 <listitem>
19880 <para>
19881 <indexterm role="variable">
19882 <primary><varname>$initial_cwd</varname></primary>
19883 </indexterm>
19884 This variable contains the full path name of the initial working
19885 directory of the current Exim process. This may differ from the current
19886 working directory, as Exim changes this to "/" during early startup, and
19887 to <varname>$spool_directory</varname> later.
19888 </para>
19889 </listitem></varlistentry>
19890 <varlistentry>
19891 <term><varname>$inode</varname></term>
19892 <listitem>
19893 <para>
19894 <indexterm role="variable">
19895 <primary><varname>$inode</varname></primary>
19896 </indexterm>
19897 The only time this variable is set is while expanding the <option>directory_file</option>
19898 option in the <command>appendfile</command> transport. The variable contains the inode number
19899 of the temporary file which is about to be renamed. It can be used to construct
19900 a unique name for the file.
19901 </para>
19902 </listitem></varlistentry>
19903 <varlistentry>
19904 <term><varname>$interface_address</varname></term>
19905 <term><varname>$interface_port</varname></term>
19906 <listitem>
19907 <para>
19908 <indexterm role="variable">
19909 <primary><varname>$interface_address</varname></primary>
19910 </indexterm>
19911 <indexterm role="variable">
19912 <primary><varname>$interface_port</varname></primary>
19913 </indexterm>
19914 These are obsolete names for <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
19915 </para>
19916 </listitem></varlistentry>
19917 <varlistentry>
19918 <term><varname>$item</varname></term>
19919 <listitem>
19920 <para>
19921 <indexterm role="variable">
19922 <primary><varname>$item</varname></primary>
19923 </indexterm>
19924 This variable is used during the expansion of <emphasis role="bold">forall</emphasis> and <emphasis role="bold">forany</emphasis>
19925 conditions (see section <xref linkend="SECTexpcond"/>), and <emphasis role="bold">filter</emphasis>, <emphasis role="bold">map</emphasis>, and
19926 <emphasis role="bold">reduce</emphasis> items (see section <xref linkend="SECTexpcond"/>). In other circumstances, it is
19927 empty.
19928 </para>
19929 </listitem></varlistentry>
19930 <varlistentry>
19931 <term><varname>$ldap_dn</varname></term>
19932 <listitem>
19933 <para>
19934 <indexterm role="variable">
19935 <primary><varname>$ldap_dn</varname></primary>
19936 </indexterm>
19937 This variable, which is available only when Exim is compiled with LDAP support,
19938 contains the DN from the last entry in the most recently successful LDAP
19939 lookup.
19940 </para>
19941 </listitem></varlistentry>
19942 <varlistentry>
19943 <term><varname>$load_average</varname></term>
19944 <listitem>
19945 <para>
19946 <indexterm role="variable">
19947 <primary><varname>$load_average</varname></primary>
19948 </indexterm>
19949 This variable contains the system load average, multiplied by 1000 so that it
19950 is an integer. For example, if the load average is 0.21, the value of the
19951 variable is 210. The value is recomputed every time the variable is referenced.
19952 </para>
19953 </listitem></varlistentry>
19954 <varlistentry>
19955 <term><varname>$local_part</varname></term>
19956 <listitem>
19957 <para>
19958 <indexterm role="variable">
19959 <primary><varname>$local_part</varname></primary>
19960 </indexterm>
19961 </para>
19962 <informaltable frame="none">
19963 <tgroup cols="1" colsep="0" rowsep="0">
19964 <colspec colwidth="10pt" align="left"/>
19965 <tbody>
19966 <row>
19967 <entry><emphasis>Tainted</emphasis></entry>
19968 </row>
19969 </tbody>
19970 </tgroup>
19971 </informaltable>
19972 <para>
19973 When an address is being routed, or delivered on its own, this
19974 variable contains the local part. When a number of addresses are being
19975 delivered together (for example, multiple RCPT commands in an SMTP
19976 session), <varname>$local_part</varname> is not set.
19977 </para>
19978 <para>
19979 Global address rewriting happens when a message is received, so the value of
19980 <varname>$local_part</varname> during routing and delivery is the value after rewriting.
19981 <varname>$local_part</varname> is set during user filtering, but not during system filtering,
19982 because a message may have many recipients and the system filter is called just
19983 once.
19984 </para>
19985 <para>
19986 <indexterm role="concept">
19987 <primary>tainted data</primary>
19988 </indexterm>
19989 If the origin of the data is an incoming message,
19990 the result of expanding this variable is tainted and
19991 may not be further expanded or used as a filename.
19992 </para>
19993 <para>
19994 <emphasis role="bold">Warning</emphasis>: the content of this variable is usually provided by a potential
19995 attacker.
19996 Consider carefully the implications of using it unvalidated as a name
19997 for file access.
19998 This presents issues for users&#x2019; <filename>.forward</filename> and filter files.
19999 For traditional full user accounts, use <option>check_local_users</option> and the
20000 <varname>$local_part_data</varname> variable rather than this one.
20001 For virtual users, store a suitable pathname component in the database
20002 which is used for account name validation, and use that retrieved value
20003 rather than this variable.
20004 Often <varname>$local_part_data</varname> is usable in this role.
20005 If needed, use a router <option>address_data</option> or <option>set</option> option for
20006 the retrieved data.
20007 </para>
20008 <para>
20009 When a message is being delivered to a file, pipe, or autoreply transport as a
20010 result of aliasing or forwarding, <varname>$local_part</varname> is set to the local part of
20011 the parent address, not to the filename or command (see <varname>$address_file</varname> and
20012 <varname>$address_pipe</varname>).
20013 </para>
20014 <para>
20015 When an ACL is running for a RCPT command, <varname>$local_part</varname> contains the
20016 local part of the recipient address.
20017 </para>
20018 <para>
20019 When a rewrite item is being processed (see chapter <xref linkend="CHAPrewrite"/>),
20020 <varname>$local_part</varname> contains the local part of the address that is being rewritten;
20021 it can be used in the expansion of the replacement address, for example.
20022 </para>
20023 <para>
20024 In all cases, all quoting is removed from the local part. For example, for both
20025 the addresses
20026 </para>
20027 <literallayout class="monospaced">
20028 "abc:xyz"@test.example
20029 abc\:xyz@test.example
20030 </literallayout>
20031 <para>
20032 the value of <varname>$local_part</varname> is
20033 </para>
20034 <literallayout class="monospaced">
20035 abc:xyz
20036 </literallayout>
20037 <para>
20038 If you use <varname>$local_part</varname> to create another address, you should always wrap it
20039 inside a quoting operator. For example, in a <command>redirect</command> router you could
20040 have:
20041 </para>
20042 <literallayout class="monospaced">
20043 data = ${quote_local_part:$local_part}@new.domain.example
20044 </literallayout>
20045 <para>
20046 <emphasis role="bold">Note</emphasis>: The value of <varname>$local_part</varname> is normally lower cased. If you want
20047 to process local parts in a case-dependent manner in a router, you can set the
20048 <option>caseful_local_part</option> option (see chapter <xref linkend="CHAProutergeneric"/>).
20049 </para>
20050 </listitem></varlistentry>
20051 <varlistentry>
20052 <term><varname>$local_part_data</varname></term>
20053 <listitem>
20054 <para>
20055 <indexterm role="variable">
20056 <primary><varname>$local_part_data</varname></primary>
20057 </indexterm>
20058 When the <option>local_parts</option> condition on a router or ACL
20059 matches a local part list
20060 the match value is copied to <varname>$local_part_data</varname>.
20061 This is an enhancement over previous versions of Exim, when it only
20062 applied to the data read by a lookup.
20063 For details on match values see section <xref linkend="SECTlistresults"/> et. al.
20064 </para>
20065 <para>
20066 The <option>check_local_user</option> router option also sets this variable.
20067 </para>
20068 <para>
20069 <indexterm role="variable">
20070 <primary><varname>$local_part_prefix</varname></primary>
20071 <secondary><varname>$local_part_prefix_v</varname></secondary>
20072 </indexterm>
20073 <indexterm role="concept">
20074 <primary>affix</primary>
20075 <secondary>variables</secondary>
20076 </indexterm>
20077 If a local part prefix or suffix has been recognized, it is not included in the
20078 value of <varname>$local_part</varname> during routing and subsequent delivery. The values of
20079 any prefix or suffix are in <varname>$local_part_prefix</varname> and
20080 <varname>$local_part_suffix</varname>, respectively.
20081 <indexterm role="concept">
20082 <primary>tainted data</primary>
20083 </indexterm>
20084 If the specification did not include a wildcard then
20085 the affix variable value is not tainted.
20086 </para>
20087 <para>
20088 If the affix specification included a wildcard then the portion of
20089 the affix matched by the wildcard is in
20090 <varname>$local_part_prefix_v</varname> or <varname>$local_part_suffix_v</varname> as appropriate,
20091 and both the whole and varying values are tainted.
20092 </para>
20093 </listitem></varlistentry>
20094 <varlistentry>
20095 <term><varname>$local_scan_data</varname></term>
20096 <listitem>
20097 <para>
20098 <indexterm role="variable">
20099 <primary><varname>$local_scan_data</varname></primary>
20100 </indexterm>
20101 This variable contains the text returned by the <function>local_scan()</function> function when
20102 a message is received. See chapter <xref linkend="CHAPlocalscan"/> for more details.
20103 </para>
20104 </listitem></varlistentry>
20105 <varlistentry>
20106 <term><varname>$local_user_gid</varname></term>
20107 <listitem>
20108 <para>
20109 <indexterm role="variable">
20110 <primary><varname>$local_user_gid</varname></primary>
20111 </indexterm>
20112 See <varname>$local_user_uid</varname>.
20113 </para>
20114 </listitem></varlistentry>
20115 <varlistentry>
20116 <term><varname>$local_user_uid</varname></term>
20117 <listitem>
20118 <para>
20119 <indexterm role="variable">
20120 <primary><varname>$local_user_uid</varname></primary>
20121 </indexterm>
20122 This variable and <varname>$local_user_gid</varname> are set to the uid and gid after the
20123 <option>check_local_user</option> router precondition succeeds. This means that their values
20124 are available for the remaining preconditions (<option>senders</option>, <option>require_files</option>,
20125 and <option>condition</option>), for the <option>address_data</option> expansion, and for any
20126 router-specific expansions. At all other times, the values in these variables
20127 are <literal>(uid_t)(-1)</literal> and <literal>(gid_t)(-1)</literal>, respectively.
20128 </para>
20129 </listitem></varlistentry>
20130 <varlistentry>
20131 <term><varname>$localhost_number</varname></term>
20132 <listitem>
20133 <para>
20134 <indexterm role="variable">
20135 <primary><varname>$localhost_number</varname></primary>
20136 </indexterm>
20137 This contains the expanded value of the
20138 <option>localhost_number</option> option. The expansion happens after the main options have
20139 been read.
20140 </para>
20141 </listitem></varlistentry>
20142 <varlistentry>
20143 <term><varname>$log_inodes</varname></term>
20144 <listitem>
20145 <para>
20146 <indexterm role="variable">
20147 <primary><varname>$log_inodes</varname></primary>
20148 </indexterm>
20149 The number of free inodes in the disk partition where Exim&#x2019;s
20150 log files are being written. The value is recalculated whenever the variable is
20151 referenced. If the relevant file system does not have the concept of inodes,
20152 the value of is -1. See also the <option>check_log_inodes</option> option.
20153 </para>
20154 </listitem></varlistentry>
20155 <varlistentry>
20156 <term><varname>$log_space</varname></term>
20157 <listitem>
20158 <para>
20159 <indexterm role="variable">
20160 <primary><varname>$log_space</varname></primary>
20161 </indexterm>
20162 The amount of free space (as a number of kilobytes) in the disk
20163 partition where Exim&#x2019;s log files are being written. The value is recalculated
20164 whenever the variable is referenced. If the operating system does not have the
20165 ability to find the amount of free space (only true for experimental systems),
20166 the space value is -1. See also the <option>check_log_space</option> option.
20167 </para>
20168 </listitem></varlistentry>
20169 <varlistentry>
20170 <term><varname>$lookup_dnssec_authenticated</varname></term>
20171 <listitem>
20172 <para>
20173 <indexterm role="variable">
20174 <primary><varname>$lookup_dnssec_authenticated</varname></primary>
20175 </indexterm>
20176 This variable is set after a DNS lookup done by
20177 a dnsdb lookup expansion, dnslookup router or smtp transport.
20178 <indexterm role="concept">
20179 <primary>DNS</primary>
20180 <secondary>DNSSEC</secondary>
20181 </indexterm>
20182 It will be empty if <command>DNSSEC</command> was not requested,
20183 <quote>no</quote> if the result was not labelled as authenticated data
20184 and <quote>yes</quote> if it was.
20185 Results that are labelled as authoritative answer that match
20186 the <option>dns_trust_aa</option> configuration variable count also
20187 as authenticated data.
20188 </para>
20189 </listitem></varlistentry>
20190 <varlistentry>
20191 <term><varname>$mailstore_basename</varname></term>
20192 <listitem>
20193 <para>
20194 <indexterm role="variable">
20195 <primary><varname>$mailstore_basename</varname></primary>
20196 </indexterm>
20197 This variable is set only when doing deliveries in <quote>mailstore</quote> format in the
20198 <command>appendfile</command> transport. During the expansion of the <option>mailstore_prefix</option>,
20199 <option>mailstore_suffix</option>, <option>message_prefix</option>, and <option>message_suffix</option> options, it
20200 contains the basename of the files that are being written, that is, the name
20201 without the <quote>.tmp</quote>, <quote>.env</quote>, or <quote>.msg</quote> suffix. At all other times, this
20202 variable is empty.
20203 </para>
20204 </listitem></varlistentry>
20205 <varlistentry>
20206 <term><varname>$malware_name</varname></term>
20207 <listitem>
20208 <para>
20209 <indexterm role="variable">
20210 <primary><varname>$malware_name</varname></primary>
20211 </indexterm>
20212 This variable is available when Exim is compiled with the
20213 content-scanning extension. It is set to the name of the virus that was found
20214 when the ACL <option>malware</option> condition is true (see section <xref linkend="SECTscanvirus"/>).
20215 </para>
20216 </listitem></varlistentry>
20217 <varlistentry>
20218 <term><varname>$max_received_linelength</varname></term>
20219 <listitem>
20220 <para>
20221 <indexterm role="variable">
20222 <primary><varname>$max_received_linelength</varname></primary>
20223 </indexterm>
20224 <indexterm role="concept">
20225 <primary>maximum</primary>
20226 <secondary>line length</secondary>
20227 </indexterm>
20228 <indexterm role="concept">
20229 <primary>line length</primary>
20230 <secondary>maximum</secondary>
20231 </indexterm>
20232 This variable contains the number of bytes in the longest line that was
20233 received as part of the message, not counting the line termination
20234 character(s).
20235 It is not valid if the <option>spool_wireformat</option> option is used.
20236 </para>
20237 </listitem></varlistentry>
20238 <varlistentry>
20239 <term><varname>$message_age</varname></term>
20240 <listitem>
20241 <para>
20242 <indexterm role="concept">
20243 <primary>message</primary>
20244 <secondary>age of</secondary>
20245 </indexterm>
20246 <indexterm role="variable">
20247 <primary><varname>$message_age</varname></primary>
20248 </indexterm>
20249 This variable is set at the start of a delivery attempt to contain the number
20250 of seconds since the message was received. It does not change during a single
20251 delivery attempt.
20252 </para>
20253 </listitem></varlistentry>
20254 <varlistentry>
20255 <term><varname>$message_body</varname></term>
20256 <listitem>
20257 <para>
20258 <indexterm role="variable">
20259 <primary><varname>$message_body</varname></primary>
20260 </indexterm>
20261 </para>
20262 <informaltable frame="none">
20263 <tgroup cols="1" colsep="0" rowsep="0">
20264 <colspec colwidth="10pt" align="left"/>
20265 <tbody>
20266 <row>
20267 <entry><emphasis>Tainted</emphasis></entry>
20268 </row>
20269 </tbody>
20270 </tgroup>
20271 </informaltable>
20272 <para>
20273 <indexterm role="concept">
20274 <primary>body of message</primary>
20275 <secondary>expansion variable</secondary>
20276 </indexterm>
20277 <indexterm role="concept">
20278 <primary>message body</primary>
20279 <secondary>in expansion</secondary>
20280 </indexterm>
20281 <indexterm role="concept">
20282 <primary>binary zero</primary>
20283 <secondary>in message body</secondary>
20284 </indexterm>
20285 <indexterm role="option">
20286 <primary><option>message_body_visible</option></primary>
20287 </indexterm>
20288 This variable contains the initial portion of a message&#x2019;s body while it is
20289 being delivered, and is intended mainly for use in filter files. The maximum
20290 number of characters of the body that are put into the variable is set by the
20291 <option>message_body_visible</option> configuration option; the default is 500.
20292 </para>
20293 <para>
20294 <indexterm role="option">
20295 <primary><option>message_body_newlines</option></primary>
20296 </indexterm>
20297 By default, newlines are converted into spaces in <varname>$message_body</varname>, to make it
20298 easier to search for phrases that might be split over a line break. However,
20299 this can be disabled by setting <option>message_body_newlines</option> to be true. Binary
20300 zeros are always converted into spaces.
20301 </para>
20302 </listitem></varlistentry>
20303 <varlistentry>
20304 <term><varname>$message_body_end</varname></term>
20305 <listitem>
20306 <para>
20307 <indexterm role="variable">
20308 <primary><varname>$message_body_end</varname></primary>
20309 </indexterm>
20310 </para>
20311 <informaltable frame="none">
20312 <tgroup cols="1" colsep="0" rowsep="0">
20313 <colspec colwidth="10pt" align="left"/>
20314 <tbody>
20315 <row>
20316 <entry><emphasis>Tainted</emphasis></entry>
20317 </row>
20318 </tbody>
20319 </tgroup>
20320 </informaltable>
20321 <para>
20322 <indexterm role="concept">
20323 <primary>body of message</primary>
20324 <secondary>expansion variable</secondary>
20325 </indexterm>
20326 <indexterm role="concept">
20327 <primary>message body</primary>
20328 <secondary>in expansion</secondary>
20329 </indexterm>
20330 This variable contains the final portion of a message&#x2019;s
20331 body while it is being delivered. The format and maximum size are as for
20332 <varname>$message_body</varname>.
20333 </para>
20334 </listitem></varlistentry>
20335 <varlistentry>
20336 <term><varname>$message_body_size</varname></term>
20337 <listitem>
20338 <para>
20339 <indexterm role="concept">
20340 <primary>body of message</primary>
20341 <secondary>size</secondary>
20342 </indexterm>
20343 <indexterm role="concept">
20344 <primary>message body</primary>
20345 <secondary>size</secondary>
20346 </indexterm>
20347 <indexterm role="variable">
20348 <primary><varname>$message_body_size</varname></primary>
20349 </indexterm>
20350 When a message is being delivered, this variable contains the size of the body
20351 in bytes. The count starts from the character after the blank line that
20352 separates the body from the header. Newlines are included in the count. See
20353 also <varname>$message_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
20354 </para>
20355 <para>
20356 If the spool file is wireformat
20357 (see the <option>spool_wireformat</option> main option)
20358 the CRLF line-terminators are included in the count.
20359 </para>
20360 </listitem></varlistentry>
20361 <varlistentry>
20362 <term><varname>$message_exim_id</varname></term>
20363 <listitem>
20364 <para>
20365 <indexterm role="variable">
20366 <primary><varname>$message_exim_id</varname></primary>
20367 </indexterm>
20368 When a message is being received or delivered, this variable contains the
20369 unique message id that is generated and used by Exim to identify the message.
20370 An id is not created for a message until after its header has been successfully
20371 received. <emphasis role="bold">Note</emphasis>: This is <emphasis>not</emphasis> the contents of the <emphasis>Message-ID:</emphasis> header
20372 line; it is the local id that Exim assigns to the message, for example:
20373 <literal>1BXTIK-0001yO-VA</literal>.
20374 </para>
20375 </listitem></varlistentry>
20376 <varlistentry>
20377 <term><varname>$message_headers</varname></term>
20378 <listitem>
20379 <para>
20380 <indexterm role="variable">
20381 <primary><varname>$message_headers</varname></primary>
20382 </indexterm>
20383 </para>
20384 <informaltable frame="none">
20385 <tgroup cols="1" colsep="0" rowsep="0">
20386 <colspec colwidth="10pt" align="left"/>
20387 <tbody>
20388 <row>
20389 <entry><emphasis>Tainted</emphasis></entry>
20390 </row>
20391 </tbody>
20392 </tgroup>
20393 </informaltable>
20394 <para>
20395 This variable contains a concatenation of all the header lines when a message
20396 is being processed, except for lines added by routers or transports. The header
20397 lines are separated by newline characters. Their contents are decoded in the
20398 same way as a header line that is inserted by <option>bheader</option>.
20399 </para>
20400 </listitem></varlistentry>
20401 <varlistentry>
20402 <term><varname>$message_headers_raw</varname></term>
20403 <listitem>
20404 <para>
20405 <indexterm role="variable">
20406 <primary><varname>$message_headers_raw</varname></primary>
20407 </indexterm>
20408 </para>
20409 <informaltable frame="none">
20410 <tgroup cols="1" colsep="0" rowsep="0">
20411 <colspec colwidth="10pt" align="left"/>
20412 <tbody>
20413 <row>
20414 <entry><emphasis>Tainted</emphasis></entry>
20415 </row>
20416 </tbody>
20417 </tgroup>
20418 </informaltable>
20419 <para>
20420 This variable is like <varname>$message_headers</varname> except that no processing of the
20421 contents of header lines is done.
20422 </para>
20423 </listitem></varlistentry>
20424 <varlistentry>
20425 <term><varname>$message_id</varname></term>
20426 <listitem>
20427 <para>
20428 This is an old name for <varname>$message_exim_id</varname>. It is now deprecated.
20429 </para>
20430 </listitem></varlistentry>
20431 <varlistentry>
20432 <term><varname>$message_linecount</varname></term>
20433 <listitem>
20434 <para>
20435 <indexterm role="variable">
20436 <primary><varname>$message_linecount</varname></primary>
20437 </indexterm>
20438 This variable contains the total number of lines in the header and body of the
20439 message. Compare <varname>$body_linecount</varname>, which is the count for the body only.
20440 During the DATA and content-scanning ACLs, <varname>$message_linecount</varname> contains the
20441 number of lines received. Before delivery happens (that is, before filters,
20442 routers, and transports run) the count is increased to include the
20443 <emphasis>Received:</emphasis> header line that Exim standardly adds, and also any other header
20444 lines that are added by ACLs. The blank line that separates the message header
20445 from the body is not counted.
20446 </para>
20447 <para>
20448 As with the special case of <varname>$message_size</varname>, during the expansion of the
20449 appendfile transport&#x2019;s maildir_tag option in maildir format, the value of
20450 <varname>$message_linecount</varname> is the precise size of the number of newlines in the
20451 file that has been written (minus one for the blank line between the
20452 header and the body).
20453 </para>
20454 <para>
20455 Here is an example of the use of this variable in a DATA ACL:
20456 </para>
20457 <literallayout class="monospaced">
20458 deny condition = \
20459       ${if &lt;{250}{${eval:$message_linecount - $body_linecount}}}
20460      message   = Too many lines in message header
20461 </literallayout>
20462 <para>
20463 In the MAIL and RCPT ACLs, the value is zero because at that stage the
20464 message has not yet been received.
20465 </para>
20466 <para>
20467 This variable is not valid if the <option>spool_wireformat</option> option is used.
20468 </para>
20469 </listitem></varlistentry>
20470 <varlistentry>
20471 <term><varname>$message_size</varname></term>
20472 <listitem>
20473 <para>
20474 <indexterm role="concept">
20475 <primary>size</primary>
20476 <secondary>of message</secondary>
20477 </indexterm>
20478 <indexterm role="concept">
20479 <primary>message</primary>
20480 <secondary>size</secondary>
20481 </indexterm>
20482 <indexterm role="variable">
20483 <primary><varname>$message_size</varname></primary>
20484 </indexterm>
20485 When a message is being processed, this variable contains its size in bytes. In
20486 most cases, the size includes those headers that were received with the
20487 message, but not those (such as <emphasis>Envelope-to:</emphasis>) that are added to individual
20488 deliveries as they are written. However, there is one special case: during the
20489 expansion of the <option>maildir_tag</option> option in the <command>appendfile</command> transport while
20490 doing a delivery in maildir format, the value of <varname>$message_size</varname> is the
20491 precise size of the file that has been written. See also
20492 <varname>$message_body_size</varname>, <varname>$body_linecount</varname>, and <varname>$body_zerocount</varname>.
20493 </para>
20494 <para>
20495 <indexterm role="concept">
20496 <primary>RCPT</primary>
20497 <secondary>value of <varname>$message_size</varname></secondary>
20498 </indexterm>
20499 While running a per message ACL (mail/rcpt/predata), <varname>$message_size</varname>
20500 contains the size supplied on the MAIL command, or -1 if no size was given. The
20501 value may not, of course, be truthful.
20502 </para>
20503 </listitem></varlistentry>
20504 <varlistentry>
20505 <term><varname>$mime_anomaly_level</varname></term>
20506 <term><varname>$mime_anomaly_text</varname></term>
20507 <term><varname>$mime_boundary</varname></term>
20508 <term><varname>$mime_charset</varname></term>
20509 <term><varname>$mime_content_description</varname></term>
20510 <term><varname>$mime_content_disposition</varname></term>
20511 <term><varname>$mime_content_id</varname></term>
20512 <term><varname>$mime_content_size</varname></term>
20513 <term><varname>$mime_content_transfer_encoding</varname></term>
20514 <term><varname>$mime_content_type</varname></term>
20515 <term><varname>$mime_decoded_filename</varname></term>
20516 <term><varname>$mime_filename</varname></term>
20517 <term><varname>$mime_is_coverletter</varname></term>
20518 <term><varname>$mime_is_multipart</varname></term>
20519 <term><varname>$mime_is_rfc822</varname></term>
20520 <term><varname>$mime_part_count</varname></term>
20521 <listitem>
20522 <para>
20523 A number of variables whose names start with <varname>$mime</varname> are
20524 available when Exim is compiled with the content-scanning extension. For
20525 details, see section <xref linkend="SECTscanmimepart"/>.
20526 </para>
20527 </listitem></varlistentry>
20528 <varlistentry>
20529 <term><varname>$n0</varname> &ndash; <varname>$n9</varname></term>
20530 <listitem>
20531 <para>
20532 These variables are counters that can be incremented by means
20533 of the <option>add</option> command in filter files.
20534 </para>
20535 </listitem></varlistentry>
20536 <varlistentry>
20537 <term><varname>$original_domain</varname></term>
20538 <listitem>
20539 <para>
20540 <indexterm role="variable">
20541 <primary><varname>$original_domain</varname></primary>
20542 </indexterm>
20543 </para>
20544 <informaltable frame="none">
20545 <tgroup cols="1" colsep="0" rowsep="0">
20546 <colspec colwidth="10pt" align="left"/>
20547 <tbody>
20548 <row>
20549 <entry><emphasis>Tainted</emphasis></entry>
20550 </row>
20551 </tbody>
20552 </tgroup>
20553 </informaltable>
20554 <para>
20555 <indexterm role="variable">
20556 <primary><varname>$domain</varname></primary>
20557 </indexterm>
20558 When a top-level address is being processed for delivery, this contains the
20559 same value as <varname>$domain</varname>. However, if a <quote>child</quote> address (for example,
20560 generated by an alias, forward, or filter file) is being processed, this
20561 variable contains the domain of the original address (lower cased). This
20562 differs from <varname>$parent_domain</varname> only when there is more than one level of
20563 aliasing or forwarding. When more than one address is being delivered in a
20564 single transport run, <varname>$original_domain</varname> is not set.
20565 </para>
20566 <para>
20567 If a new address is created by means of a <option>deliver</option> command in a system
20568 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
20569 part <emphasis>system-filter</emphasis> and the default qualify domain.
20570 </para>
20571 </listitem></varlistentry>
20572 <varlistentry>
20573 <term><varname>$original_local_part</varname></term>
20574 <listitem>
20575 <para>
20576 <indexterm role="variable">
20577 <primary><varname>$original_local_part</varname></primary>
20578 </indexterm>
20579 </para>
20580 <informaltable frame="none">
20581 <tgroup cols="1" colsep="0" rowsep="0">
20582 <colspec colwidth="10pt" align="left"/>
20583 <tbody>
20584 <row>
20585 <entry><emphasis>Tainted</emphasis></entry>
20586 </row>
20587 </tbody>
20588 </tgroup>
20589 </informaltable>
20590 <para>
20591 <indexterm role="variable">
20592 <primary><varname>$local_part</varname></primary>
20593 </indexterm>
20594 When a top-level address is being processed for delivery, this contains the
20595 same value as <varname>$local_part</varname>, unless a prefix or suffix was removed from the
20596 local part, because <varname>$original_local_part</varname> always contains the full local
20597 part. When a <quote>child</quote> address (for example, generated by an alias, forward, or
20598 filter file) is being processed, this variable contains the full local part of
20599 the original address.
20600 </para>
20601 <para>
20602 If the router that did the redirection processed the local part
20603 case-insensitively, the value in <varname>$original_local_part</varname> is in lower case.
20604 This variable differs from <varname>$parent_local_part</varname> only when there is more than
20605 one level of aliasing or forwarding. When more than one address is being
20606 delivered in a single transport run, <varname>$original_local_part</varname> is not set.
20607 </para>
20608 <para>
20609 If a new address is created by means of a <option>deliver</option> command in a system
20610 filter, it is set up with an artificial <quote>parent</quote> address. This has the local
20611 part <emphasis>system-filter</emphasis> and the default qualify domain.
20612 </para>
20613 </listitem></varlistentry>
20614 <varlistentry>
20615 <term><varname>$originator_gid</varname></term>
20616 <listitem>
20617 <para>
20618 <indexterm role="concept">
20619 <primary>gid (group id)</primary>
20620 <secondary>of originating user</secondary>
20621 </indexterm>
20622 <indexterm role="concept">
20623 <primary>sender</primary>
20624 <secondary>gid</secondary>
20625 </indexterm>
20626 <indexterm role="variable">
20627 <primary><varname>$caller_gid</varname></primary>
20628 </indexterm>
20629 <indexterm role="variable">
20630 <primary><varname>$originator_gid</varname></primary>
20631 </indexterm>
20632 This variable contains the value of <varname>$caller_gid</varname> that was set when the
20633 message was received. For messages received via the command line, this is the
20634 gid of the sending user. For messages received by SMTP over TCP/IP, this is
20635 normally the gid of the Exim user.
20636 </para>
20637 </listitem></varlistentry>
20638 <varlistentry>
20639 <term><varname>$originator_uid</varname></term>
20640 <listitem>
20641 <para>
20642 <indexterm role="concept">
20643 <primary>uid (user id)</primary>
20644 <secondary>of originating user</secondary>
20645 </indexterm>
20646 <indexterm role="concept">
20647 <primary>sender</primary>
20648 <secondary>uid</secondary>
20649 </indexterm>
20650 <indexterm role="variable">
20651 <primary><varname>$caller_uid</varname></primary>
20652 </indexterm>
20653 <indexterm role="variable">
20654 <primary><varname>$originator_uid</varname></primary>
20655 </indexterm>
20656 The value of <varname>$caller_uid</varname> that was set when the message was received. For
20657 messages received via the command line, this is the uid of the sending user.
20658 For messages received by SMTP over TCP/IP, this is normally the uid of the Exim
20659 user.
20660 </para>
20661 </listitem></varlistentry>
20662 <varlistentry>
20663 <term><varname>$parent_domain</varname></term>
20664 <listitem>
20665 <para>
20666 <indexterm role="variable">
20667 <primary><varname>$parent_domain</varname></primary>
20668 </indexterm>
20669 </para>
20670 <informaltable frame="none">
20671 <tgroup cols="1" colsep="0" rowsep="0">
20672 <colspec colwidth="10pt" align="left"/>
20673 <tbody>
20674 <row>
20675 <entry><emphasis>Tainted</emphasis></entry>
20676 </row>
20677 </tbody>
20678 </tgroup>
20679 </informaltable>
20680 <para>
20681 This variable is similar to <varname>$original_domain</varname> (see
20682 above), except that it refers to the immediately preceding parent address.
20683 </para>
20684 </listitem></varlistentry>
20685 <varlistentry>
20686 <term><varname>$parent_local_part</varname></term>
20687 <listitem>
20688 <para>
20689 <indexterm role="variable">
20690 <primary><varname>$parent_local_part</varname></primary>
20691 </indexterm>
20692 </para>
20693 <informaltable frame="none">
20694 <tgroup cols="1" colsep="0" rowsep="0">
20695 <colspec colwidth="10pt" align="left"/>
20696 <tbody>
20697 <row>
20698 <entry><emphasis>Tainted</emphasis></entry>
20699 </row>
20700 </tbody>
20701 </tgroup>
20702 </informaltable>
20703 <para>
20704 This variable is similar to <varname>$original_local_part</varname>
20705 (see above), except that it refers to the immediately preceding parent address.
20706 </para>
20707 </listitem></varlistentry>
20708 <varlistentry>
20709 <term><varname>$pid</varname></term>
20710 <listitem>
20711 <para>
20712 <indexterm role="concept">
20713 <primary>pid (process id)</primary>
20714 <secondary>of current process</secondary>
20715 </indexterm>
20716 <indexterm role="variable">
20717 <primary><varname>$pid</varname></primary>
20718 </indexterm>
20719 This variable contains the current process id.
20720 </para>
20721 </listitem></varlistentry>
20722 <varlistentry>
20723 <term><varname>$pipe_addresses</varname></term>
20724 <listitem>
20725 <para>
20726 <indexterm role="concept">
20727 <primary>filter</primary>
20728 <secondary>transport filter</secondary>
20729 </indexterm>
20730 <indexterm role="concept">
20731 <primary>transport</primary>
20732 <secondary>filter</secondary>
20733 </indexterm>
20734 <indexterm role="variable">
20735 <primary><varname>$pipe_addresses</varname></primary>
20736 </indexterm>
20737 This is not an expansion variable, but is mentioned here because the string
20738 <literal>$pipe_addresses</literal> is handled specially in the command specification for the
20739 <command>pipe</command> transport (chapter <xref linkend="CHAPpipetransport"/>) and in transport filters
20740 (described under <option>transport_filter</option> in chapter <xref linkend="CHAPtransportgeneric"/>).
20741 It cannot be used in general expansion strings, and provokes an <quote>unknown
20742 variable</quote> error if encountered.
20743 </para>
20744 <para revisionflag="changed">
20745 <emphasis role="bold">Note</emphasis>: This value permits data supplied by a potential attacker to
20746 be used in the command for a <command>pipe</command> transport.
20747 Such configurations should be carefully assessed for security vulnerbilities.
20748 </para>
20749 </listitem></varlistentry>
20750 <varlistentry>
20751 <term><varname>$primary_hostname</varname></term>
20752 <listitem>
20753 <para>
20754 <indexterm role="variable">
20755 <primary><varname>$primary_hostname</varname></primary>
20756 </indexterm>
20757 This variable contains the value set by <option>primary_hostname</option> in the
20758 configuration file, or read by the <function>uname()</function> function. If <function>uname()</function> returns
20759 a single-component name, Exim calls <function>gethostbyname()</function> (or
20760 <function>getipnodebyname()</function> where available) in an attempt to acquire a fully
20761 qualified host name. See also <varname>$smtp_active_hostname</varname>.
20762 </para>
20763 </listitem></varlistentry>
20764 <varlistentry>
20765 <term><varname>$proxy_external_address</varname></term>
20766 <term><varname>$proxy_external_port</varname></term>
20767 <term><varname>$proxy_local_address</varname></term>
20768 <term><varname>$proxy_local_port</varname></term>
20769 <term><varname>$proxy_session</varname></term>
20770 <listitem>
20771 <para>
20772 These variables are only available when built with Proxy Protocol
20773 or SOCKS5 support.
20774 For details see chapter <xref linkend="SECTproxyInbound"/>.
20775 </para>
20776 </listitem></varlistentry>
20777 <varlistentry>
20778 <term><varname>$prdr_requested</varname></term>
20779 <listitem>
20780 <para>
20781 <indexterm role="concept">
20782 <primary>PRDR</primary>
20783 <secondary>variable for</secondary>
20784 </indexterm>
20785 This variable is set to <quote>yes</quote> if PRDR was requested by the client for the
20786 current message, otherwise <quote>no</quote>.
20787 </para>
20788 </listitem></varlistentry>
20789 <varlistentry>
20790 <term><varname>$prvscheck_address</varname></term>
20791 <term><varname>$prvscheck_keynum</varname></term>
20792 <term><varname>$prvscheck_result</varname></term>
20793 <listitem>
20794 <para>
20795 These variables are used in conjunction with the <option>prvscheck</option> expansion item,
20796 which is described in sections <xref linkend="SECTexpansionitems"/> and
20797 <xref linkend="SECTverifyPRVS"/>.
20798 </para>
20799 </listitem></varlistentry>
20800 <varlistentry>
20801 <term><varname>$qualify_domain</varname></term>
20802 <listitem>
20803 <para>
20804 <indexterm role="variable">
20805 <primary><varname>$qualify_domain</varname></primary>
20806 </indexterm>
20807 The value set for the <option>qualify_domain</option> option in the configuration file.
20808 </para>
20809 </listitem></varlistentry>
20810 <varlistentry>
20811 <term><varname>$qualify_recipient</varname></term>
20812 <listitem>
20813 <para>
20814 <indexterm role="variable">
20815 <primary><varname>$qualify_recipient</varname></primary>
20816 </indexterm>
20817 The value set for the <option>qualify_recipient</option> option in the configuration file,
20818 or if not set, the value of <varname>$qualify_domain</varname>.
20819 </para>
20820 </listitem></varlistentry>
20821 <varlistentry>
20822 <term><varname>$queue_name</varname></term>
20823 <listitem>
20824 <para>
20825 <indexterm role="variable">
20826 <primary><varname>$queue_name</varname></primary>
20827 </indexterm>
20828 <indexterm role="concept">
20829 <primary>named queues</primary>
20830 <secondary>variable</secondary>
20831 </indexterm>
20832 <indexterm role="concept">
20833 <primary>queues</primary>
20834 <secondary>named</secondary>
20835 </indexterm>
20836 The name of the spool queue in use; empty for the default queue.
20837 </para>
20838 </listitem></varlistentry>
20839 <varlistentry>
20840 <term><varname>$queue_size</varname></term>
20841 <listitem>
20842 <para>
20843 <indexterm role="variable">
20844 <primary><varname>$queue_size</varname></primary>
20845 </indexterm>
20846 <indexterm role="concept">
20847 <primary>queue</primary>
20848 <secondary>size of</secondary>
20849 </indexterm>
20850 <indexterm role="concept">
20851 <primary>spool</primary>
20852 <secondary>number of messages</secondary>
20853 </indexterm>
20854 This variable contains the number of messages queued.
20855 It is evaluated on demand, but no more often than once every minute.
20856 If there is no daemon notifier socket open, the value will be
20857 an empty string.
20858 </para>
20859 </listitem></varlistentry>
20860 <varlistentry>
20861 <term><varname>$r_...</varname></term>
20862 <listitem>
20863 <para>
20864 <indexterm role="variable">
20865 <primary><varname>$r_...</varname></primary>
20866 </indexterm>
20867 <indexterm role="concept">
20868 <primary>router</primary>
20869 <secondary>variables</secondary>
20870 </indexterm>
20871 Values can be placed in these variables by the <option>set</option> option of a router.
20872 They can be given any name that starts with <varname>$r_</varname>.
20873 The values persist for the address being handled through subsequent routers
20874 and the eventual transport.
20875 </para>
20876 </listitem></varlistentry>
20877 <varlistentry>
20878 <term><varname>$rcpt_count</varname></term>
20879 <listitem>
20880 <para>
20881 <indexterm role="variable">
20882 <primary><varname>$rcpt_count</varname></primary>
20883 </indexterm>
20884 When a message is being received by SMTP, this variable contains the number of
20885 RCPT commands received for the current message. If this variable is used in a
20886 RCPT ACL, its value includes the current command.
20887 </para>
20888 </listitem></varlistentry>
20889 <varlistentry>
20890 <term><varname>$rcpt_defer_count</varname></term>
20891 <listitem>
20892 <para>
20893 <indexterm role="variable">
20894 <primary><varname>$rcpt_defer_count</varname></primary>
20895 </indexterm>
20896 <indexterm role="concept">
20897 <primary>4<emphasis>xx</emphasis> responses</primary>
20898 <secondary>count of</secondary>
20899 </indexterm>
20900 When a message is being received by SMTP, this variable contains the number of
20901 RCPT commands in the current message that have previously been rejected with a
20902 temporary (4<emphasis>xx</emphasis>) response.
20903 </para>
20904 </listitem></varlistentry>
20905 <varlistentry>
20906 <term><varname>$rcpt_fail_count</varname></term>
20907 <listitem>
20908 <para>
20909 <indexterm role="variable">
20910 <primary><varname>$rcpt_fail_count</varname></primary>
20911 </indexterm>
20912 When a message is being received by SMTP, this variable contains the number of
20913 RCPT commands in the current message that have previously been rejected with a
20914 permanent (5<emphasis>xx</emphasis>) response.
20915 </para>
20916 </listitem></varlistentry>
20917 <varlistentry>
20918 <term><varname>$received_count</varname></term>
20919 <listitem>
20920 <para>
20921 <indexterm role="variable">
20922 <primary><varname>$received_count</varname></primary>
20923 </indexterm>
20924 This variable contains the number of <emphasis>Received:</emphasis> header lines in the message,
20925 including the one added by Exim (so its value is always greater than zero). It
20926 is available in the DATA ACL, the non-SMTP ACL, and while routing and
20927 delivering.
20928 </para>
20929 </listitem></varlistentry>
20930 <varlistentry>
20931 <term><varname>$received_for</varname></term>
20932 <listitem>
20933 <para>
20934 <indexterm role="variable">
20935 <primary><varname>$received_for</varname></primary>
20936 </indexterm>
20937 </para>
20938 <informaltable frame="none">
20939 <tgroup cols="1" colsep="0" rowsep="0">
20940 <colspec colwidth="10pt" align="left"/>
20941 <tbody>
20942 <row>
20943 <entry><emphasis>Tainted</emphasis></entry>
20944 </row>
20945 </tbody>
20946 </tgroup>
20947 </informaltable>
20948 <para>
20949 If there is only a single recipient address in an incoming message, this
20950 variable contains that address when the <emphasis>Received:</emphasis> header line is being
20951 built. The value is copied after recipient rewriting has happened, but before
20952 the <function>local_scan()</function> function is run.
20953 </para>
20954 </listitem></varlistentry>
20955 <varlistentry>
20956 <term><varname>$received_ip_address</varname></term>
20957 <term><varname>$received_port</varname></term>
20958 <listitem>
20959 <para>
20960 <indexterm role="variable">
20961 <primary><varname>$received_ip_address</varname></primary>
20962 </indexterm>
20963 <indexterm role="variable">
20964 <primary><varname>$received_port</varname></primary>
20965 </indexterm>
20966 As soon as an Exim server starts processing an incoming TCP/IP connection, these
20967 variables are set to the address and port on the local IP interface.
20968 (The remote IP address and port are in
20969 <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.) When testing with <option>-bh</option>,
20970 the port value is -1 unless it has been set using the <option>-oMi</option> command line
20971 option.
20972 </para>
20973 <para>
20974 As well as being useful in ACLs (including the <quote>connect</quote> ACL), these variable
20975 could be used, for example, to make the filename for a TLS certificate depend
20976 on which interface and/or port is being used for the incoming connection. The
20977 values of <varname>$received_ip_address</varname> and <varname>$received_port</varname> are saved with any
20978 messages that are received, thus making these variables available at delivery
20979 time.
20980 For outbound connections see <varname>$sending_ip_address</varname>.
20981 </para>
20982 </listitem></varlistentry>
20983 <varlistentry>
20984 <term><varname>$received_protocol</varname></term>
20985 <listitem>
20986 <para>
20987 <indexterm role="variable">
20988 <primary><varname>$received_protocol</varname></primary>
20989 </indexterm>
20990 When a message is being processed, this variable contains the name of the
20991 protocol by which it was received. Most of the names used by Exim are defined
20992 by RFCs 821, 2821, and 3848. They start with <quote>smtp</quote> (the client used HELO) or
20993 <quote>esmtp</quote> (the client used EHLO). This can be followed by <quote>s</quote> for secure
20994 (encrypted) and/or <quote>a</quote> for authenticated. Thus, for example, if the protocol
20995 is set to <quote>esmtpsa</quote>, the message was received over an encrypted SMTP
20996 connection and the client was successfully authenticated.
20997 </para>
20998 <para>
20999 Exim uses the protocol name <quote>smtps</quote> for the case when encryption is
21000 automatically set up on connection without the use of STARTTLS (see
21001 <option>tls_on_connect_ports</option>), and the client uses HELO to initiate the
21002 encrypted SMTP session. The name <quote>smtps</quote> is also used for the rare situation
21003 where the client initially uses EHLO, sets up an encrypted connection using
21004 STARTTLS, and then uses HELO afterwards.
21005 </para>
21006 <para>
21007 The <option>-oMr</option> option provides a way of specifying a custom protocol name for
21008 messages that are injected locally by trusted callers. This is commonly used to
21009 identify messages that are being re-injected after some kind of scanning.
21010 </para>
21011 </listitem></varlistentry>
21012 <varlistentry>
21013 <term><varname>$received_time</varname></term>
21014 <listitem>
21015 <para>
21016 <indexterm role="variable">
21017 <primary><varname>$received_time</varname></primary>
21018 </indexterm>
21019 This variable contains the date and time when the current message was received,
21020 as a number of seconds since the start of the Unix epoch.
21021 </para>
21022 </listitem></varlistentry>
21023 <varlistentry>
21024 <term><varname>$recipient_data</varname></term>
21025 <listitem>
21026 <para>
21027 <indexterm role="variable">
21028 <primary><varname>$recipient_data</varname></primary>
21029 </indexterm>
21030 This variable is set after an indexing lookup success in an ACL <option>recipients</option>
21031 condition. It contains the data from the lookup, and the value remains set
21032 until the next <option>recipients</option> test. Thus, you can do things like this:
21033 </para>
21034 <literallayout>
21035 <literal>require recipients  = cdb*@;/some/file</literal>
21036 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$recipient_data</literal>
21037 </literallayout>
21038 <para>
21039 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
21040 method in the address list, using the semicolon syntax as in the example above.
21041 The variable is not set for a lookup that is used as part of the string
21042 expansion that all such lists undergo before being interpreted.
21043 </para>
21044 </listitem></varlistentry>
21045 <varlistentry>
21046 <term><varname>$recipient_verify_failure</varname></term>
21047 <listitem>
21048 <para>
21049 <indexterm role="variable">
21050 <primary><varname>$recipient_verify_failure</varname></primary>
21051 </indexterm>
21052 In an ACL, when a recipient verification fails, this variable contains
21053 information about the failure. It is set to one of the following words:
21054 </para>
21055 <itemizedlist>
21056 <listitem>
21057 <para>
21058 <quote>qualify</quote>: The address was unqualified (no domain), and the message
21059 was neither local nor came from an exempted host.
21060 </para>
21061 </listitem>
21062 <listitem>
21063 <para>
21064 <quote>route</quote>: Routing failed.
21065 </para>
21066 </listitem>
21067 <listitem>
21068 <para>
21069 <quote>mail</quote>: Routing succeeded, and a callout was attempted; rejection occurred at
21070 or before the MAIL command (that is, on initial connection, HELO, or
21071 MAIL).
21072 </para>
21073 </listitem>
21074 <listitem>
21075 <para>
21076 <quote>recipient</quote>: The RCPT command in a callout was rejected.
21077 </para>
21078 </listitem>
21079 <listitem>
21080 <para>
21081 <quote>postmaster</quote>: The postmaster check in a callout was rejected.
21082 </para>
21083 </listitem>
21084 </itemizedlist>
21085 <para>
21086 The main use of this variable is expected to be to distinguish between
21087 rejections of MAIL and rejections of RCPT.
21088 </para>
21089 </listitem></varlistentry>
21090 <varlistentry>
21091 <term><varname>$recipients</varname></term>
21092 <listitem>
21093 <para>
21094 <indexterm role="variable">
21095 <primary><varname>$recipients</varname></primary>
21096 </indexterm>
21097 </para>
21098 <informaltable frame="none">
21099 <tgroup cols="1" colsep="0" rowsep="0">
21100 <colspec colwidth="10pt" align="left"/>
21101 <tbody>
21102 <row>
21103 <entry><emphasis>Tainted</emphasis></entry>
21104 </row>
21105 </tbody>
21106 </tgroup>
21107 </informaltable>
21108 <para>
21109 This variable contains a list of envelope recipients for a message. A comma and
21110 a space separate the addresses in the replacement text. However, the variable
21111 is not generally available, to prevent exposure of Bcc recipients in
21112 unprivileged users&#x2019; filter files. You can use <varname>$recipients</varname> only in these
21113 cases:
21114 </para>
21115 <orderedlist numeration="arabic">
21116 <listitem>
21117 <para>
21118 In a system filter file.
21119 </para>
21120 </listitem>
21121 <listitem>
21122 <para>
21123 In the ACLs associated with the DATA command and with non-SMTP messages, that
21124 is, the ACLs defined by <option>acl_smtp_predata</option>, <option>acl_smtp_data</option>,
21125 <option>acl_smtp_mime</option>, <option>acl_not_smtp_start</option>, <option>acl_not_smtp</option>, and
21126 <option>acl_not_smtp_mime</option>.
21127 </para>
21128 </listitem>
21129 <listitem>
21130 <para>
21131 From within a <function>local_scan()</function> function.
21132 </para>
21133 </listitem>
21134 </orderedlist>
21135 </listitem></varlistentry>
21136 <varlistentry>
21137 <term><varname>$recipients_count</varname></term>
21138 <listitem>
21139 <para>
21140 <indexterm role="variable">
21141 <primary><varname>$recipients_count</varname></primary>
21142 </indexterm>
21143 When a message is being processed, this variable contains the number of
21144 envelope recipients that came with the message. Duplicates are not excluded
21145 from the count. While a message is being received over SMTP, the number
21146 increases for each accepted recipient. It can be referenced in an ACL.
21147 </para>
21148 </listitem></varlistentry>
21149 <varlistentry>
21150 <term><varname>$regex_match_string</varname></term>
21151 <listitem>
21152 <para>
21153 <indexterm role="variable">
21154 <primary><varname>$regex_match_string</varname></primary>
21155 </indexterm>
21156 This variable is set to contain the matching regular expression after a
21157 <option>regex</option> ACL condition has matched (see section <xref linkend="SECTscanregex"/>).
21158 </para>
21159 </listitem></varlistentry>
21160 <varlistentry>
21161 <term><varname>$regex1</varname>, <varname>$regex2</varname>, etc</term>
21162 <listitem>
21163 <para>
21164 <indexterm role="concept">
21165 <primary>regex submatch variables (<varname>$1regex</varname> <varname>$2regex</varname> etc)</primary>
21166 </indexterm>
21167 When a <option>regex</option> or <option>mime_regex</option> ACL condition succeeds,
21168 these variables contain the
21169 captured substrings identified by the regular expression.
21170 </para>
21171 <para revisionflag="changed">
21172 If the subject string was tainted then so will any captured substring.
21173 </para>
21174 </listitem></varlistentry>
21175 <varlistentry>
21176 <term><varname>$reply_address</varname></term>
21177 <listitem>
21178 <para>
21179 <indexterm role="variable">
21180 <primary><varname>$reply_address</varname></primary>
21181 </indexterm>
21182 </para>
21183 <informaltable frame="none">
21184 <tgroup cols="1" colsep="0" rowsep="0">
21185 <colspec colwidth="10pt" align="left"/>
21186 <tbody>
21187 <row>
21188 <entry><emphasis>Tainted</emphasis></entry>
21189 </row>
21190 </tbody>
21191 </tgroup>
21192 </informaltable>
21193 <para>
21194 When a message is being processed, this variable contains the contents of the
21195 <emphasis>Reply-To:</emphasis> header line if one exists and it is not empty, or otherwise the
21196 contents of the <emphasis>From:</emphasis> header line. Apart from the removal of leading
21197 white space, the value is not processed in any way. In particular, no RFC 2047
21198 decoding or character code translation takes place.
21199 </para>
21200 </listitem></varlistentry>
21201 <varlistentry>
21202 <term><varname>$return_path</varname></term>
21203 <listitem>
21204 <para>
21205 <indexterm role="variable">
21206 <primary><varname>$return_path</varname></primary>
21207 </indexterm>
21208 When a message is being delivered, this variable contains the return path &ndash;
21209 the sender field that will be sent as part of the envelope. It is not enclosed
21210 in &lt;&gt; characters. At the start of routing an address, <varname>$return_path</varname> has the
21211 same value as <varname>$sender_address</varname>, but if, for example, an incoming message to a
21212 mailing list has been expanded by a router which specifies a different address
21213 for bounce messages, <varname>$return_path</varname> subsequently contains the new bounce
21214 address, whereas <varname>$sender_address</varname> always contains the original sender address
21215 that was received with the message. In other words, <varname>$sender_address</varname> contains
21216 the incoming envelope sender, and <varname>$return_path</varname> contains the outgoing
21217 envelope sender.
21218 </para>
21219 </listitem></varlistentry>
21220 <varlistentry>
21221 <term><varname>$return_size_limit</varname></term>
21222 <listitem>
21223 <para>
21224 <indexterm role="variable">
21225 <primary><varname>$return_size_limit</varname></primary>
21226 </indexterm>
21227 This is an obsolete name for <varname>$bounce_return_size_limit</varname>.
21228 </para>
21229 </listitem></varlistentry>
21230 <varlistentry>
21231 <term><varname>$router_name</varname></term>
21232 <listitem>
21233 <para>
21234 <indexterm role="concept">
21235 <primary>router</primary>
21236 <secondary>name</secondary>
21237 </indexterm>
21238 <indexterm role="concept">
21239 <primary>name</primary>
21240 <secondary>of router</secondary>
21241 </indexterm>
21242 <indexterm role="variable">
21243 <primary><varname>$router_name</varname></primary>
21244 </indexterm>
21245 During the running of a router this variable contains its name.
21246 </para>
21247 </listitem></varlistentry>
21248 <varlistentry>
21249 <term><varname>$runrc</varname></term>
21250 <listitem>
21251 <para>
21252 <indexterm role="concept">
21253 <primary>return code</primary>
21254 <secondary>from <option>run</option> expansion</secondary>
21255 </indexterm>
21256 <indexterm role="variable">
21257 <primary><varname>$runrc</varname></primary>
21258 </indexterm>
21259 This variable contains the return code from a command that is run by the
21260 <option>${run...}</option> expansion item. <emphasis role="bold">Warning</emphasis>: In a router or transport, you cannot
21261 assume the order in which option values are expanded, except for those
21262 preconditions whose order of testing is documented. Therefore, you cannot
21263 reliably expect to set <varname>$runrc</varname> by the expansion of one option, and use it in
21264 another.
21265 </para>
21266 </listitem></varlistentry>
21267 <varlistentry>
21268 <term><varname>$self_hostname</varname></term>
21269 <listitem>
21270 <para>
21271 <indexterm role="option">
21272 <primary><option>self</option></primary>
21273 <secondary>value of host name</secondary>
21274 </indexterm>
21275 <indexterm role="variable">
21276 <primary><varname>$self_hostname</varname></primary>
21277 </indexterm>
21278 When an address is routed to a supposedly remote host that turns out to be the
21279 local host, what happens is controlled by the <option>self</option> generic router option.
21280 One of its values causes the address to be passed to another router. When this
21281 happens, <varname>$self_hostname</varname> is set to the name of the local host that the
21282 original router encountered. In other circumstances its contents are null.
21283 </para>
21284 </listitem></varlistentry>
21285 <varlistentry>
21286 <term><varname>$sender_address</varname></term>
21287 <listitem>
21288 <para>
21289 <indexterm role="variable">
21290 <primary><varname>$sender_address</varname></primary>
21291 </indexterm>
21292 </para>
21293 <informaltable frame="none">
21294 <tgroup cols="1" colsep="0" rowsep="0">
21295 <colspec colwidth="10pt" align="left"/>
21296 <tbody>
21297 <row>
21298 <entry><emphasis>Tainted</emphasis></entry>
21299 </row>
21300 </tbody>
21301 </tgroup>
21302 </informaltable>
21303 <para>
21304 When a message is being processed, this variable contains the sender&#x2019;s address
21305 that was received in the message&#x2019;s envelope. The case of letters in the address
21306 is retained, in both the local part and the domain. For bounce messages, the
21307 value of this variable is the empty string. See also <varname>$return_path</varname>.
21308 </para>
21309 </listitem></varlistentry>
21310 <varlistentry>
21311 <term><varname>$sender_address_data</varname></term>
21312 <listitem>
21313 <para>
21314 <indexterm role="variable">
21315 <primary><varname>$address_data</varname></primary>
21316 </indexterm>
21317 <indexterm role="variable">
21318 <primary><varname>$sender_address_data</varname></primary>
21319 </indexterm>
21320 If <varname>$address_data</varname> is set when the routers are called from an ACL to verify a
21321 sender address, the final value is preserved in <varname>$sender_address_data</varname>, to
21322 distinguish it from data from a recipient address. The value does not persist
21323 after the end of the current ACL statement. If you want to preserve it for
21324 longer, you can save it in an ACL variable.
21325 </para>
21326 </listitem></varlistentry>
21327 <varlistentry>
21328 <term><varname>$sender_address_domain</varname></term>
21329 <listitem>
21330 <para>
21331 <indexterm role="variable">
21332 <primary><varname>$sender_address_domain</varname></primary>
21333 </indexterm>
21334 </para>
21335 <informaltable frame="none">
21336 <tgroup cols="1" colsep="0" rowsep="0">
21337 <colspec colwidth="10pt" align="left"/>
21338 <tbody>
21339 <row>
21340 <entry><emphasis>Tainted</emphasis></entry>
21341 </row>
21342 </tbody>
21343 </tgroup>
21344 </informaltable>
21345 <para>
21346 The domain portion of <varname>$sender_address</varname>.
21347 </para>
21348 </listitem></varlistentry>
21349 <varlistentry>
21350 <term><varname>$sender_address_local_part</varname></term>
21351 <listitem>
21352 <para>
21353 <indexterm role="variable">
21354 <primary><varname>$sender_address_local_part</varname></primary>
21355 </indexterm>
21356 </para>
21357 <informaltable frame="none">
21358 <tgroup cols="1" colsep="0" rowsep="0">
21359 <colspec colwidth="10pt" align="left"/>
21360 <tbody>
21361 <row>
21362 <entry><emphasis>Tainted</emphasis></entry>
21363 </row>
21364 </tbody>
21365 </tgroup>
21366 </informaltable>
21367 <para>
21368 The local part portion of <varname>$sender_address</varname>.
21369 </para>
21370 </listitem></varlistentry>
21371 <varlistentry>
21372 <term><varname>$sender_data</varname></term>
21373 <listitem>
21374 <para>
21375 <indexterm role="variable">
21376 <primary><varname>$sender_data</varname></primary>
21377 </indexterm>
21378 This variable is set after a lookup success in an ACL <option>senders</option> condition or
21379 in a router <option>senders</option> option. It contains the data from the lookup, and the
21380 value remains set until the next <option>senders</option> test. Thus, you can do things like
21381 this:
21382 </para>
21383 <literallayout>
21384 <literal>require senders      = cdb*@;/some/file</literal>
21385 <literal>deny    </literal><emphasis>some further test involving</emphasis> <literal>$sender_data</literal>
21386 </literallayout>
21387 <para>
21388 <emphasis role="bold">Warning</emphasis>: This variable is set only when a lookup is used as an indexing
21389 method in the address list, using the semicolon syntax as in the example above.
21390 The variable is not set for a lookup that is used as part of the string
21391 expansion that all such lists undergo before being interpreted.
21392 </para>
21393 </listitem></varlistentry>
21394 <varlistentry>
21395 <term><varname>$sender_fullhost</varname></term>
21396 <listitem>
21397 <para>
21398 <indexterm role="variable">
21399 <primary><varname>$sender_fullhost</varname></primary>
21400 </indexterm>
21401 When a message is received from a remote host, this variable contains the host
21402 name and IP address in a single string. It ends with the IP address in square
21403 brackets, followed by a colon and a port number if the logging of ports is
21404 enabled. The format of the rest of the string depends on whether the host
21405 issued a HELO or EHLO SMTP command, and whether the host name was verified by
21406 looking up its IP address. (Looking up the IP address can be forced by the
21407 <option>host_lookup</option> option, independent of verification.) A plain host name at the
21408 start of the string is a verified host name; if this is not present,
21409 verification either failed or was not requested. A host name in parentheses is
21410 the argument of a HELO or EHLO command. This is omitted if it is identical to
21411 the verified host name or to the host&#x2019;s IP address in square brackets.
21412 </para>
21413 </listitem></varlistentry>
21414 <varlistentry>
21415 <term><varname>$sender_helo_dnssec</varname></term>
21416 <listitem>
21417 <para>
21418 <indexterm role="variable">
21419 <primary><varname>$sender_helo_dnssec</varname></primary>
21420 </indexterm>
21421 This boolean variable is true if a successful HELO verification was
21422 <indexterm role="concept">
21423 <primary>DNS</primary>
21424 <secondary>DNSSEC</secondary>
21425 </indexterm>
21426 done using DNS information the resolver library stated was authenticated data.
21427 </para>
21428 </listitem></varlistentry>
21429 <varlistentry>
21430 <term><varname>$sender_helo_name</varname></term>
21431 <listitem>
21432 <para>
21433 <indexterm role="variable">
21434 <primary><varname>$sender_helo_name</varname></primary>
21435 </indexterm>
21436 </para>
21437 <informaltable frame="none">
21438 <tgroup cols="1" colsep="0" rowsep="0">
21439 <colspec colwidth="10pt" align="left"/>
21440 <tbody>
21441 <row>
21442 <entry><emphasis>Tainted</emphasis></entry>
21443 </row>
21444 </tbody>
21445 </tgroup>
21446 </informaltable>
21447 <para>
21448 When a message is received from a remote host that has issued a HELO or EHLO
21449 command, the argument of that command is placed in this variable. It is also
21450 set if HELO or EHLO is used when a message is received using SMTP locally via
21451 the <option>-bs</option> or <option>-bS</option> options.
21452 </para>
21453 </listitem></varlistentry>
21454 <varlistentry>
21455 <term><varname>$sender_host_address</varname></term>
21456 <listitem>
21457 <para>
21458 <indexterm role="variable">
21459 <primary><varname>$sender_host_address</varname></primary>
21460 </indexterm>
21461 When a message is received from a remote host using SMTP,
21462 this variable contains that
21463 host&#x2019;s IP address. For locally non-SMTP submitted messages, it is empty.
21464 </para>
21465 </listitem></varlistentry>
21466 <varlistentry>
21467 <term><varname>$sender_host_authenticated</varname></term>
21468 <listitem>
21469 <para>
21470 <indexterm role="variable">
21471 <primary><varname>$sender_host_authenticated</varname></primary>
21472 </indexterm>
21473 This variable contains the name (not the public name) of the authenticator
21474 driver that successfully authenticated the client from which the message was
21475 received. It is empty if there was no successful authentication. See also
21476 <varname>$authenticated_id</varname>.
21477 </para>
21478 </listitem></varlistentry>
21479 <varlistentry>
21480 <term><varname>$sender_host_dnssec</varname></term>
21481 <listitem>
21482 <para>
21483 <indexterm role="variable">
21484 <primary><varname>$sender_host_dnssec</varname></primary>
21485 </indexterm>
21486 If an attempt to populate <varname>$sender_host_name</varname> has been made
21487 (by reference, <option>hosts_lookup</option> or
21488 otherwise) then this boolean will have been set true if, and only if, the
21489 resolver library states that both
21490 the reverse and forward DNS were authenticated data.  At all
21491 other times, this variable is false.
21492 </para>
21493 <para>
21494 <indexterm role="concept">
21495 <primary>DNS</primary>
21496 <secondary>DNSSEC</secondary>
21497 </indexterm>
21498 It is likely that you will need to coerce DNSSEC support on in the resolver
21499 library, by setting:
21500 </para>
21501 <literallayout class="monospaced">
21502 dns_dnssec_ok = 1
21503 </literallayout>
21504 <para>
21505 In addition, on Linux with glibc 2.31 or newer the resolver library will
21506 default to stripping out a successful validation status.
21507 This will break a previously working Exim installation.
21508 Provided that you do trust the resolver (ie, is on localhost) you can tell
21509 glibc to pass through any successful validation with a new option in
21510 <filename>/etc/resolv.conf</filename>:
21511 </para>
21512 <literallayout class="monospaced">
21513 options trust-ad
21514 </literallayout>
21515 <para>
21516 Exim does not perform DNSSEC validation itself, instead leaving that to a
21517 validating resolver (e.g. unbound, or bind with suitable configuration).
21518 </para>
21519 <para>
21520 If you have changed <option>host_lookup_order</option> so that <literal>bydns</literal> is not the first
21521 mechanism in the list, then this variable will be false.
21522 </para>
21523 <para>
21524 This requires that your system resolver library support EDNS0 (and that
21525 DNSSEC flags exist in the system headers).  If the resolver silently drops
21526 all EDNS0 options, then this will have no effect.  OpenBSD&#x2019;s asr resolver
21527 is known to currently ignore EDNS0, documented in CAVEATS of asr_run(3).
21528 </para>
21529 </listitem></varlistentry>
21530 <varlistentry>
21531 <term><varname>$sender_host_name</varname></term>
21532 <listitem>
21533 <para>
21534 <indexterm role="variable">
21535 <primary><varname>$sender_host_name</varname></primary>
21536 </indexterm>
21537 </para>
21538 <informaltable frame="none">
21539 <tgroup cols="1" colsep="0" rowsep="0">
21540 <colspec colwidth="10pt" align="left"/>
21541 <tbody>
21542 <row>
21543 <entry><emphasis>Tainted</emphasis></entry>
21544 </row>
21545 </tbody>
21546 </tgroup>
21547 </informaltable>
21548 <para>
21549 When a message is received from a remote host, this variable contains the
21550 host&#x2019;s name as obtained by looking up its IP address. For messages received by
21551 other means, this variable is empty.
21552 </para>
21553 <para>
21554 <indexterm role="variable">
21555 <primary><varname>$host_lookup_failed</varname></primary>
21556 </indexterm>
21557 If the host name has not previously been looked up, a reference to
21558 <varname>$sender_host_name</varname> triggers a lookup (for messages from remote hosts).
21559 A looked up name is accepted only if it leads back to the original IP address
21560 via a forward lookup. If either the reverse or the forward lookup fails to find
21561 any data, or if the forward lookup does not yield the original IP address,
21562 <varname>$sender_host_name</varname> remains empty, and <varname>$host_lookup_failed</varname> is set to <quote>1</quote>.
21563 </para>
21564 <para>
21565 <indexterm role="variable">
21566 <primary><varname>$host_lookup_deferred</varname></primary>
21567 </indexterm>
21568 However, if either of the lookups cannot be completed (for example, there is a
21569 DNS timeout), <varname>$host_lookup_deferred</varname> is set to <quote>1</quote>, and
21570 <varname>$host_lookup_failed</varname> remains set to <quote>0</quote>.
21571 </para>
21572 <para>
21573 Once <varname>$host_lookup_failed</varname> is set to <quote>1</quote>, Exim does not try to look up the
21574 host name again if there is a subsequent reference to <varname>$sender_host_name</varname>
21575 in the same Exim process, but it does try again if <varname>$host_lookup_deferred</varname>
21576 is set to <quote>1</quote>.
21577 </para>
21578 <para>
21579 Exim does not automatically look up every calling host&#x2019;s name. If you want
21580 maximum efficiency, you should arrange your configuration so that it avoids
21581 these lookups altogether. The lookup happens only if one or more of the
21582 following are true:
21583 </para>
21584 <itemizedlist>
21585 <listitem>
21586 <para>
21587 A string containing <varname>$sender_host_name</varname> is expanded.
21588 </para>
21589 </listitem>
21590 <listitem>
21591 <para>
21592 The calling host matches the list in <option>host_lookup</option>. In the default
21593 configuration, this option is set to *, so it must be changed if lookups are
21594 to be avoided. (In the code, the default for <option>host_lookup</option> is unset.)
21595 </para>
21596 </listitem>
21597 <listitem>
21598 <para>
21599 Exim needs the host name in order to test an item in a host list. The items
21600 that require this are described in sections <xref linkend="SECThoslispatnam"/> and
21601 <xref linkend="SECThoslispatnamsk"/>.
21602 </para>
21603 </listitem>
21604 <listitem>
21605 <para>
21606 The calling host matches <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>.
21607 In this case, the host name is required to compare with the name quoted in any
21608 EHLO or HELO commands that the client issues.
21609 </para>
21610 </listitem>
21611 <listitem>
21612 <para>
21613 The remote host issues a EHLO or HELO command that quotes one of the
21614 domains in <option>helo_lookup_domains</option>. The default value of this option is
21615 </para>
21616 <literallayout class="monospaced">
21617   helo_lookup_domains = @ : @[]
21618 </literallayout>
21619 <para>
21620 which causes a lookup if a remote host (incorrectly) gives the server&#x2019;s name or
21621 IP address in an EHLO or HELO command.
21622 </para>
21623 </listitem>
21624 </itemizedlist>
21625 </listitem></varlistentry>
21626 <varlistentry>
21627 <term><varname>$sender_host_port</varname></term>
21628 <listitem>
21629 <para>
21630 <indexterm role="variable">
21631 <primary><varname>$sender_host_port</varname></primary>
21632 </indexterm>
21633 When a message is received from a remote host, this variable contains the port
21634 number that was used on the remote host.
21635 </para>
21636 </listitem></varlistentry>
21637 <varlistentry>
21638 <term><varname>$sender_ident</varname></term>
21639 <listitem>
21640 <para>
21641 <indexterm role="variable">
21642 <primary><varname>$sender_ident</varname></primary>
21643 </indexterm>
21644 When a message is received from a remote host, this variable contains the
21645 identification received in response to an RFC 1413 request. When a message has
21646 been received locally, this variable contains the login name of the user that
21647 called Exim.
21648 </para>
21649 </listitem></varlistentry>
21650 <varlistentry>
21651 <term><varname>$sender_rate_</varname><emphasis>xxx</emphasis></term>
21652 <listitem>
21653 <para>
21654 A number of variables whose names begin <varname>$sender_rate_</varname> are set as part of the
21655 <option>ratelimit</option> ACL condition. Details are given in section
21656 <xref linkend="SECTratelimiting"/>.
21657 </para>
21658 </listitem></varlistentry>
21659 <varlistentry>
21660 <term><varname>$sender_rcvhost</varname></term>
21661 <listitem>
21662 <para>
21663 <indexterm role="concept">
21664 <primary>DNS</primary>
21665 <secondary>reverse lookup</secondary>
21666 </indexterm>
21667 <indexterm role="concept">
21668 <primary>reverse DNS lookup</primary>
21669 </indexterm>
21670 <indexterm role="variable">
21671 <primary><varname>$sender_rcvhost</varname></primary>
21672 </indexterm>
21673 This is provided specifically for use in <emphasis>Received:</emphasis> headers. It starts with
21674 either the verified host name (as obtained from a reverse DNS lookup) or, if
21675 there is no verified host name, the IP address in square brackets. After that
21676 there may be text in parentheses. When the first item is a verified host name,
21677 the first thing in the parentheses is the IP address in square brackets,
21678 followed by a colon and a port number if port logging is enabled. When the
21679 first item is an IP address, the port is recorded as <quote>port=<emphasis>xxxx</emphasis></quote> inside
21680 the parentheses.
21681 </para>
21682 <para>
21683 There may also be items of the form <quote>helo=<emphasis>xxxx</emphasis></quote> if HELO or EHLO
21684 was used and its argument was not identical to the real host name or IP
21685 address, and <quote>ident=<emphasis>xxxx</emphasis></quote> if an RFC 1413 ident string is available. If
21686 all three items are present in the parentheses, a newline and tab are inserted
21687 into the string, to improve the formatting of the <emphasis>Received:</emphasis> header.
21688 </para>
21689 </listitem></varlistentry>
21690 <varlistentry>
21691 <term><varname>$sender_verify_failure</varname></term>
21692 <listitem>
21693 <para>
21694 <indexterm role="variable">
21695 <primary><varname>$sender_verify_failure</varname></primary>
21696 </indexterm>
21697 In an ACL, when a sender verification fails, this variable contains information
21698 about the failure. The details are the same as for
21699 <varname>$recipient_verify_failure</varname>.
21700 </para>
21701 </listitem></varlistentry>
21702 <varlistentry>
21703 <term><varname>$sending_ip_address</varname></term>
21704 <listitem>
21705 <para>
21706 <indexterm role="variable">
21707 <primary><varname>$sending_ip_address</varname></primary>
21708 </indexterm>
21709 This variable is set whenever an outgoing SMTP connection to another host has
21710 been set up. It contains the IP address of the local interface that is being
21711 used. This is useful if a host that has more than one IP address wants to take
21712 on different personalities depending on which one is being used. For incoming
21713 connections, see <varname>$received_ip_address</varname>.
21714 </para>
21715 </listitem></varlistentry>
21716 <varlistentry>
21717 <term><varname>$sending_port</varname></term>
21718 <listitem>
21719 <para>
21720 <indexterm role="variable">
21721 <primary><varname>$sending_port</varname></primary>
21722 </indexterm>
21723 This variable is set whenever an outgoing SMTP connection to another host has
21724 been set up. It contains the local port that is being used. For incoming
21725 connections, see <varname>$received_port</varname>.
21726 </para>
21727 </listitem></varlistentry>
21728 <varlistentry>
21729 <term><varname>$smtp_active_hostname</varname></term>
21730 <listitem>
21731 <para>
21732 <indexterm role="variable">
21733 <primary><varname>$smtp_active_hostname</varname></primary>
21734 </indexterm>
21735 During an incoming SMTP session, this variable contains the value of the active
21736 host name, as specified by the <option>smtp_active_hostname</option> option. The value of
21737 <varname>$smtp_active_hostname</varname> is saved with any message that is received, so its
21738 value can be consulted during routing and delivery.
21739 </para>
21740 </listitem></varlistentry>
21741 <varlistentry>
21742 <term><varname>$smtp_command</varname></term>
21743 <listitem>
21744 <para>
21745 <indexterm role="variable">
21746 <primary><varname>$smtp_command</varname></primary>
21747 </indexterm>
21748 </para>
21749 <informaltable frame="none">
21750 <tgroup cols="1" colsep="0" rowsep="0">
21751 <colspec colwidth="10pt" align="left"/>
21752 <tbody>
21753 <row>
21754 <entry><emphasis>Tainted</emphasis></entry>
21755 </row>
21756 </tbody>
21757 </tgroup>
21758 </informaltable>
21759 <para>
21760 During the processing of an incoming SMTP command, this variable contains the
21761 entire command. This makes it possible to distinguish between HELO and EHLO in
21762 the HELO ACL, and also to distinguish between commands such as these:
21763 </para>
21764 <literallayout class="monospaced">
21765 MAIL FROM:&lt;&gt;
21766 MAIL FROM: &lt;&gt;
21767 </literallayout>
21768 <para>
21769 For a MAIL command, extra parameters such as SIZE can be inspected. For a RCPT
21770 command, the address in <varname>$smtp_command</varname> is the original address before any
21771 rewriting, whereas the values in <varname>$local_part</varname> and <varname>$domain</varname> are taken from
21772 the address after SMTP-time rewriting.
21773 </para>
21774 </listitem></varlistentry>
21775 <varlistentry>
21776 <term><varname>$smtp_command_argument</varname></term>
21777 <listitem>
21778 <para>
21779 <indexterm role="variable">
21780 <primary><varname>$smtp_command_argument</varname></primary>
21781 </indexterm>
21782 </para>
21783 <informaltable frame="none">
21784 <tgroup cols="1" colsep="0" rowsep="0">
21785 <colspec colwidth="10pt" align="left"/>
21786 <tbody>
21787 <row>
21788 <entry><emphasis>Tainted</emphasis></entry>
21789 </row>
21790 </tbody>
21791 </tgroup>
21792 </informaltable>
21793 <para>
21794 <indexterm role="concept">
21795 <primary>SMTP</primary>
21796 <secondary>command, argument for</secondary>
21797 </indexterm>
21798 While an ACL is running to check an SMTP command, this variable contains the
21799 argument, that is, the text that follows the command name, with leading white
21800 space removed. Following the introduction of <varname>$smtp_command</varname>, this variable is
21801 somewhat redundant, but is retained for backwards compatibility.
21802 </para>
21803 </listitem></varlistentry>
21804 <varlistentry>
21805 <term><varname>$smtp_command_history</varname></term>
21806 <listitem>
21807 <para>
21808 <indexterm role="concept">
21809 <primary>SMTP</primary>
21810 <secondary>command history</secondary>
21811 </indexterm>
21812 <indexterm role="variable">
21813 <primary><varname>$smtp_command_history</varname></primary>
21814 </indexterm>
21815 A comma-separated list (with no whitespace) of the most-recent SMTP commands
21816 received, in time-order left to right.  Only a limited number of commands
21817 are remembered.
21818 </para>
21819 </listitem></varlistentry>
21820 <varlistentry>
21821 <term><varname>$smtp_count_at_connection_start</varname></term>
21822 <listitem>
21823 <para>
21824 <indexterm role="variable">
21825 <primary><varname>$smtp_count_at_connection_start</varname></primary>
21826 </indexterm>
21827 This variable is set greater than zero only in processes spawned by the Exim
21828 daemon for handling incoming SMTP connections. The name is deliberately long,
21829 in order to emphasize what the contents are. When the daemon accepts a new
21830 connection, it increments this variable. A copy of the variable is passed to
21831 the child process that handles the connection, but its value is fixed, and
21832 never changes. It is only an approximation of how many incoming connections
21833 there actually are, because many other connections may come and go while a
21834 single connection is being processed. When a child process terminates, the
21835 daemon decrements its copy of the variable.
21836 </para>
21837 </listitem></varlistentry>
21838 <varlistentry>
21839 <term><varname>$sn0</varname> &ndash; <varname>$sn9</varname></term>
21840 <listitem>
21841 <para>
21842 These variables are copies of the values of the <varname>$n0</varname> &ndash; <varname>$n9</varname> accumulators
21843 that were current at the end of the system filter file. This allows a system
21844 filter file to set values that can be tested in users&#x2019; filter files. For
21845 example, a system filter could set a value indicating how likely it is that a
21846 message is junk mail.
21847 </para>
21848 </listitem></varlistentry>
21849 <varlistentry>
21850 <term><varname>$spam_score</varname></term>
21851 <term><varname>$spam_score_int</varname></term>
21852 <term><varname>$spam_bar</varname></term>
21853 <term><varname>$spam_report</varname></term>
21854 <term><varname>$spam_action</varname></term>
21855 <listitem>
21856 <para>
21857 A number of variables whose names start with <varname>$spam</varname> are available when Exim
21858 is compiled with the content-scanning extension. For details, see section
21859 <xref linkend="SECTscanspamass"/>.
21860 </para>
21861 </listitem></varlistentry>
21862 <varlistentry>
21863 <term><varname>$spf_header_comment</varname></term>
21864 <term><varname>$spf_received</varname></term>
21865 <term><varname>$spf_result</varname></term>
21866 <term><varname>$spf_result_guessed</varname></term>
21867 <term><varname>$spf_smtp_comment</varname></term>
21868 <listitem>
21869 <para>
21870 These variables are only available if Exim is built with SPF support.
21871 For details see section <xref linkend="SECSPF"/>.
21872 </para>
21873 </listitem></varlistentry>
21874 <varlistentry>
21875 <term><varname>$spool_directory</varname></term>
21876 <listitem>
21877 <para>
21878 <indexterm role="variable">
21879 <primary><varname>$spool_directory</varname></primary>
21880 </indexterm>
21881 The name of Exim&#x2019;s spool directory.
21882 </para>
21883 </listitem></varlistentry>
21884 <varlistentry>
21885 <term><varname>$spool_inodes</varname></term>
21886 <listitem>
21887 <para>
21888 <indexterm role="variable">
21889 <primary><varname>$spool_inodes</varname></primary>
21890 </indexterm>
21891 The number of free inodes in the disk partition where Exim&#x2019;s spool files are
21892 being written. The value is recalculated whenever the variable is referenced.
21893 If the relevant file system does not have the concept of inodes, the value of
21894 is -1. See also the <option>check_spool_inodes</option> option.
21895 </para>
21896 </listitem></varlistentry>
21897 <varlistentry>
21898 <term><varname>$spool_space</varname></term>
21899 <listitem>
21900 <para>
21901 <indexterm role="variable">
21902 <primary><varname>$spool_space</varname></primary>
21903 </indexterm>
21904 The amount of free space (as a number of kilobytes) in the disk partition where
21905 Exim&#x2019;s spool files are being written. The value is recalculated whenever the
21906 variable is referenced. If the operating system does not have the ability to
21907 find the amount of free space (only true for experimental systems), the space
21908 value is -1. For example, to check in an ACL that there is at least 50
21909 megabytes free on the spool, you could write:
21910 </para>
21911 <literallayout class="monospaced">
21912 condition = ${if &gt; {$spool_space}{50000}}
21913 </literallayout>
21914 <para>
21915 See also the <option>check_spool_space</option> option.
21916 </para>
21917 </listitem></varlistentry>
21918 <varlistentry>
21919 <term><varname>$thisaddress</varname></term>
21920 <listitem>
21921 <para>
21922 <indexterm role="variable">
21923 <primary><varname>$thisaddress</varname></primary>
21924 </indexterm>
21925 This variable is set only during the processing of the <option>foranyaddress</option>
21926 command in a filter file. Its use is explained in the description of that
21927 command, which can be found in the separate document entitled <emphasis>Exim&#x2019;s
21928 interfaces to mail filtering</emphasis>.
21929 </para>
21930 </listitem></varlistentry>
21931 <varlistentry>
21932 <term><varname>$tls_in_bits</varname></term>
21933 <listitem>
21934 <para>
21935 <indexterm role="variable">
21936 <primary><varname>$tls_in_bits</varname></primary>
21937 </indexterm>
21938 Contains an approximation of the TLS cipher&#x2019;s bit-strength
21939 on the inbound connection; the meaning of
21940 this depends upon the TLS implementation used.
21941 If TLS has not been negotiated, the value will be 0.
21942 The value of this is automatically fed into the Cyrus SASL authenticator
21943 when acting as a server, to specify the "external SSF" (a SASL term).
21944 </para>
21945 <para>
21946 The deprecated <varname>$tls_bits</varname> variable refers to the inbound side
21947 except when used in the context of an outbound SMTP delivery, when it refers to
21948 the outbound.
21949 </para>
21950 </listitem></varlistentry>
21951 <varlistentry>
21952 <term><varname>$tls_out_bits</varname></term>
21953 <listitem>
21954 <para>
21955 <indexterm role="variable">
21956 <primary><varname>$tls_out_bits</varname></primary>
21957 </indexterm>
21958 Contains an approximation of the TLS cipher&#x2019;s bit-strength
21959 on an outbound SMTP connection; the meaning of
21960 this depends upon the TLS implementation used.
21961 If TLS has not been negotiated, the value will be 0.
21962 </para>
21963 </listitem></varlistentry>
21964 <varlistentry>
21965 <term><varname>$tls_in_ourcert</varname></term>
21966 <listitem>
21967 <para>
21968 <indexterm role="variable">
21969 <primary><varname>$tls_in_ourcert</varname></primary>
21970 </indexterm>
21971 <indexterm role="concept">
21972 <primary>certificate</primary>
21973 <secondary>variables</secondary>
21974 </indexterm>
21975 This variable refers to the certificate presented to the peer of an
21976 inbound connection when the message was received.
21977 It is only useful as the argument of a
21978 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
21979 or a <option>def</option> condition.
21980 </para>
21981 <para>
21982 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
21983 when a list of more than one
21984 file is used for <option>tls_certificate</option>, this variable is not reliable.
21985 The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions.
21986 </para>
21987 </listitem></varlistentry>
21988 <varlistentry>
21989 <term><varname>$tls_in_peercert</varname></term>
21990 <listitem>
21991 <para>
21992 <indexterm role="variable">
21993 <primary><varname>$tls_in_peercert</varname></primary>
21994 </indexterm>
21995 This variable refers to the certificate presented by the peer of an
21996 inbound connection when the message was received.
21997 It is only useful as the argument of a
21998 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
21999 or a <option>def</option> condition.
22000 If certificate verification fails it may refer to a failing chain element
22001 which is not the leaf.
22002 </para>
22003 </listitem></varlistentry>
22004 <varlistentry>
22005 <term><varname>$tls_out_ourcert</varname></term>
22006 <listitem>
22007 <para>
22008 <indexterm role="variable">
22009 <primary><varname>$tls_out_ourcert</varname></primary>
22010 </indexterm>
22011 This variable refers to the certificate presented to the peer of an
22012 outbound connection.  It is only useful as the argument of a
22013 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
22014 or a <option>def</option> condition.
22015 </para>
22016 </listitem></varlistentry>
22017 <varlistentry>
22018 <term><varname>$tls_out_peercert</varname></term>
22019 <listitem>
22020 <para>
22021 <indexterm role="variable">
22022 <primary><varname>$tls_out_peercert</varname></primary>
22023 </indexterm>
22024 This variable refers to the certificate presented by the peer of an
22025 outbound connection.  It is only useful as the argument of a
22026 <option>certextract</option> expansion item, <option>md5</option>, <option>sha1</option> or <option>sha256</option> operator,
22027 or a <option>def</option> condition.
22028 If certificate verification fails it may refer to a failing chain element
22029 which is not the leaf.
22030 </para>
22031 </listitem></varlistentry>
22032 <varlistentry>
22033 <term><varname>$tls_in_certificate_verified</varname></term>
22034 <listitem>
22035 <para>
22036 <indexterm role="variable">
22037 <primary><varname>$tls_in_certificate_verified</varname></primary>
22038 </indexterm>
22039 This variable is set to <quote>1</quote> if a TLS certificate was verified when the
22040 message was received, and <quote>0</quote> otherwise.
22041 </para>
22042 <para>
22043 The deprecated <varname>$tls_certificate_verified</varname> variable refers to the inbound side
22044 except when used in the context of an outbound SMTP delivery, when it refers to
22045 the outbound.
22046 </para>
22047 </listitem></varlistentry>
22048 <varlistentry>
22049 <term><varname>$tls_out_certificate_verified</varname></term>
22050 <listitem>
22051 <para>
22052 <indexterm role="variable">
22053 <primary><varname>$tls_out_certificate_verified</varname></primary>
22054 </indexterm>
22055 This variable is set to <quote>1</quote> if a TLS certificate was verified when an
22056 outbound SMTP connection was made,
22057 and <quote>0</quote> otherwise.
22058 </para>
22059 </listitem></varlistentry>
22060 <varlistentry>
22061 <term><varname>$tls_in_cipher</varname></term>
22062 <listitem>
22063 <para>
22064 <indexterm role="variable">
22065 <primary><varname>$tls_in_cipher</varname></primary>
22066 </indexterm>
22067 <indexterm role="variable">
22068 <primary><varname>$tls_cipher</varname></primary>
22069 </indexterm>
22070 When a message is received from a remote host over an encrypted SMTP
22071 connection, this variable is set to the cipher suite that was negotiated, for
22072 example DES-CBC3-SHA. In other circumstances, in particular, for message
22073 received over unencrypted connections, the variable is empty. Testing
22074 <varname>$tls_in_cipher</varname> for emptiness is one way of distinguishing between encrypted and
22075 non-encrypted connections during ACL processing.
22076 </para>
22077 <para>
22078 The deprecated <varname>$tls_cipher</varname> variable is the same as <varname>$tls_in_cipher</varname> during message reception,
22079 but in the context of an outward SMTP delivery taking place via the <command>smtp</command> transport
22080 becomes the same as <varname>$tls_out_cipher</varname>.
22081 </para>
22082 </listitem></varlistentry>
22083 <varlistentry>
22084 <term><varname>$tls_in_cipher_std</varname></term>
22085 <listitem>
22086 <para>
22087 <indexterm role="variable">
22088 <primary><varname>$tls_in_cipher_std</varname></primary>
22089 </indexterm>
22090 As above, but returning the RFC standard name for the cipher suite.
22091 </para>
22092 </listitem></varlistentry>
22093 <varlistentry>
22094 <term><varname>$tls_out_cipher</varname></term>
22095 <listitem>
22096 <para>
22097 <indexterm role="variable">
22098 <primary><varname>$tls_out_cipher</varname></primary>
22099 </indexterm>
22100 This variable is
22101 cleared before any outgoing SMTP connection is made,
22102 and then set to the outgoing cipher suite if one is negotiated. See chapter
22103 <xref linkend="CHAPTLS"/> for details of TLS support and chapter <xref linkend="CHAPsmtptrans"/> for
22104 details of the <command>smtp</command> transport.
22105 </para>
22106 </listitem></varlistentry>
22107 <varlistentry>
22108 <term><varname>$tls_out_cipher_std</varname></term>
22109 <listitem>
22110 <para>
22111 <indexterm role="variable">
22112 <primary><varname>$tls_out_cipher_std</varname></primary>
22113 </indexterm>
22114 As above, but returning the RFC standard name for the cipher suite.
22115 </para>
22116 </listitem></varlistentry>
22117 <varlistentry>
22118 <term><varname>$tls_out_dane</varname></term>
22119 <listitem>
22120 <para>
22121 <indexterm role="variable">
22122 <primary><varname>$tls_out_dane</varname></primary>
22123 </indexterm>
22124 DANE active status.  See section <xref linkend="SECDANE"/>.
22125 </para>
22126 </listitem></varlistentry>
22127 <varlistentry>
22128 <term><varname>$tls_in_ocsp</varname></term>
22129 <listitem>
22130 <para>
22131 <indexterm role="variable">
22132 <primary><varname>$tls_in_ocsp</varname></primary>
22133 </indexterm>
22134 When a message is received from a remote client connection
22135 the result of any OCSP request from the client is encoded in this variable:
22136 </para>
22137 <literallayout class="monospaced">
22138 0 OCSP proof was not requested (default value)
22139 1 No response to request
22140 2 Response not verified
22141 3 Verification failed
22142 4 Verification succeeded
22143 </literallayout>
22144 </listitem></varlistentry>
22145 <varlistentry>
22146 <term><varname>$tls_out_ocsp</varname></term>
22147 <listitem>
22148 <para>
22149 <indexterm role="variable">
22150 <primary><varname>$tls_out_ocsp</varname></primary>
22151 </indexterm>
22152 When a message is sent to a remote host connection
22153 the result of any OCSP request made is encoded in this variable.
22154 See <varname>$tls_in_ocsp</varname> for values.
22155 </para>
22156 </listitem></varlistentry>
22157 <varlistentry>
22158 <term><varname>$tls_in_peerdn</varname></term>
22159 <listitem>
22160 <para>
22161 <indexterm role="variable">
22162 <primary><varname>$tls_in_peerdn</varname></primary>
22163 </indexterm>
22164 <indexterm role="variable">
22165 <primary><varname>$tls_peerdn</varname></primary>
22166 </indexterm>
22167 <indexterm role="concept">
22168 <primary>certificate</primary>
22169 <secondary>extracting fields</secondary>
22170 </indexterm>
22171 When a message is received from a remote host over an encrypted SMTP
22172 connection, and Exim is configured to request a certificate from the client,
22173 the value of the Distinguished Name of the certificate is made available in the
22174 <varname>$tls_in_peerdn</varname> during subsequent processing.
22175 If certificate verification fails it may refer to a failing chain element
22176 which is not the leaf.
22177 </para>
22178 <para>
22179 The deprecated <varname>$tls_peerdn</varname> variable refers to the inbound side
22180 except when used in the context of an outbound SMTP delivery, when it refers to
22181 the outbound.
22182 </para>
22183 </listitem></varlistentry>
22184 <varlistentry>
22185 <term><varname>$tls_out_peerdn</varname></term>
22186 <listitem>
22187 <para>
22188 <indexterm role="variable">
22189 <primary><varname>$tls_out_peerdn</varname></primary>
22190 </indexterm>
22191 When a message is being delivered to a remote host over an encrypted SMTP
22192 connection, and Exim is configured to request a certificate from the server,
22193 the value of the Distinguished Name of the certificate is made available in the
22194 <varname>$tls_out_peerdn</varname> during subsequent processing.
22195 If certificate verification fails it may refer to a failing chain element
22196 which is not the leaf.
22197 </para>
22198 </listitem></varlistentry>
22199 <varlistentry>
22200 <term><varname>$tls_in_resumption</varname></term>
22201 <term><varname>$tls_out_resumption</varname></term>
22202 <listitem>
22203 <para>
22204 <indexterm role="variable">
22205 <primary><varname>$tls_in_resumption</varname></primary>
22206 </indexterm>
22207 <indexterm role="variable">
22208 <primary><varname>$tls_out_resumption</varname></primary>
22209 </indexterm>
22210 <indexterm role="concept">
22211 <primary>TLS</primary>
22212 <secondary>resumption</secondary>
22213 </indexterm>
22214 Observability for TLS session resumption.  See <xref linkend="SECTresumption"/> for details.
22215 </para>
22216 </listitem></varlistentry>
22217 <varlistentry>
22218 <term><varname>$tls_in_sni</varname></term>
22219 <listitem>
22220 <para>
22221 <indexterm role="variable">
22222 <primary><varname>$tls_in_sni</varname></primary>
22223 </indexterm>
22224 </para>
22225 <informaltable frame="none">
22226 <tgroup cols="1" colsep="0" rowsep="0">
22227 <colspec colwidth="10pt" align="left"/>
22228 <tbody>
22229 <row>
22230 <entry><emphasis>Tainted</emphasis></entry>
22231 </row>
22232 </tbody>
22233 </tgroup>
22234 </informaltable>
22235 <para>
22236 <indexterm role="variable">
22237 <primary><varname>$tls_sni</varname></primary>
22238 </indexterm>
22239 <indexterm role="concept">
22240 <primary>TLS</primary>
22241 <secondary>Server Name Indication</secondary>
22242 </indexterm>
22243 <indexterm role="concept">
22244 <primary>TLS</primary>
22245 <secondary>SNI</secondary>
22246 </indexterm>
22247 <indexterm role="concept">
22248 <primary>SNI</primary>
22249 <secondary>observability on server</secondary>
22250 </indexterm>
22251 When a TLS session is being established, if the client sends the Server
22252 Name Indication extension, the value will be placed in this variable.
22253 If the variable appears in <option>tls_certificate</option> then this option and
22254 some others, described in <xref linkend="SECTtlssni"/>,
22255 will be re-expanded early in the TLS session, to permit
22256 a different certificate to be presented (and optionally a different key to be
22257 used) to the client, based upon the value of the SNI extension.
22258 </para>
22259 <para>
22260 The deprecated <varname>$tls_sni</varname> variable refers to the inbound side
22261 except when used in the context of an outbound SMTP delivery, when it refers to
22262 the outbound.
22263 </para>
22264 </listitem></varlistentry>
22265 <varlistentry>
22266 <term><varname>$tls_out_sni</varname></term>
22267 <listitem>
22268 <para>
22269 <indexterm role="variable">
22270 <primary><varname>$tls_out_sni</varname></primary>
22271 </indexterm>
22272 <indexterm role="concept">
22273 <primary>TLS</primary>
22274 <secondary>Server Name Indication</secondary>
22275 </indexterm>
22276 <indexterm role="concept">
22277 <primary>TLS</primary>
22278 <secondary>SNI</secondary>
22279 </indexterm>
22280 <indexterm role="concept">
22281 <primary>SNI</primary>
22282 <secondary>observability in client</secondary>
22283 </indexterm>
22284 During outbound
22285 SMTP deliveries, this variable reflects the value of the <option>tls_sni</option> option on
22286 the transport.
22287 </para>
22288 </listitem></varlistentry>
22289 <varlistentry>
22290 <term><varname>$tls_out_tlsa_usage</varname></term>
22291 <listitem>
22292 <para>
22293 <indexterm role="variable">
22294 <primary><varname>$tls_out_tlsa_usage</varname></primary>
22295 </indexterm>
22296 Bitfield of TLSA record types found.  See section <xref linkend="SECDANE"/>.
22297 </para>
22298 </listitem></varlistentry>
22299 <varlistentry>
22300 <term><varname>$tls_in_ver</varname></term>
22301 <listitem>
22302 <para>
22303 <indexterm role="variable">
22304 <primary><varname>$tls_in_ver</varname></primary>
22305 </indexterm>
22306 When a message is received from a remote host over an encrypted SMTP connection
22307 this variable is set to the protocol version, eg <emphasis>TLS1.2</emphasis>.
22308 </para>
22309 </listitem></varlistentry>
22310 <varlistentry>
22311 <term><varname>$tls_out_ver</varname></term>
22312 <listitem>
22313 <para>
22314 <indexterm role="variable">
22315 <primary><varname>$tls_out_ver</varname></primary>
22316 </indexterm>
22317 When a message is being delivered to a remote host over an encrypted SMTP connection
22318 this variable is set to the protocol version.
22319 </para>
22320 </listitem></varlistentry>
22321 <varlistentry>
22322 <term><varname>$tod_bsdinbox</varname></term>
22323 <listitem>
22324 <para>
22325 <indexterm role="variable">
22326 <primary><varname>$tod_bsdinbox</varname></primary>
22327 </indexterm>
22328 The time of day and the date, in the format required for BSD-style mailbox
22329 files, for example: Thu Oct 17 17:14:09 1995.
22330 </para>
22331 </listitem></varlistentry>
22332 <varlistentry>
22333 <term><varname>$tod_epoch</varname></term>
22334 <listitem>
22335 <para>
22336 <indexterm role="variable">
22337 <primary><varname>$tod_epoch</varname></primary>
22338 </indexterm>
22339 The time and date as a number of seconds since the start of the Unix epoch.
22340 </para>
22341 </listitem></varlistentry>
22342 <varlistentry>
22343 <term><varname>$tod_epoch_l</varname></term>
22344 <listitem>
22345 <para>
22346 <indexterm role="variable">
22347 <primary><varname>$tod_epoch_l</varname></primary>
22348 </indexterm>
22349 The time and date as a number of microseconds since the start of the Unix epoch.
22350 </para>
22351 </listitem></varlistentry>
22352 <varlistentry>
22353 <term><varname>$tod_full</varname></term>
22354 <listitem>
22355 <para>
22356 <indexterm role="variable">
22357 <primary><varname>$tod_full</varname></primary>
22358 </indexterm>
22359 A full version of the time and date, for example: Wed, 16 Oct 1995 09:51:40
22360 +0100. The timezone is always given as a numerical offset from UTC, with
22361 positive values used for timezones that are ahead (east) of UTC, and negative
22362 values for those that are behind (west).
22363 </para>
22364 </listitem></varlistentry>
22365 <varlistentry>
22366 <term><varname>$tod_log</varname></term>
22367 <listitem>
22368 <para>
22369 <indexterm role="variable">
22370 <primary><varname>$tod_log</varname></primary>
22371 </indexterm>
22372 The time and date in the format used for writing Exim&#x2019;s log files, for example:
22373 1995-10-12 15:32:29, but without a timezone.
22374 </para>
22375 </listitem></varlistentry>
22376 <varlistentry>
22377 <term><varname>$tod_logfile</varname></term>
22378 <listitem>
22379 <para>
22380 <indexterm role="variable">
22381 <primary><varname>$tod_logfile</varname></primary>
22382 </indexterm>
22383 This variable contains the date in the format yyyymmdd. This is the format that
22384 is used for datestamping log files when <option>log_file_path</option> contains the <literal>%D</literal>
22385 flag.
22386 </para>
22387 </listitem></varlistentry>
22388 <varlistentry>
22389 <term><varname>$tod_zone</varname></term>
22390 <listitem>
22391 <para>
22392 <indexterm role="variable">
22393 <primary><varname>$tod_zone</varname></primary>
22394 </indexterm>
22395 This variable contains the numerical value of the local timezone, for example:
22396 -0500.
22397 </para>
22398 </listitem></varlistentry>
22399 <varlistentry>
22400 <term><varname>$tod_zulu</varname></term>
22401 <listitem>
22402 <para>
22403 <indexterm role="variable">
22404 <primary><varname>$tod_zulu</varname></primary>
22405 </indexterm>
22406 This variable contains the UTC date and time in <quote>Zulu</quote> format, as specified
22407 by ISO 8601, for example: 20030221154023Z.
22408 </para>
22409 </listitem></varlistentry>
22410 <varlistentry>
22411 <term><varname>$transport_name</varname></term>
22412 <listitem>
22413 <para>
22414 <indexterm role="concept">
22415 <primary>transport</primary>
22416 <secondary>name</secondary>
22417 </indexterm>
22418 <indexterm role="concept">
22419 <primary>name</primary>
22420 <secondary>of transport</secondary>
22421 </indexterm>
22422 <indexterm role="variable">
22423 <primary><varname>$transport_name</varname></primary>
22424 </indexterm>
22425 During the running of a transport, this variable contains its name.
22426 </para>
22427 </listitem></varlistentry>
22428 <varlistentry>
22429 <term><varname>$value</varname></term>
22430 <listitem>
22431 <para>
22432 <indexterm role="variable">
22433 <primary><varname>$value</varname></primary>
22434 </indexterm>
22435 This variable contains the result of an expansion lookup, extraction operation,
22436 or external command, as described above. It is also used during a
22437 <emphasis role="bold">reduce</emphasis> expansion.
22438 </para>
22439 </listitem></varlistentry>
22440 <varlistentry>
22441 <term><varname>$verify_mode</varname></term>
22442 <listitem>
22443 <para>
22444 <indexterm role="variable">
22445 <primary><varname>$verify_mode</varname></primary>
22446 </indexterm>
22447 While a router or transport is being run in verify mode or for cutthrough delivery,
22448 contains "S" for sender-verification or "R" for recipient-verification.
22449 Otherwise, empty.
22450 </para>
22451 </listitem></varlistentry>
22452 <varlistentry>
22453 <term><varname>$version_number</varname></term>
22454 <listitem>
22455 <para>
22456 <indexterm role="variable">
22457 <primary><varname>$version_number</varname></primary>
22458 </indexterm>
22459 The version number of Exim. Same as <varname>$exim_version</varname>, may be overridden
22460 by the <option>exim_version</option> main config option.
22461 </para>
22462 </listitem></varlistentry>
22463 <varlistentry>
22464 <term><varname>$warn_message_delay</varname></term>
22465 <listitem>
22466 <para>
22467 <indexterm role="variable">
22468 <primary><varname>$warn_message_delay</varname></primary>
22469 </indexterm>
22470 This variable is set only during the creation of a message warning about a
22471 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
22472 </para>
22473 </listitem></varlistentry>
22474 <varlistentry>
22475 <term><varname>$warn_message_recipients</varname></term>
22476 <listitem>
22477 <para>
22478 <indexterm role="variable">
22479 <primary><varname>$warn_message_recipients</varname></primary>
22480 </indexterm>
22481 This variable is set only during the creation of a message warning about a
22482 delivery delay. Details of its use are explained in section <xref linkend="SECTcustwarn"/>.
22483 </para>
22484 </listitem></varlistentry>
22485 </variablelist>
22486 <para>
22487 <indexterm role="concept" startref="IIDstrexp" class="endofrange"/>
22488 </para>
22489 </section>
22490 </chapter>
22491
22492 <chapter id="CHAPperl">
22493 <title>Embedded Perl</title>
22494 <para>
22495 <indexterm role="concept" id="IIDperl" class="startofrange">
22496 <primary>Perl</primary>
22497 <secondary>calling from Exim</secondary>
22498 </indexterm>
22499 Exim can be built to include an embedded Perl interpreter. When this is done,
22500 Perl subroutines can be called as part of the string expansion process. To make
22501 use of the Perl support, you need version 5.004 or later of Perl installed on
22502 your system. To include the embedded interpreter in the Exim binary, include
22503 the line
22504 </para>
22505 <literallayout class="monospaced">
22506 EXIM_PERL = perl.o
22507 </literallayout>
22508 <para>
22509 in your <filename>Local/Makefile</filename> and then build Exim in the normal way.
22510 </para>
22511 <section id="SECID85">
22512 <title>Setting up so Perl can be used</title>
22513 <para>
22514 <indexterm role="option">
22515 <primary><option>perl_startup</option></primary>
22516 </indexterm>
22517 Access to Perl subroutines is via a global configuration option called
22518 <option>perl_startup</option> and an expansion string operator <option>${perl ...}</option>. If there is
22519 no <option>perl_startup</option> option in the Exim configuration file then no Perl
22520 interpreter is started and there is almost no overhead for Exim (since none of
22521 the Perl library will be paged in unless used). If there is a <option>perl_startup</option>
22522 option then the associated value is taken to be Perl code which is executed in
22523 a newly created Perl interpreter.
22524 </para>
22525 <para>
22526 The value of <option>perl_startup</option> is not expanded in the Exim sense, so you do not
22527 need backslashes before any characters to escape special meanings. The option
22528 should usually be something like
22529 </para>
22530 <literallayout class="monospaced">
22531 perl_startup = do '/etc/exim.pl'
22532 </literallayout>
22533 <para>
22534 where <filename>/etc/exim.pl</filename> is Perl code which defines any subroutines you want to
22535 use from Exim. Exim can be configured either to start up a Perl interpreter as
22536 soon as it is entered, or to wait until the first time it is needed. Starting
22537 the interpreter at the beginning ensures that it is done while Exim still has
22538 its setuid privilege, but can impose an unnecessary overhead if Perl is not in
22539 fact used in a particular run. Also, note that this does not mean that Exim is
22540 necessarily running as root when Perl is called at a later time. By default,
22541 the interpreter is started only when it is needed, but this can be changed in
22542 two ways:
22543 </para>
22544 <itemizedlist>
22545 <listitem>
22546 <para>
22547 <indexterm role="option">
22548 <primary><option>perl_at_start</option></primary>
22549 </indexterm>
22550 Setting <option>perl_at_start</option> (a boolean option) in the configuration requests
22551 a startup when Exim is entered.
22552 </para>
22553 </listitem>
22554 <listitem>
22555 <para>
22556 The command line option <option>-ps</option> also requests a startup when Exim is entered,
22557 overriding the setting of <option>perl_at_start</option>.
22558 </para>
22559 </listitem>
22560 </itemizedlist>
22561 <para>
22562 There is also a command line option <option>-pd</option> (for delay) which suppresses the
22563 initial startup, even if <option>perl_at_start</option> is set.
22564 </para>
22565 <itemizedlist>
22566 <listitem>
22567 <para>
22568 <indexterm role="option">
22569 <primary><option>perl_taintmode</option></primary>
22570 </indexterm>
22571 <indexterm role="concept">
22572 <primary>Perl</primary>
22573 <secondary>taintmode</secondary>
22574 </indexterm>
22575 To provide more security executing Perl code via the embedded Perl
22576 interpreter, the <option>perl_taintmode</option> option can be set. This enables the
22577 taint mode of the Perl interpreter. You are encouraged to set this
22578 option to a true value. To avoid breaking existing installations, it
22579 defaults to false.
22580 </para>
22581 <para>
22582 <emphasis role="bold">Note</emphasis>: This is entirely separate from Exim&#x2019;s tainted-data tracking.
22583 </para>
22584 </listitem>
22585 </itemizedlist>
22586 </section>
22587 <section id="SECID86">
22588 <title>Calling Perl subroutines</title>
22589 <para>
22590 When the configuration file includes a <option>perl_startup</option> option you can make use
22591 of the string expansion item to call the Perl subroutines that are defined
22592 by the <option>perl_startup</option> code. The operator is used in any of the following
22593 forms:
22594 </para>
22595 <literallayout class="monospaced">
22596 ${perl{foo}}
22597 ${perl{foo}{argument}}
22598 ${perl{foo}{argument1}{argument2} ... }
22599 </literallayout>
22600 <para>
22601 which calls the subroutine <option>foo</option> with the given arguments. A maximum of eight
22602 arguments may be passed. Passing more than this results in an expansion failure
22603 with an error message of the form
22604 </para>
22605 <literallayout class="monospaced">
22606 Too many arguments passed to Perl subroutine "foo" (max is 8)
22607 </literallayout>
22608 <para>
22609 The return value of the Perl subroutine is evaluated in a scalar context before
22610 it is passed back to Exim to be inserted into the expanded string. If the
22611 return value is <emphasis>undef</emphasis>, the expansion is forced to fail in the same way as
22612 an explicit <quote>fail</quote> on an <option>if</option> or <option>lookup</option> item. If the subroutine aborts
22613 by obeying Perl&#x2019;s <option>die</option> function, the expansion fails with the error message
22614 that was passed to <option>die</option>.
22615 </para>
22616 </section>
22617 <section id="SECID87">
22618 <title>Calling Exim functions from Perl</title>
22619 <para>
22620 Within any Perl code called from Exim, the function <emphasis>Exim::expand_string()</emphasis>
22621 is available to call back into Exim&#x2019;s string expansion function. For example,
22622 the Perl code
22623 </para>
22624 <literallayout class="monospaced">
22625 my $lp = Exim::expand_string('$local_part');
22626 </literallayout>
22627 <para>
22628 makes the current Exim <varname>$local_part</varname> available in the Perl variable <varname>$lp</varname>.
22629 Note those are single quotes and not double quotes to protect against
22630 <varname>$local_part</varname> being interpolated as a Perl variable.
22631 </para>
22632 <para>
22633 If the string expansion is forced to fail by a <quote>fail</quote> item, the result of
22634 <emphasis>Exim::expand_string()</emphasis> is <option>undef</option>. If there is a syntax error in the
22635 expansion string, the Perl call from the original expansion string fails with
22636 an appropriate error message, in the same way as if <option>die</option> were used.
22637 </para>
22638 <para>
22639 <indexterm role="concept">
22640 <primary>debugging</primary>
22641 <secondary>from embedded Perl</secondary>
22642 </indexterm>
22643 <indexterm role="concept">
22644 <primary>log</primary>
22645 <secondary>writing from embedded Perl</secondary>
22646 </indexterm>
22647 Two other Exim functions are available for use from within Perl code.
22648 <emphasis>Exim::debug_write()</emphasis> writes a string to the standard error stream if Exim&#x2019;s
22649 debugging is enabled. If you want a newline at the end, you must supply it.
22650 <emphasis>Exim::log_write()</emphasis> writes a string to Exim&#x2019;s main log, adding a leading
22651 timestamp. In this case, you should not supply a terminating newline.
22652 </para>
22653 </section>
22654 <section id="SECID88">
22655 <title>Use of standard output and error by Perl</title>
22656 <para>
22657 <indexterm role="concept">
22658 <primary>Perl</primary>
22659 <secondary>standard output and error</secondary>
22660 </indexterm>
22661 You should not write to the standard error or output streams from within your
22662 Perl code, as it is not defined how these are set up. In versions of Exim
22663 before 4.50, it is possible for the standard output or error to refer to the
22664 SMTP connection during message reception via the daemon. Writing to this stream
22665 is certain to cause chaos. From Exim 4.50 onwards, the standard output and
22666 error streams are connected to <filename>/dev/null</filename> in the daemon. The chaos is
22667 avoided, but the output is lost.
22668 </para>
22669 <para>
22670 <indexterm role="concept">
22671 <primary>Perl</primary>
22672 <secondary>use of <option>warn</option></secondary>
22673 </indexterm>
22674 The Perl <option>warn</option> statement writes to the standard error stream by default.
22675 Calls to <option>warn</option> may be embedded in Perl modules that you use, but over which
22676 you have no control. When Exim starts up the Perl interpreter, it arranges for
22677 output from the <option>warn</option> statement to be written to the Exim main log. You can
22678 change this by including appropriate Perl magic somewhere in your Perl code.
22679 For example, to discard <option>warn</option> output completely, you need this:
22680 </para>
22681 <literallayout class="monospaced">
22682 $SIG{__WARN__} = sub { };
22683 </literallayout>
22684 <para>
22685 Whenever a <option>warn</option> is obeyed, the anonymous subroutine is called. In this
22686 example, the code for the subroutine is empty, so it does nothing, but you can
22687 include any Perl code that you like. The text of the <option>warn</option> message is passed
22688 as the first subroutine argument.
22689 <indexterm role="concept" startref="IIDperl" class="endofrange"/>
22690 </para>
22691 </section>
22692 </chapter>
22693
22694 <chapter id="CHAPinterfaces">
22695 <title>Starting the daemon and the use of network interfaces</title>
22696 <titleabbrev>Starting the daemon</titleabbrev>
22697 <para>
22698 <indexterm role="concept">
22699 <primary>daemon</primary>
22700 <secondary>starting</secondary>
22701 </indexterm>
22702 <indexterm role="concept">
22703 <primary>interface</primary>
22704 <secondary>listening</secondary>
22705 </indexterm>
22706 <indexterm role="concept">
22707 <primary>network interface</primary>
22708 </indexterm>
22709 <indexterm role="concept">
22710 <primary>interface</primary>
22711 <secondary>network</secondary>
22712 </indexterm>
22713 <indexterm role="concept">
22714 <primary>IP address</primary>
22715 <secondary>for listening</secondary>
22716 </indexterm>
22717 <indexterm role="concept">
22718 <primary>daemon</primary>
22719 <secondary>listening IP addresses</secondary>
22720 </indexterm>
22721 <indexterm role="concept">
22722 <primary>TCP/IP</primary>
22723 <secondary>setting listening interfaces</secondary>
22724 </indexterm>
22725 <indexterm role="concept">
22726 <primary>TCP/IP</primary>
22727 <secondary>setting listening ports</secondary>
22728 </indexterm>
22729 A host that is connected to a TCP/IP network may have one or more physical
22730 hardware network interfaces. Each of these interfaces may be configured as one
22731 or more <quote>logical</quote> interfaces, which are the entities that a program actually
22732 works with. Each of these logical interfaces is associated with an IP address.
22733 In addition, TCP/IP software supports <quote>loopback</quote> interfaces (127.0.0.1 in
22734 IPv4 and ::1 in IPv6), which do not use any physical hardware. Exim requires
22735 knowledge about the host&#x2019;s interfaces for use in three different circumstances:
22736 </para>
22737 <orderedlist numeration="arabic">
22738 <listitem>
22739 <para>
22740 When a listening daemon is started, Exim needs to know which interfaces
22741 and ports to listen on.
22742 </para>
22743 </listitem>
22744 <listitem>
22745 <para>
22746 When Exim is routing an address, it needs to know which IP addresses
22747 are associated with local interfaces. This is required for the correct
22748 processing of MX lists by removing the local host and others with the
22749 same or higher priority values. Also, Exim needs to detect cases
22750 when an address is routed to an IP address that in fact belongs to the
22751 local host. Unless the <option>self</option> router option or the <option>allow_localhost</option>
22752 option of the smtp transport is set (as appropriate), this is treated
22753 as an error situation.
22754 </para>
22755 </listitem>
22756 <listitem>
22757 <para>
22758 When Exim connects to a remote host, it may need to know which interface to use
22759 for the outgoing connection.
22760 </para>
22761 </listitem>
22762 </orderedlist>
22763 <para>
22764 Exim&#x2019;s default behaviour is likely to be appropriate in the vast majority
22765 of cases. If your host has only one interface, and you want all its IP
22766 addresses to be treated in the same way, and you are using only the
22767 standard SMTP port, you should not need to take any special action. The
22768 rest of this chapter does not apply to you.
22769 </para>
22770 <para>
22771 In a more complicated situation you may want to listen only on certain
22772 interfaces, or on different ports, and for this reason there are a number of
22773 options that can be used to influence Exim&#x2019;s behaviour. The rest of this
22774 chapter describes how they operate.
22775 </para>
22776 <para>
22777 When a message is received over TCP/IP, the interface and port that were
22778 actually used are set in <varname>$received_ip_address</varname> and <varname>$received_port</varname>.
22779 </para>
22780 <section id="SECID89">
22781 <title>Starting a listening daemon</title>
22782 <para>
22783 When a listening daemon is started (by means of the <option>-bd</option> command line
22784 option), the interfaces and ports on which it listens are controlled by the
22785 following options:
22786 </para>
22787 <itemizedlist>
22788 <listitem>
22789 <para>
22790 <option>daemon_smtp_ports</option> contains a list of default ports
22791 or service names.
22792 (For backward compatibility, this option can also be specified in the singular.)
22793 </para>
22794 </listitem>
22795 <listitem>
22796 <para>
22797 <option>local_interfaces</option> contains list of interface IP addresses on which to
22798 listen. Each item may optionally also specify a port.
22799 </para>
22800 </listitem>
22801 </itemizedlist>
22802 <para>
22803 The default list separator in both cases is a colon, but this can be changed as
22804 described in section <xref linkend="SECTlistsepchange"/>. When IPv6 addresses are involved,
22805 it is usually best to change the separator to avoid having to double all the
22806 colons. For example:
22807 </para>
22808 <literallayout class="monospaced">
22809 local_interfaces = &lt;; 127.0.0.1 ; \
22810                       192.168.23.65 ; \
22811                       ::1 ; \
22812                       3ffe:ffff:836f::fe86:a061
22813 </literallayout>
22814 <para>
22815 There are two different formats for specifying a port along with an IP address
22816 in <option>local_interfaces</option>:
22817 </para>
22818 <orderedlist numeration="arabic">
22819 <listitem>
22820 <para>
22821 The port is added onto the address with a dot separator. For example, to listen
22822 on port 1234 on two different IP addresses:
22823 </para>
22824 <literallayout class="monospaced">
22825 local_interfaces = &lt;; 192.168.23.65.1234 ; \
22826                       3ffe:ffff:836f::fe86:a061.1234
22827 </literallayout>
22828 </listitem>
22829 <listitem>
22830 <para>
22831 The IP address is enclosed in square brackets, and the port is added
22832 with a colon separator, for example:
22833 </para>
22834 <literallayout class="monospaced">
22835 local_interfaces = &lt;; [192.168.23.65]:1234 ; \
22836                       [3ffe:ffff:836f::fe86:a061]:1234
22837 </literallayout>
22838 </listitem>
22839 </orderedlist>
22840 <para>
22841 When a port is not specified, the value of <option>daemon_smtp_ports</option> is used. The
22842 default setting contains just one port:
22843 </para>
22844 <literallayout class="monospaced">
22845 daemon_smtp_ports = smtp
22846 </literallayout>
22847 <para>
22848 If more than one port is listed, each interface that does not have its own port
22849 specified listens on all of them. Ports that are listed in
22850 <option>daemon_smtp_ports</option> can be identified either by name (defined in
22851 <filename>/etc/services</filename>) or by number. However, when ports are given with individual
22852 IP addresses in <option>local_interfaces</option>, only numbers (not names) can be used.
22853 </para>
22854 </section>
22855 <section id="SECID90">
22856 <title>Special IP listening addresses</title>
22857 <para>
22858 The addresses 0.0.0.0 and ::0 are treated specially. They are interpreted
22859 as <quote>all IPv4 interfaces</quote> and <quote>all IPv6 interfaces</quote>, respectively. In each
22860 case, Exim tells the TCP/IP stack to <quote>listen on all IPv<emphasis>x</emphasis> interfaces</quote>
22861 instead of setting up separate listening sockets for each interface. The
22862 default value of <option>local_interfaces</option> is
22863 </para>
22864 <literallayout class="monospaced">
22865 local_interfaces = 0.0.0.0
22866 </literallayout>
22867 <para>
22868 when Exim is built without IPv6 support; otherwise it is:
22869 </para>
22870 <literallayout class="monospaced">
22871 local_interfaces = &lt;; ::0 ; 0.0.0.0
22872 </literallayout>
22873 <para>
22874 Thus, by default, Exim listens on all available interfaces, on the SMTP port.
22875 </para>
22876 </section>
22877 <section id="SECID91">
22878 <title>Overriding local_interfaces and daemon_smtp_ports</title>
22879 <para>
22880 The <option>-oX</option> command line option can be used to override the values of
22881 <option>daemon_smtp_ports</option> and/or <option>local_interfaces</option> for a particular daemon
22882 instance. Another way of doing this would be to use macros and the <option>-D</option>
22883 option. However, <option>-oX</option> can be used by any admin user, whereas modification of
22884 the runtime configuration by <option>-D</option> is allowed only when the caller is root or
22885 exim.
22886 </para>
22887 <para>
22888 The value of <option>-oX</option> is a list of items. The default colon separator can be
22889 changed in the usual way (<xref linkend="SECTlistsepchange"/>) if required.
22890 If there are any items that do not
22891 contain dots or colons (that is, are not IP addresses), the value of
22892 <option>daemon_smtp_ports</option> is replaced by the list of those items. If there are any
22893 items that do contain dots or colons, the value of <option>local_interfaces</option> is
22894 replaced by those items. Thus, for example,
22895 </para>
22896 <literallayout class="monospaced">
22897 -oX 1225
22898 </literallayout>
22899 <para>
22900 overrides <option>daemon_smtp_ports</option>, but leaves <option>local_interfaces</option> unchanged,
22901 whereas
22902 </para>
22903 <literallayout class="monospaced">
22904 -oX 192.168.34.5.1125
22905 </literallayout>
22906 <para>
22907 overrides <option>local_interfaces</option>, leaving <option>daemon_smtp_ports</option> unchanged.
22908 (However, since <option>local_interfaces</option> now contains no items without ports, the
22909 value of <option>daemon_smtp_ports</option> is no longer relevant in this example.)
22910 </para>
22911 </section>
22912 <section id="SECTsupobssmt">
22913 <title>Support for the submissions (aka SSMTP or SMTPS) protocol</title>
22914 <para>
22915 <indexterm role="concept">
22916 <primary>submissions protocol</primary>
22917 </indexterm>
22918 <indexterm role="concept">
22919 <primary>ssmtp protocol</primary>
22920 </indexterm>
22921 <indexterm role="concept">
22922 <primary>smtps protocol</primary>
22923 </indexterm>
22924 <indexterm role="concept">
22925 <primary>SMTP</primary>
22926 <secondary>ssmtp protocol</secondary>
22927 </indexterm>
22928 <indexterm role="concept">
22929 <primary>SMTP</primary>
22930 <secondary>smtps protocol</secondary>
22931 </indexterm>
22932 Exim supports the use of TLS-on-connect, used by mail clients in the
22933 <quote>submissions</quote> protocol, historically also known as SMTPS or SSMTP.
22934 For some years, IETF Standards Track documents only blessed the
22935 STARTTLS-based Submission service (port 587) while common practice was to support
22936 the same feature set on port 465, but using TLS-on-connect.
22937 If your installation needs to provide service to mail clients
22938 (Mail User Agents, MUAs) then you should provide service on both the 587 and
22939 the 465 TCP ports.
22940 </para>
22941 <para>
22942 If the <option>tls_on_connect_ports</option> option is set to a list of port numbers or
22943 service names, connections to those ports must first establish TLS, before
22944 proceeding to the application layer use of the SMTP protocol.
22945 </para>
22946 <para>
22947 The common use of this option is expected to be
22948 </para>
22949 <literallayout class="monospaced">
22950 tls_on_connect_ports = 465
22951 </literallayout>
22952 <para>
22953 per RFC 8314.
22954 There is also a command line option <option>-tls-on-connect</option>, which forces all ports
22955 to behave in this way when a daemon is started.
22956 </para>
22957 <para>
22958 <emphasis role="bold">Warning</emphasis>: Setting <option>tls_on_connect_ports</option> does not of itself cause the
22959 daemon to listen on those ports. You must still specify them in
22960 <option>daemon_smtp_ports</option>, <option>local_interfaces</option>, or the <option>-oX</option> option. (This is
22961 because <option>tls_on_connect_ports</option> applies to <option>inetd</option> connections as well as to
22962 connections via the daemon.)
22963 </para>
22964 </section>
22965 <section id="SECID92">
22966 <title>IPv6 address scopes</title>
22967 <para>
22968 <indexterm role="concept">
22969 <primary>IPv6</primary>
22970 <secondary>address scopes</secondary>
22971 </indexterm>
22972 IPv6 addresses have <quote>scopes</quote>, and a host with multiple hardware interfaces
22973 can, in principle, have the same link-local IPv6 address on different
22974 interfaces. Thus, additional information is needed, over and above the IP
22975 address, to distinguish individual interfaces. A convention of using a
22976 percent sign followed by something (often the interface name) has been
22977 adopted in some cases, leading to addresses like this:
22978 </para>
22979 <literallayout class="monospaced">
22980 fe80::202:b3ff:fe03:45c1%eth0
22981 </literallayout>
22982 <para>
22983 To accommodate this usage, a percent sign followed by an arbitrary string is
22984 allowed at the end of an IPv6 address. By default, Exim calls <function>getaddrinfo()</function>
22985 to convert a textual IPv6 address for actual use. This function recognizes the
22986 percent convention in operating systems that support it, and it processes the
22987 address appropriately. Unfortunately, some older libraries have problems with
22988 <function>getaddrinfo()</function>. If
22989 </para>
22990 <literallayout class="monospaced">
22991 IPV6_USE_INET_PTON=yes
22992 </literallayout>
22993 <para>
22994 is set in <filename>Local/Makefile</filename> (or an OS-dependent Makefile) when Exim is built,
22995 Exim uses <emphasis>inet_pton()</emphasis> to convert a textual IPv6 address for actual use,
22996 instead of <function>getaddrinfo()</function>. (Before version 4.14, it always used this
22997 function.) Of course, this means that the additional functionality of
22998 <function>getaddrinfo()</function> &ndash; recognizing scoped addresses &ndash; is lost.
22999 </para>
23000 </section>
23001 <section id="SECID93">
23002 <title>Disabling IPv6</title>
23003 <para>
23004 <indexterm role="concept">
23005 <primary>IPv6</primary>
23006 <secondary>disabling</secondary>
23007 </indexterm>
23008 Sometimes it happens that an Exim binary that was compiled with IPv6 support is
23009 run on a host whose kernel does not support IPv6. The binary will fall back to
23010 using IPv4, but it may waste resources looking up AAAA records, and trying to
23011 connect to IPv6 addresses, causing delays to mail delivery. If you set the
23012 <indexterm role="option">
23013 <primary><option>disable_ipv6</option></primary>
23014 </indexterm>
23015 <option>disable_ipv6</option> option true, even if the Exim binary has IPv6 support, no IPv6
23016 activities take place. AAAA records are never looked up, and any IPv6 addresses
23017 that are listed in <option>local_interfaces</option>, data for the <command>manualroute</command> router,
23018 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
23019 to handle IPv6 literal addresses.
23020 </para>
23021 <para>
23022 On the other hand, when IPv6 is in use, there may be times when you want to
23023 disable it for certain hosts or domains. You can use the <option>dns_ipv4_lookup</option>
23024 option to globally suppress the lookup of AAAA records for specified domains,
23025 and you can use the <option>ignore_target_hosts</option> generic router option to ignore
23026 IPv6 addresses in an individual router.
23027 </para>
23028 </section>
23029 <section id="SECID94">
23030 <title>Examples of starting a listening daemon</title>
23031 <para>
23032 The default case in an IPv6 environment is
23033 </para>
23034 <literallayout class="monospaced">
23035 daemon_smtp_ports = smtp
23036 local_interfaces = &lt;; ::0 ; 0.0.0.0
23037 </literallayout>
23038 <para>
23039 This specifies listening on the smtp port on all IPv6 and IPv4 interfaces.
23040 Either one or two sockets may be used, depending on the characteristics of
23041 the TCP/IP stack. (This is complicated and messy; for more information,
23042 read the comments in the <filename>daemon.c</filename> source file.)
23043 </para>
23044 <para>
23045 To specify listening on ports 25 and 26 on all interfaces:
23046 </para>
23047 <literallayout class="monospaced">
23048 daemon_smtp_ports = 25 : 26
23049 </literallayout>
23050 <para>
23051 (leaving <option>local_interfaces</option> at the default setting) or, more explicitly:
23052 </para>
23053 <literallayout class="monospaced">
23054 local_interfaces = &lt;; ::0.25     ; ::0.26 \
23055                       0.0.0.0.25 ; 0.0.0.0.26
23056 </literallayout>
23057 <para>
23058 To listen on the default port on all IPv4 interfaces, and on port 26 on the
23059 IPv4 loopback address only:
23060 </para>
23061 <literallayout class="monospaced">
23062 local_interfaces = 0.0.0.0 : 127.0.0.1.26
23063 </literallayout>
23064 <para>
23065 To specify listening on the default port on specific interfaces only:
23066 </para>
23067 <literallayout class="monospaced">
23068 local_interfaces = 10.0.0.67 : 192.168.34.67
23069 </literallayout>
23070 <para>
23071 <emphasis role="bold">Warning</emphasis>: Such a setting excludes listening on the loopback interfaces.
23072 </para>
23073 </section>
23074 <section id="SECTreclocipadd">
23075 <title>Recognizing the local host</title>
23076 <para>
23077 The <option>local_interfaces</option> option is also used when Exim needs to determine
23078 whether or not an IP address refers to the local host. That is, the IP
23079 addresses of all the interfaces on which a daemon is listening are always
23080 treated as local.
23081 </para>
23082 <para>
23083 For this usage, port numbers in <option>local_interfaces</option> are ignored. If either of
23084 the items 0.0.0.0 or ::0 are encountered, Exim gets a complete list of
23085 available interfaces from the operating system, and extracts the relevant
23086 (that is, IPv4 or IPv6) addresses to use for checking.
23087 </para>
23088 <para>
23089 Some systems set up large numbers of virtual interfaces in order to provide
23090 many virtual web servers. In this situation, you may want to listen for
23091 email on only a few of the available interfaces, but nevertheless treat all
23092 interfaces as local when routing. You can do this by setting
23093 <option>extra_local_interfaces</option> to a list of IP addresses, possibly including the
23094 <quote>all</quote> wildcard values. These addresses are recognized as local, but are not
23095 used for listening. Consider this example:
23096 </para>
23097 <literallayout class="monospaced">
23098 local_interfaces = &lt;; 127.0.0.1 ; ::1 ; \
23099                       192.168.53.235 ; \
23100                       3ffe:2101:12:1:a00:20ff:fe86:a061
23101
23102 extra_local_interfaces = &lt;; ::0 ; 0.0.0.0
23103 </literallayout>
23104 <para>
23105 The daemon listens on the loopback interfaces and just one IPv4 and one IPv6
23106 address, but all available interface addresses are treated as local when
23107 Exim is routing.
23108 </para>
23109 <para>
23110 In some environments the local host name may be in an MX list, but with an IP
23111 address that is not assigned to any local interface. In other cases it may be
23112 desirable to treat other host names as if they referred to the local host. Both
23113 these cases can be handled by setting the <option>hosts_treat_as_local</option> option.
23114 This contains host names rather than IP addresses. When a host is referenced
23115 during routing, either via an MX record or directly, it is treated as the local
23116 host if its name matches <option>hosts_treat_as_local</option>, or if any of its IP
23117 addresses match <option>local_interfaces</option> or <option>extra_local_interfaces</option>.
23118 </para>
23119 </section>
23120 <section id="SECID95">
23121 <title>Delivering to a remote host</title>
23122 <para>
23123 Delivery to a remote host is handled by the smtp transport. By default, it
23124 allows the system&#x2019;s TCP/IP functions to choose which interface to use (if
23125 there is more than one) when connecting to a remote host. However, the
23126 <option>interface</option> option can be set to specify which interface is used. See the
23127 description of the smtp transport in chapter <xref linkend="CHAPsmtptrans"/> for more
23128 details.
23129 </para>
23130 </section>
23131 </chapter>
23132
23133 <chapter id="CHAPmainconfig">
23134 <title>Main configuration</title>
23135 <para>
23136 <indexterm role="concept" id="IIDconfima" class="startofrange">
23137 <primary>configuration file</primary>
23138 <secondary>main section</secondary>
23139 </indexterm>
23140 <indexterm role="concept" id="IIDmaiconf" class="startofrange">
23141 <primary>main configuration</primary>
23142 </indexterm>
23143 The first part of the runtime configuration file contains three types of item:
23144 </para>
23145 <itemizedlist>
23146 <listitem>
23147 <para>
23148 Macro definitions: These lines start with an upper case letter. See section
23149 <xref linkend="SECTmacrodefs"/> for details of macro processing.
23150 </para>
23151 </listitem>
23152 <listitem>
23153 <para>
23154 Named list definitions: These lines start with one of the words <quote>domainlist</quote>,
23155 <quote>hostlist</quote>, <quote>addresslist</quote>, or <quote>localpartlist</quote>. Their use is described in
23156 section <xref linkend="SECTnamedlists"/>.
23157 </para>
23158 </listitem>
23159 <listitem>
23160 <para>
23161 Main configuration settings: Each setting occupies one line of the file
23162 (with possible continuations). If any setting is preceded by the word
23163 <quote>hide</quote>, the <option>-bP</option> command line option displays its value to admin users
23164 only. See section <xref linkend="SECTcos"/> for a description of the syntax of these option
23165 settings.
23166 </para>
23167 </listitem>
23168 </itemizedlist>
23169 <para>
23170 This chapter specifies all the main configuration options, along with their
23171 types and default values. For ease of finding a particular option, they appear
23172 in alphabetical order in section <xref linkend="SECTalomo"/> below. However, because there
23173 are now so many options, they are first listed briefly in functional groups, as
23174 an aid to finding the name of the option you are looking for. Some options are
23175 listed in more than one group.
23176 </para>
23177 <section id="SECID96">
23178 <title>Miscellaneous</title>
23179 <informaltable frame="none">
23180 <tgroup cols="2" colsep="0" rowsep="0">
23181 <colspec colwidth="196pt" align="left"/>
23182 <colspec colwidth="254pt" align="left"/>
23183 <tbody>
23184 <row>
23185 <entry><option>add_environment</option></entry>
23186 <entry>environment variables</entry>
23187 </row>
23188 <row>
23189 <entry><option>bi_command</option></entry>
23190 <entry>to run for <option>-bi</option> command line option</entry>
23191 </row>
23192 <row>
23193 <entry><option>debug_store</option></entry>
23194 <entry>do extra internal checks</entry>
23195 </row>
23196 <row>
23197 <entry><option>disable_ipv6</option></entry>
23198 <entry>do no IPv6 processing</entry>
23199 </row>
23200 <row>
23201 <entry><option>keep_environment</option></entry>
23202 <entry>environment variables</entry>
23203 </row>
23204 <row>
23205 <entry><option>keep_malformed</option></entry>
23206 <entry>for broken files &ndash; should not happen</entry>
23207 </row>
23208 <row>
23209 <entry><option>localhost_number</option></entry>
23210 <entry>for unique message ids in clusters</entry>
23211 </row>
23212 <row>
23213 <entry><option>message_body_newlines</option></entry>
23214 <entry>retain newlines in <varname>$message_body</varname></entry>
23215 </row>
23216 <row>
23217 <entry><option>message_body_visible</option></entry>
23218 <entry>how much to show in <varname>$message_body</varname></entry>
23219 </row>
23220 <row>
23221 <entry><option>mua_wrapper</option></entry>
23222 <entry>run in <quote>MUA wrapper</quote> mode</entry>
23223 </row>
23224 <row>
23225 <entry><option>print_topbitchars</option></entry>
23226 <entry>top-bit characters are printing</entry>
23227 </row>
23228 <row>
23229 <entry><option>spool_wireformat</option></entry>
23230 <entry>use wire-format spool data files when possible</entry>
23231 </row>
23232 <row>
23233 <entry><option>timezone</option></entry>
23234 <entry>force time zone</entry>
23235 </row>
23236 </tbody>
23237 </tgroup>
23238 </informaltable>
23239 </section>
23240 <section id="SECID97">
23241 <title>Exim parameters</title>
23242 <informaltable frame="none">
23243 <tgroup cols="2" colsep="0" rowsep="0">
23244 <colspec colwidth="196pt" align="left"/>
23245 <colspec colwidth="254pt" align="left"/>
23246 <tbody>
23247 <row>
23248 <entry><option>exim_group</option></entry>
23249 <entry>override compiled-in value</entry>
23250 </row>
23251 <row>
23252 <entry><option>exim_path</option></entry>
23253 <entry>override compiled-in value</entry>
23254 </row>
23255 <row>
23256 <entry><option>exim_user</option></entry>
23257 <entry>override compiled-in value</entry>
23258 </row>
23259 <row>
23260 <entry><option>primary_hostname</option></entry>
23261 <entry>default from <function>uname()</function></entry>
23262 </row>
23263 <row>
23264 <entry><option>split_spool_directory</option></entry>
23265 <entry>use multiple directories</entry>
23266 </row>
23267 <row>
23268 <entry><option>spool_directory</option></entry>
23269 <entry>override compiled-in value</entry>
23270 </row>
23271 </tbody>
23272 </tgroup>
23273 </informaltable>
23274 </section>
23275 <section id="SECID98">
23276 <title>Privilege controls</title>
23277 <informaltable frame="none">
23278 <tgroup cols="2" colsep="0" rowsep="0">
23279 <colspec colwidth="196pt" align="left"/>
23280 <colspec colwidth="254pt" align="left"/>
23281 <tbody>
23282 <row>
23283 <entry><option>admin_groups</option></entry>
23284 <entry>groups that are Exim admin users</entry>
23285 </row>
23286 <row>
23287 <entry><option>commandline_checks_require_admin</option></entry>
23288 <entry>require admin for various checks</entry>
23289 </row>
23290 <row>
23291 <entry><option>deliver_drop_privilege</option></entry>
23292 <entry>drop root for delivery processes</entry>
23293 </row>
23294 <row>
23295 <entry><option>local_from_check</option></entry>
23296 <entry>insert <emphasis>Sender:</emphasis> if necessary</entry>
23297 </row>
23298 <row>
23299 <entry><option>local_from_prefix</option></entry>
23300 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
23301 </row>
23302 <row>
23303 <entry><option>local_from_suffix</option></entry>
23304 <entry>for testing <emphasis>From:</emphasis> for local sender</entry>
23305 </row>
23306 <row>
23307 <entry><option>local_sender_retain</option></entry>
23308 <entry>keep <emphasis>Sender:</emphasis> from untrusted user</entry>
23309 </row>
23310 <row>
23311 <entry><option>never_users</option></entry>
23312 <entry>do not run deliveries as these</entry>
23313 </row>
23314 <row>
23315 <entry><option>prod_requires_admin</option></entry>
23316 <entry>forced delivery requires admin user</entry>
23317 </row>
23318 <row>
23319 <entry><option>queue_list_requires_admin</option></entry>
23320 <entry>queue listing requires admin user</entry>
23321 </row>
23322 <row>
23323 <entry><option>trusted_groups</option></entry>
23324 <entry>groups that are trusted</entry>
23325 </row>
23326 <row>
23327 <entry><option>trusted_users</option></entry>
23328 <entry>users that are trusted</entry>
23329 </row>
23330 </tbody>
23331 </tgroup>
23332 </informaltable>
23333 </section>
23334 <section id="SECID99">
23335 <title>Logging</title>
23336 <informaltable frame="none">
23337 <tgroup cols="2" colsep="0" rowsep="0">
23338 <colspec colwidth="196pt" align="left"/>
23339 <colspec colwidth="254pt" align="left"/>
23340 <tbody>
23341 <row>
23342 <entry><option>event_action</option></entry>
23343 <entry>custom logging</entry>
23344 </row>
23345 <row>
23346 <entry><option>hosts_connection_nolog</option></entry>
23347 <entry>exemption from connect logging</entry>
23348 </row>
23349 <row>
23350 <entry><option>log_file_path</option></entry>
23351 <entry>override compiled-in value</entry>
23352 </row>
23353 <row>
23354 <entry><option>log_selector</option></entry>
23355 <entry>set/unset optional logging</entry>
23356 </row>
23357 <row>
23358 <entry><option>log_timezone</option></entry>
23359 <entry>add timezone to log lines</entry>
23360 </row>
23361 <row>
23362 <entry><option>message_logs</option></entry>
23363 <entry>create per-message logs</entry>
23364 </row>
23365 <row>
23366 <entry><option>preserve_message_logs</option></entry>
23367 <entry>after message completion</entry>
23368 </row>
23369 <row>
23370 <entry><option>process_log_path</option></entry>
23371 <entry>for SIGUSR1 and <emphasis>exiwhat</emphasis></entry>
23372 </row>
23373 <row>
23374 <entry><option>slow_lookup_log</option></entry>
23375 <entry>control logging of slow DNS lookups</entry>
23376 </row>
23377 <row>
23378 <entry><option>syslog_duplication</option></entry>
23379 <entry>controls duplicate log lines on syslog</entry>
23380 </row>
23381 <row>
23382 <entry><option>syslog_facility</option></entry>
23383 <entry>set syslog <quote>facility</quote> field</entry>
23384 </row>
23385 <row>
23386 <entry><option>syslog_pid</option></entry>
23387 <entry>pid in syslog lines</entry>
23388 </row>
23389 <row>
23390 <entry><option>syslog_processname</option></entry>
23391 <entry>set syslog <quote>ident</quote> field</entry>
23392 </row>
23393 <row>
23394 <entry><option>syslog_timestamp</option></entry>
23395 <entry>timestamp syslog lines</entry>
23396 </row>
23397 <row>
23398 <entry><option>write_rejectlog</option></entry>
23399 <entry>control use of message log</entry>
23400 </row>
23401 </tbody>
23402 </tgroup>
23403 </informaltable>
23404 </section>
23405 <section id="SECID100">
23406 <title>Frozen messages</title>
23407 <informaltable frame="none">
23408 <tgroup cols="2" colsep="0" rowsep="0">
23409 <colspec colwidth="196pt" align="left"/>
23410 <colspec colwidth="254pt" align="left"/>
23411 <tbody>
23412 <row>
23413 <entry><option>auto_thaw</option></entry>
23414 <entry>sets time for retrying frozen messages</entry>
23415 </row>
23416 <row>
23417 <entry><option>freeze_tell</option></entry>
23418 <entry>send message when freezing</entry>
23419 </row>
23420 <row>
23421 <entry><option>move_frozen_messages</option></entry>
23422 <entry>to another directory</entry>
23423 </row>
23424 <row>
23425 <entry><option>timeout_frozen_after</option></entry>
23426 <entry>keep frozen messages only so long</entry>
23427 </row>
23428 </tbody>
23429 </tgroup>
23430 </informaltable>
23431 </section>
23432 <section id="SECID101">
23433 <title>Data lookups</title>
23434 <informaltable frame="none">
23435 <tgroup cols="2" colsep="0" rowsep="0">
23436 <colspec colwidth="196pt" align="left"/>
23437 <colspec colwidth="254pt" align="left"/>
23438 <tbody>
23439 <row>
23440 <entry><option>ibase_servers</option></entry>
23441 <entry>InterBase servers</entry>
23442 </row>
23443 <row>
23444 <entry><option>ldap_ca_cert_dir</option></entry>
23445 <entry>dir of CA certs to verify LDAP server&#x2019;s</entry>
23446 </row>
23447 <row>
23448 <entry><option>ldap_ca_cert_file</option></entry>
23449 <entry>file of CA certs to verify LDAP server&#x2019;s</entry>
23450 </row>
23451 <row>
23452 <entry><option>ldap_cert_file</option></entry>
23453 <entry>client cert file for LDAP</entry>
23454 </row>
23455 <row>
23456 <entry><option>ldap_cert_key</option></entry>
23457 <entry>client key file for LDAP</entry>
23458 </row>
23459 <row>
23460 <entry><option>ldap_cipher_suite</option></entry>
23461 <entry>TLS negotiation preference control</entry>
23462 </row>
23463 <row>
23464 <entry><option>ldap_default_servers</option></entry>
23465 <entry>used if no server in query</entry>
23466 </row>
23467 <row>
23468 <entry><option>ldap_require_cert</option></entry>
23469 <entry>action to take without LDAP server cert</entry>
23470 </row>
23471 <row>
23472 <entry><option>ldap_start_tls</option></entry>
23473 <entry>require TLS within LDAP</entry>
23474 </row>
23475 <row>
23476 <entry><option>ldap_version</option></entry>
23477 <entry>set protocol version</entry>
23478 </row>
23479 <row>
23480 <entry><option>lookup_open_max</option></entry>
23481 <entry>lookup files held open</entry>
23482 </row>
23483 <row>
23484 <entry><option>mysql_servers</option></entry>
23485 <entry>default MySQL servers</entry>
23486 </row>
23487 <row>
23488 <entry><option>oracle_servers</option></entry>
23489 <entry>Oracle servers</entry>
23490 </row>
23491 <row>
23492 <entry><option>pgsql_servers</option></entry>
23493 <entry>default PostgreSQL servers</entry>
23494 </row>
23495 <row>
23496 <entry><option>sqlite_lock_timeout</option></entry>
23497 <entry>as it says</entry>
23498 </row>
23499 </tbody>
23500 </tgroup>
23501 </informaltable>
23502 </section>
23503 <section id="SECID102">
23504 <title>Message ids</title>
23505 <informaltable frame="none">
23506 <tgroup cols="2" colsep="0" rowsep="0">
23507 <colspec colwidth="196pt" align="left"/>
23508 <colspec colwidth="254pt" align="left"/>
23509 <tbody>
23510 <row>
23511 <entry><option>message_id_header_domain</option></entry>
23512 <entry>used to build <emphasis>Message-ID:</emphasis> header</entry>
23513 </row>
23514 <row>
23515 <entry><option>message_id_header_text</option></entry>
23516 <entry>ditto</entry>
23517 </row>
23518 </tbody>
23519 </tgroup>
23520 </informaltable>
23521 </section>
23522 <section id="SECID103">
23523 <title>Embedded Perl Startup</title>
23524 <informaltable frame="none">
23525 <tgroup cols="2" colsep="0" rowsep="0">
23526 <colspec colwidth="196pt" align="left"/>
23527 <colspec colwidth="254pt" align="left"/>
23528 <tbody>
23529 <row>
23530 <entry><option>perl_at_start</option></entry>
23531 <entry>always start the interpreter</entry>
23532 </row>
23533 <row>
23534 <entry><option>perl_startup</option></entry>
23535 <entry>code to obey when starting Perl</entry>
23536 </row>
23537 <row>
23538 <entry><option>perl_taintmode</option></entry>
23539 <entry>enable taint mode in Perl</entry>
23540 </row>
23541 </tbody>
23542 </tgroup>
23543 </informaltable>
23544 </section>
23545 <section id="SECID104">
23546 <title>Daemon</title>
23547 <informaltable frame="none">
23548 <tgroup cols="2" colsep="0" rowsep="0">
23549 <colspec colwidth="196pt" align="left"/>
23550 <colspec colwidth="254pt" align="left"/>
23551 <tbody>
23552 <row>
23553 <entry><option>daemon_smtp_ports</option></entry>
23554 <entry>default ports</entry>
23555 </row>
23556 <row>
23557 <entry><option>daemon_startup_retries</option></entry>
23558 <entry>number of times to retry</entry>
23559 </row>
23560 <row>
23561 <entry><option>daemon_startup_sleep</option></entry>
23562 <entry>time to sleep between tries</entry>
23563 </row>
23564 <row>
23565 <entry><option>extra_local_interfaces</option></entry>
23566 <entry>not necessarily listened on</entry>
23567 </row>
23568 <row>
23569 <entry><option>local_interfaces</option></entry>
23570 <entry>on which to listen, with optional ports</entry>
23571 </row>
23572 <row>
23573 <entry><option>notifier_socket</option></entry>
23574 <entry>override compiled-in value</entry>
23575 </row>
23576 <row>
23577 <entry><option>pid_file_path</option></entry>
23578 <entry>override compiled-in value</entry>
23579 </row>
23580 <row>
23581 <entry><option>queue_run_max</option></entry>
23582 <entry>maximum simultaneous queue runners</entry>
23583 </row>
23584 <row>
23585 <entry><option>smtp_backlog_monitor</option></entry>
23586 <entry>level to log listen backlog</entry>
23587 </row>
23588 </tbody>
23589 </tgroup>
23590 </informaltable>
23591 </section>
23592 <section id="SECID105">
23593 <title>Resource control</title>
23594 <informaltable frame="none">
23595 <tgroup cols="2" colsep="0" rowsep="0">
23596 <colspec colwidth="196pt" align="left"/>
23597 <colspec colwidth="254pt" align="left"/>
23598 <tbody>
23599 <row>
23600 <entry><option>check_log_inodes</option></entry>
23601 <entry>before accepting a message</entry>
23602 </row>
23603 <row>
23604 <entry><option>check_log_space</option></entry>
23605 <entry>before accepting a message</entry>
23606 </row>
23607 <row>
23608 <entry><option>check_spool_inodes</option></entry>
23609 <entry>before accepting a message</entry>
23610 </row>
23611 <row>
23612 <entry><option>check_spool_space</option></entry>
23613 <entry>before accepting a message</entry>
23614 </row>
23615 <row>
23616 <entry><option>deliver_queue_load_max</option></entry>
23617 <entry>no queue deliveries if load high</entry>
23618 </row>
23619 <row>
23620 <entry><option>queue_only_load</option></entry>
23621 <entry>queue incoming if load high</entry>
23622 </row>
23623 <row>
23624 <entry><option>queue_only_load_latch</option></entry>
23625 <entry>don&#x2019;t re-evaluate load for each message</entry>
23626 </row>
23627 <row>
23628 <entry><option>queue_run_max</option></entry>
23629 <entry>maximum simultaneous queue runners</entry>
23630 </row>
23631 <row>
23632 <entry><option>remote_max_parallel</option></entry>
23633 <entry>parallel SMTP delivery per message</entry>
23634 </row>
23635 <row>
23636 <entry><option>smtp_accept_max</option></entry>
23637 <entry>simultaneous incoming connections</entry>
23638 </row>
23639 <row>
23640 <entry><option>smtp_accept_max_nonmail</option></entry>
23641 <entry>non-mail commands</entry>
23642 </row>
23643 <row>
23644 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
23645 <entry>hosts to which the limit applies</entry>
23646 </row>
23647 <row>
23648 <entry><option>smtp_accept_max_per_connection</option></entry>
23649 <entry>messages per connection</entry>
23650 </row>
23651 <row>
23652 <entry><option>smtp_accept_max_per_host</option></entry>
23653 <entry>connections from one host</entry>
23654 </row>
23655 <row>
23656 <entry><option>smtp_accept_queue</option></entry>
23657 <entry>queue mail if more connections</entry>
23658 </row>
23659 <row>
23660 <entry><option>smtp_accept_queue_per_connection</option></entry>
23661 <entry>queue if more messages per connection</entry>
23662 </row>
23663 <row>
23664 <entry><option>smtp_accept_reserve</option></entry>
23665 <entry>only reserve hosts if more connections</entry>
23666 </row>
23667 <row>
23668 <entry><option>smtp_check_spool_space</option></entry>
23669 <entry>from SIZE on MAIL command</entry>
23670 </row>
23671 <row>
23672 <entry><option>smtp_connect_backlog</option></entry>
23673 <entry>passed to TCP/IP stack</entry>
23674 </row>
23675 <row>
23676 <entry><option>smtp_load_reserve</option></entry>
23677 <entry>SMTP from reserved hosts if load high</entry>
23678 </row>
23679 <row>
23680 <entry><option>smtp_reserve_hosts</option></entry>
23681 <entry>these are the reserve hosts</entry>
23682 </row>
23683 </tbody>
23684 </tgroup>
23685 </informaltable>
23686 </section>
23687 <section id="SECID106">
23688 <title>Policy controls</title>
23689 <informaltable frame="none">
23690 <tgroup cols="2" colsep="0" rowsep="0">
23691 <colspec colwidth="196pt" align="left"/>
23692 <colspec colwidth="254pt" align="left"/>
23693 <tbody>
23694 <row>
23695 <entry><option>acl_not_smtp</option></entry>
23696 <entry>ACL for non-SMTP messages</entry>
23697 </row>
23698 <row>
23699 <entry><option>acl_not_smtp_mime</option></entry>
23700 <entry>ACL for non-SMTP MIME parts</entry>
23701 </row>
23702 <row>
23703 <entry><option>acl_not_smtp_start</option></entry>
23704 <entry>ACL for start of non-SMTP message</entry>
23705 </row>
23706 <row>
23707 <entry><option>acl_smtp_auth</option></entry>
23708 <entry>ACL for AUTH</entry>
23709 </row>
23710 <row>
23711 <entry><option>acl_smtp_connect</option></entry>
23712 <entry>ACL for connection</entry>
23713 </row>
23714 <row>
23715 <entry><option>acl_smtp_data</option></entry>
23716 <entry>ACL for DATA</entry>
23717 </row>
23718 <row>
23719 <entry><option>acl_smtp_data_prdr</option></entry>
23720 <entry>ACL for DATA, per-recipient</entry>
23721 </row>
23722 <row>
23723 <entry><option>acl_smtp_dkim</option></entry>
23724 <entry>ACL for DKIM verification</entry>
23725 </row>
23726 <row>
23727 <entry><option>acl_smtp_etrn</option></entry>
23728 <entry>ACL for ETRN</entry>
23729 </row>
23730 <row>
23731 <entry><option>acl_smtp_expn</option></entry>
23732 <entry>ACL for EXPN</entry>
23733 </row>
23734 <row>
23735 <entry><option>acl_smtp_helo</option></entry>
23736 <entry>ACL for EHLO or HELO</entry>
23737 </row>
23738 <row>
23739 <entry><option>acl_smtp_mail</option></entry>
23740 <entry>ACL for MAIL</entry>
23741 </row>
23742 <row>
23743 <entry><option>acl_smtp_mailauth</option></entry>
23744 <entry>ACL for AUTH on MAIL command</entry>
23745 </row>
23746 <row>
23747 <entry><option>acl_smtp_mime</option></entry>
23748 <entry>ACL for MIME parts</entry>
23749 </row>
23750 <row>
23751 <entry><option>acl_smtp_notquit</option></entry>
23752 <entry>ACL for non-QUIT terminations</entry>
23753 </row>
23754 <row>
23755 <entry><option>acl_smtp_predata</option></entry>
23756 <entry>ACL for start of data</entry>
23757 </row>
23758 <row>
23759 <entry><option>acl_smtp_quit</option></entry>
23760 <entry>ACL for QUIT</entry>
23761 </row>
23762 <row>
23763 <entry><option>acl_smtp_rcpt</option></entry>
23764 <entry>ACL for RCPT</entry>
23765 </row>
23766 <row>
23767 <entry><option>acl_smtp_starttls</option></entry>
23768 <entry>ACL for STARTTLS</entry>
23769 </row>
23770 <row>
23771 <entry><option>acl_smtp_vrfy</option></entry>
23772 <entry>ACL for VRFY</entry>
23773 </row>
23774 <row>
23775 <entry><option>av_scanner</option></entry>
23776 <entry>specify virus scanner</entry>
23777 </row>
23778 <row>
23779 <entry><option>check_rfc2047_length</option></entry>
23780 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
23781 </row>
23782 <row>
23783 <entry><option>dns_cname_loops</option></entry>
23784 <entry>follow CNAMEs returned by resolver</entry>
23785 </row>
23786 <row>
23787 <entry><option>dns_csa_search_limit</option></entry>
23788 <entry>control CSA parent search depth</entry>
23789 </row>
23790 <row>
23791 <entry><option>dns_csa_use_reverse</option></entry>
23792 <entry>en/disable CSA IP reverse search</entry>
23793 </row>
23794 <row>
23795 <entry><option>header_maxsize</option></entry>
23796 <entry>total size of message header</entry>
23797 </row>
23798 <row>
23799 <entry><option>header_line_maxsize</option></entry>
23800 <entry>individual header line limit</entry>
23801 </row>
23802 <row>
23803 <entry><option>helo_accept_junk_hosts</option></entry>
23804 <entry>allow syntactic junk from these hosts</entry>
23805 </row>
23806 <row>
23807 <entry><option>helo_allow_chars</option></entry>
23808 <entry>allow illegal chars in HELO names</entry>
23809 </row>
23810 <row>
23811 <entry><option>helo_lookup_domains</option></entry>
23812 <entry>lookup hostname for these HELO names</entry>
23813 </row>
23814 <row>
23815 <entry><option>helo_try_verify_hosts</option></entry>
23816 <entry>HELO soft-checked for these hosts</entry>
23817 </row>
23818 <row>
23819 <entry><option>helo_verify_hosts</option></entry>
23820 <entry>HELO hard-checked for these hosts</entry>
23821 </row>
23822 <row>
23823 <entry><option>host_lookup</option></entry>
23824 <entry>host name looked up for these hosts</entry>
23825 </row>
23826 <row>
23827 <entry><option>host_lookup_order</option></entry>
23828 <entry>order of DNS and local name lookups</entry>
23829 </row>
23830 <row>
23831 <entry><option>hosts_proxy</option></entry>
23832 <entry>use proxy protocol for these hosts</entry>
23833 </row>
23834 <row>
23835 <entry><option>host_reject_connection</option></entry>
23836 <entry>reject connection from these hosts</entry>
23837 </row>
23838 <row>
23839 <entry><option>hosts_treat_as_local</option></entry>
23840 <entry>useful in some cluster configurations</entry>
23841 </row>
23842 <row>
23843 <entry><option>local_scan_timeout</option></entry>
23844 <entry>timeout for <function>local_scan()</function></entry>
23845 </row>
23846 <row>
23847 <entry><option>message_size_limit</option></entry>
23848 <entry>for all messages</entry>
23849 </row>
23850 <row>
23851 <entry><option>percent_hack_domains</option></entry>
23852 <entry>recognize %-hack for these domains</entry>
23853 </row>
23854 <row>
23855 <entry><option>proxy_protocol_timeout</option></entry>
23856 <entry>timeout for proxy protocol negotiation</entry>
23857 </row>
23858 <row>
23859 <entry><option>spamd_address</option></entry>
23860 <entry>set interface to SpamAssassin</entry>
23861 </row>
23862 <row>
23863 <entry><option>strict_acl_vars</option></entry>
23864 <entry>object to unset ACL variables</entry>
23865 </row>
23866 <row>
23867 <entry><option>spf_smtp_comment_template</option></entry>
23868 <entry>template for <varname>$spf_smtp_comment</varname></entry>
23869 </row>
23870 </tbody>
23871 </tgroup>
23872 </informaltable>
23873 </section>
23874 <section id="SECID107">
23875 <title>Callout cache</title>
23876 <informaltable frame="none">
23877 <tgroup cols="2" colsep="0" rowsep="0">
23878 <colspec colwidth="196pt" align="left"/>
23879 <colspec colwidth="254pt" align="left"/>
23880 <tbody>
23881 <row>
23882 <entry><option>callout_domain_negative_expire</option></entry>
23883 <entry>timeout for negative domain cache item</entry>
23884 </row>
23885 <row>
23886 <entry><option>callout_domain_positive_expire</option></entry>
23887 <entry>timeout for positive domain cache item</entry>
23888 </row>
23889 <row>
23890 <entry><option>callout_negative_expire</option></entry>
23891 <entry>timeout for negative address cache item</entry>
23892 </row>
23893 <row>
23894 <entry><option>callout_positive_expire</option></entry>
23895 <entry>timeout for positive address cache item</entry>
23896 </row>
23897 <row>
23898 <entry><option>callout_random_local_part</option></entry>
23899 <entry>string to use for <quote>random</quote> testing</entry>
23900 </row>
23901 </tbody>
23902 </tgroup>
23903 </informaltable>
23904 </section>
23905 <section id="SECID108">
23906 <title>TLS</title>
23907 <informaltable frame="none">
23908 <tgroup cols="2" colsep="0" rowsep="0">
23909 <colspec colwidth="196pt" align="left"/>
23910 <colspec colwidth="254pt" align="left"/>
23911 <tbody>
23912 <row>
23913 <entry><option>gnutls_compat_mode</option></entry>
23914 <entry>use GnuTLS compatibility mode</entry>
23915 </row>
23916 <row>
23917 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
23918 <entry>allow GnuTLS to autoload PKCS11 modules</entry>
23919 </row>
23920 <row>
23921 <entry><option>hosts_require_alpn</option></entry>
23922 <entry>mandatory ALPN</entry>
23923 </row>
23924 <row>
23925 <entry><option>hosts_require_helo</option></entry>
23926 <entry>mandatory HELO/EHLO</entry>
23927 </row>
23928 <row>
23929 <entry><option>openssl_options</option></entry>
23930 <entry>adjust OpenSSL compatibility options</entry>
23931 </row>
23932 <row>
23933 <entry><option>tls_advertise_hosts</option></entry>
23934 <entry>advertise TLS to these hosts</entry>
23935 </row>
23936 <row>
23937 <entry><option>tls_alpn</option></entry>
23938 <entry>acceptable protocol names</entry>
23939 </row>
23940 <row>
23941 <entry><option>tls_certificate</option></entry>
23942 <entry>location of server certificate</entry>
23943 </row>
23944 <row>
23945 <entry><option>tls_crl</option></entry>
23946 <entry>certificate revocation list</entry>
23947 </row>
23948 <row>
23949 <entry><option>tls_dh_max_bits</option></entry>
23950 <entry>clamp D-H bit count suggestion</entry>
23951 </row>
23952 <row>
23953 <entry><option>tls_dhparam</option></entry>
23954 <entry>DH parameters for server</entry>
23955 </row>
23956 <row>
23957 <entry><option>tls_eccurve</option></entry>
23958 <entry>EC curve selection for server</entry>
23959 </row>
23960 <row>
23961 <entry><option>tls_ocsp_file</option></entry>
23962 <entry>location of server certificate status proof</entry>
23963 </row>
23964 <row>
23965 <entry><option>tls_on_connect_ports</option></entry>
23966 <entry>specify SSMTP (SMTPS) ports</entry>
23967 </row>
23968 <row>
23969 <entry><option>tls_privatekey</option></entry>
23970 <entry>location of server private key</entry>
23971 </row>
23972 <row>
23973 <entry><option>tls_remember_esmtp</option></entry>
23974 <entry>don&#x2019;t reset after starting TLS</entry>
23975 </row>
23976 <row>
23977 <entry><option>tls_require_ciphers</option></entry>
23978 <entry>specify acceptable ciphers</entry>
23979 </row>
23980 <row>
23981 <entry><option>tls_try_verify_hosts</option></entry>
23982 <entry>try to verify client certificate</entry>
23983 </row>
23984 <row>
23985 <entry><option>tls_verify_certificates</option></entry>
23986 <entry>expected client certificates</entry>
23987 </row>
23988 <row>
23989 <entry><option>tls_verify_hosts</option></entry>
23990 <entry>insist on client certificate verify</entry>
23991 </row>
23992 </tbody>
23993 </tgroup>
23994 </informaltable>
23995 </section>
23996 <section id="SECID109">
23997 <title>Local user handling</title>
23998 <informaltable frame="none">
23999 <tgroup cols="2" colsep="0" rowsep="0">
24000 <colspec colwidth="196pt" align="left"/>
24001 <colspec colwidth="254pt" align="left"/>
24002 <tbody>
24003 <row>
24004 <entry><option>finduser_retries</option></entry>
24005 <entry>useful in NIS environments</entry>
24006 </row>
24007 <row>
24008 <entry><option>gecos_name</option></entry>
24009 <entry>used when creating <emphasis>Sender:</emphasis></entry>
24010 </row>
24011 <row>
24012 <entry><option>gecos_pattern</option></entry>
24013 <entry>ditto</entry>
24014 </row>
24015 <row>
24016 <entry><option>max_username_length</option></entry>
24017 <entry>for systems that truncate</entry>
24018 </row>
24019 <row>
24020 <entry><option>unknown_login</option></entry>
24021 <entry>used when no login name found</entry>
24022 </row>
24023 <row>
24024 <entry><option>unknown_username</option></entry>
24025 <entry>ditto</entry>
24026 </row>
24027 <row>
24028 <entry><option>uucp_from_pattern</option></entry>
24029 <entry>for recognizing <quote>From </quote> lines</entry>
24030 </row>
24031 <row>
24032 <entry><option>uucp_from_sender</option></entry>
24033 <entry>ditto</entry>
24034 </row>
24035 </tbody>
24036 </tgroup>
24037 </informaltable>
24038 </section>
24039 <section id="SECID110">
24040 <title>All incoming messages (SMTP and non-SMTP)</title>
24041 <informaltable frame="none">
24042 <tgroup cols="2" colsep="0" rowsep="0">
24043 <colspec colwidth="196pt" align="left"/>
24044 <colspec colwidth="254pt" align="left"/>
24045 <tbody>
24046 <row>
24047 <entry><option>header_maxsize</option></entry>
24048 <entry>total size of message header</entry>
24049 </row>
24050 <row>
24051 <entry><option>header_line_maxsize</option></entry>
24052 <entry>individual header line limit</entry>
24053 </row>
24054 <row>
24055 <entry><option>message_size_limit</option></entry>
24056 <entry>applies to all messages</entry>
24057 </row>
24058 <row>
24059 <entry><option>percent_hack_domains</option></entry>
24060 <entry>recognize %-hack for these domains</entry>
24061 </row>
24062 <row>
24063 <entry><option>received_header_text</option></entry>
24064 <entry>expanded to make <emphasis>Received:</emphasis></entry>
24065 </row>
24066 <row>
24067 <entry><option>received_headers_max</option></entry>
24068 <entry>for mail loop detection</entry>
24069 </row>
24070 <row>
24071 <entry><option>recipients_max</option></entry>
24072 <entry>limit per message</entry>
24073 </row>
24074 <row>
24075 <entry><option>recipients_max_reject</option></entry>
24076 <entry>permanently reject excess recipients</entry>
24077 </row>
24078 </tbody>
24079 </tgroup>
24080 </informaltable>
24081 </section>
24082 <section id="SECID111">
24083 <title>Non-SMTP incoming messages</title>
24084 <informaltable frame="none">
24085 <tgroup cols="2" colsep="0" rowsep="0">
24086 <colspec colwidth="196pt" align="left"/>
24087 <colspec colwidth="254pt" align="left"/>
24088 <tbody>
24089 <row>
24090 <entry><option>receive_timeout</option></entry>
24091 <entry>for non-SMTP messages</entry>
24092 </row>
24093 </tbody>
24094 </tgroup>
24095 </informaltable>
24096 </section>
24097 <section id="SECID112">
24098 <title>Incoming SMTP messages</title>
24099 <para>
24100 See also the <emphasis>Policy controls</emphasis> section above.
24101 </para>
24102 <informaltable frame="none">
24103 <tgroup cols="2" colsep="0" rowsep="0">
24104 <colspec colwidth="196pt" align="left"/>
24105 <colspec colwidth="254pt" align="left"/>
24106 <tbody>
24107 <row>
24108 <entry><option>dkim_verify_hashes</option></entry>
24109 <entry>DKIM hash methods accepted for signatures</entry>
24110 </row>
24111 <row>
24112 <entry><option>dkim_verify_keytypes</option></entry>
24113 <entry>DKIM key types accepted for signatures</entry>
24114 </row>
24115 <row>
24116 <entry><option>dkim_verify_min_keysizes</option></entry>
24117 <entry>DKIM key sizes accepted for signatures</entry>
24118 </row>
24119 <row>
24120 <entry><option>dkim_verify_signers</option></entry>
24121 <entry>DKIM domains for which DKIM ACL is run</entry>
24122 </row>
24123 <row>
24124 <entry><option>dmarc_forensic_sender</option></entry>
24125 <entry>DMARC sender for report messages</entry>
24126 </row>
24127 <row>
24128 <entry><option>dmarc_history_file</option></entry>
24129 <entry>DMARC results log</entry>
24130 </row>
24131 <row>
24132 <entry><option>dmarc_tld_file</option></entry>
24133 <entry>DMARC toplevel domains file</entry>
24134 </row>
24135 <row>
24136 <entry><option>host_lookup</option></entry>
24137 <entry>host name looked up for these hosts</entry>
24138 </row>
24139 <row>
24140 <entry><option>host_lookup_order</option></entry>
24141 <entry>order of DNS and local name lookups</entry>
24142 </row>
24143 <row>
24144 <entry><option>recipient_unqualified_hosts</option></entry>
24145 <entry>may send unqualified recipients</entry>
24146 </row>
24147 <row>
24148 <entry><option>rfc1413_hosts</option></entry>
24149 <entry>make ident calls to these hosts</entry>
24150 </row>
24151 <row>
24152 <entry><option>rfc1413_query_timeout</option></entry>
24153 <entry>zero disables ident calls</entry>
24154 </row>
24155 <row>
24156 <entry><option>sender_unqualified_hosts</option></entry>
24157 <entry>may send unqualified senders</entry>
24158 </row>
24159 <row>
24160 <entry><option>smtp_accept_keepalive</option></entry>
24161 <entry>some TCP/IP magic</entry>
24162 </row>
24163 <row>
24164 <entry><option>smtp_accept_max</option></entry>
24165 <entry>simultaneous incoming connections</entry>
24166 </row>
24167 <row>
24168 <entry><option>smtp_accept_max_nonmail</option></entry>
24169 <entry>non-mail commands</entry>
24170 </row>
24171 <row>
24172 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
24173 <entry>hosts to which the limit applies</entry>
24174 </row>
24175 <row>
24176 <entry><option>smtp_accept_max_per_connection</option></entry>
24177 <entry>messages per connection</entry>
24178 </row>
24179 <row>
24180 <entry><option>smtp_accept_max_per_host</option></entry>
24181 <entry>connections from one host</entry>
24182 </row>
24183 <row>
24184 <entry><option>smtp_accept_queue</option></entry>
24185 <entry>queue mail if more connections</entry>
24186 </row>
24187 <row>
24188 <entry><option>smtp_accept_queue_per_connection</option></entry>
24189 <entry>queue if more messages per connection</entry>
24190 </row>
24191 <row>
24192 <entry><option>smtp_accept_reserve</option></entry>
24193 <entry>only reserve hosts if more connections</entry>
24194 </row>
24195 <row>
24196 <entry><option>smtp_active_hostname</option></entry>
24197 <entry>host name to use in messages</entry>
24198 </row>
24199 <row>
24200 <entry><option>smtp_banner</option></entry>
24201 <entry>text for welcome banner</entry>
24202 </row>
24203 <row>
24204 <entry><option>smtp_check_spool_space</option></entry>
24205 <entry>from SIZE on MAIL command</entry>
24206 </row>
24207 <row>
24208 <entry><option>smtp_connect_backlog</option></entry>
24209 <entry>passed to TCP/IP stack</entry>
24210 </row>
24211 <row>
24212 <entry><option>smtp_enforce_sync</option></entry>
24213 <entry>of SMTP command/responses</entry>
24214 </row>
24215 <row>
24216 <entry><option>smtp_etrn_command</option></entry>
24217 <entry>what to run for ETRN</entry>
24218 </row>
24219 <row>
24220 <entry><option>smtp_etrn_serialize</option></entry>
24221 <entry>only one at once</entry>
24222 </row>
24223 <row>
24224 <entry><option>smtp_load_reserve</option></entry>
24225 <entry>only reserve hosts if this load</entry>
24226 </row>
24227 <row>
24228 <entry><option>smtp_max_unknown_commands</option></entry>
24229 <entry>before dropping connection</entry>
24230 </row>
24231 <row>
24232 <entry><option>smtp_ratelimit_hosts</option></entry>
24233 <entry>apply ratelimiting to these hosts</entry>
24234 </row>
24235 <row>
24236 <entry><option>smtp_ratelimit_mail</option></entry>
24237 <entry>ratelimit for MAIL commands</entry>
24238 </row>
24239 <row>
24240 <entry><option>smtp_ratelimit_rcpt</option></entry>
24241 <entry>ratelimit for RCPT commands</entry>
24242 </row>
24243 <row>
24244 <entry><option>smtp_receive_timeout</option></entry>
24245 <entry>per command or data line</entry>
24246 </row>
24247 <row>
24248 <entry><option>smtp_reserve_hosts</option></entry>
24249 <entry>these are the reserve hosts</entry>
24250 </row>
24251 <row>
24252 <entry><option>smtp_return_error_details</option></entry>
24253 <entry>give detail on rejections</entry>
24254 </row>
24255 </tbody>
24256 </tgroup>
24257 </informaltable>
24258 </section>
24259 <section id="SECID113">
24260 <title>SMTP extensions</title>
24261 <informaltable frame="none">
24262 <tgroup cols="2" colsep="0" rowsep="0">
24263 <colspec colwidth="196pt" align="left"/>
24264 <colspec colwidth="254pt" align="left"/>
24265 <tbody>
24266 <row>
24267 <entry><option>accept_8bitmime</option></entry>
24268 <entry>advertise 8BITMIME</entry>
24269 </row>
24270 <row>
24271 <entry><option>auth_advertise_hosts</option></entry>
24272 <entry>advertise AUTH to these hosts</entry>
24273 </row>
24274 <row>
24275 <entry><option>chunking_advertise_hosts</option></entry>
24276 <entry>advertise CHUNKING to these hosts</entry>
24277 </row>
24278 <row>
24279 <entry><option>dsn_advertise_hosts</option></entry>
24280 <entry>advertise DSN extensions to these hosts</entry>
24281 </row>
24282 <row>
24283 <entry><option>ignore_fromline_hosts</option></entry>
24284 <entry>allow <quote>From </quote> from these hosts</entry>
24285 </row>
24286 <row>
24287 <entry><option>ignore_fromline_local</option></entry>
24288 <entry>allow <quote>From </quote> from local SMTP</entry>
24289 </row>
24290 <row>
24291 <entry><option>pipelining_advertise_hosts</option></entry>
24292 <entry>advertise pipelining to these hosts</entry>
24293 </row>
24294 <row>
24295 <entry><option>pipelining_connect_advertise_hosts</option></entry>
24296 <entry>advertise pipelining to these hosts</entry>
24297 </row>
24298 <row>
24299 <entry><option>prdr_enable</option></entry>
24300 <entry>advertise PRDR to all hosts</entry>
24301 </row>
24302 <row>
24303 <entry><option>smtputf8_advertise_hosts</option></entry>
24304 <entry>advertise SMTPUTF8 to these hosts</entry>
24305 </row>
24306 <row>
24307 <entry><option>tls_advertise_hosts</option></entry>
24308 <entry>advertise TLS to these hosts</entry>
24309 </row>
24310 </tbody>
24311 </tgroup>
24312 </informaltable>
24313 </section>
24314 <section id="SECID114">
24315 <title>Processing messages</title>
24316 <informaltable frame="none">
24317 <tgroup cols="2" colsep="0" rowsep="0">
24318 <colspec colwidth="196pt" align="left"/>
24319 <colspec colwidth="254pt" align="left"/>
24320 <tbody>
24321 <row>
24322 <entry><option>allow_domain_literals</option></entry>
24323 <entry>recognize domain literal syntax</entry>
24324 </row>
24325 <row>
24326 <entry><option>allow_mx_to_ip</option></entry>
24327 <entry>allow MX to point to IP address</entry>
24328 </row>
24329 <row>
24330 <entry><option>allow_utf8_domains</option></entry>
24331 <entry>in addresses</entry>
24332 </row>
24333 <row>
24334 <entry><option>check_rfc2047_length</option></entry>
24335 <entry>check length of RFC 2047 <quote>encoded words</quote></entry>
24336 </row>
24337 <row>
24338 <entry><option>delivery_date_remove</option></entry>
24339 <entry>from incoming messages</entry>
24340 </row>
24341 <row>
24342 <entry><option>envelope_to_remove</option></entry>
24343 <entry>from incoming messages</entry>
24344 </row>
24345 <row>
24346 <entry><option>extract_addresses_remove_arguments</option></entry>
24347 <entry>affects <option>-t</option> processing</entry>
24348 </row>
24349 <row>
24350 <entry><option>headers_charset</option></entry>
24351 <entry>default for translations</entry>
24352 </row>
24353 <row>
24354 <entry><option>qualify_domain</option></entry>
24355 <entry>default for senders</entry>
24356 </row>
24357 <row>
24358 <entry><option>qualify_recipient</option></entry>
24359 <entry>default for recipients</entry>
24360 </row>
24361 <row>
24362 <entry><option>return_path_remove</option></entry>
24363 <entry>from incoming messages</entry>
24364 </row>
24365 <row>
24366 <entry><option>strip_excess_angle_brackets</option></entry>
24367 <entry>in addresses</entry>
24368 </row>
24369 <row>
24370 <entry><option>strip_trailing_dot</option></entry>
24371 <entry>at end of addresses</entry>
24372 </row>
24373 <row>
24374 <entry><option>untrusted_set_sender</option></entry>
24375 <entry>untrusted can set envelope sender</entry>
24376 </row>
24377 </tbody>
24378 </tgroup>
24379 </informaltable>
24380 </section>
24381 <section id="SECID115">
24382 <title>System filter</title>
24383 <informaltable frame="none">
24384 <tgroup cols="2" colsep="0" rowsep="0">
24385 <colspec colwidth="196pt" align="left"/>
24386 <colspec colwidth="254pt" align="left"/>
24387 <tbody>
24388 <row>
24389 <entry><option>system_filter</option></entry>
24390 <entry>locate system filter</entry>
24391 </row>
24392 <row>
24393 <entry><option>system_filter_directory_transport</option></entry>
24394 <entry>transport for delivery to a directory</entry>
24395 </row>
24396 <row>
24397 <entry><option>system_filter_file_transport</option></entry>
24398 <entry>transport for delivery to a file</entry>
24399 </row>
24400 <row>
24401 <entry><option>system_filter_group</option></entry>
24402 <entry>group for filter running</entry>
24403 </row>
24404 <row>
24405 <entry><option>system_filter_pipe_transport</option></entry>
24406 <entry>transport for delivery to a pipe</entry>
24407 </row>
24408 <row>
24409 <entry><option>system_filter_reply_transport</option></entry>
24410 <entry>transport for autoreply delivery</entry>
24411 </row>
24412 <row>
24413 <entry><option>system_filter_user</option></entry>
24414 <entry>user for filter running</entry>
24415 </row>
24416 </tbody>
24417 </tgroup>
24418 </informaltable>
24419 </section>
24420 <section id="SECID116">
24421 <title>Routing and delivery</title>
24422 <informaltable frame="none">
24423 <tgroup cols="2" colsep="0" rowsep="0">
24424 <colspec colwidth="196pt" align="left"/>
24425 <colspec colwidth="254pt" align="left"/>
24426 <tbody>
24427 <row>
24428 <entry><option>disable_ipv6</option></entry>
24429 <entry>do no IPv6 processing</entry>
24430 </row>
24431 <row>
24432 <entry><option>dns_again_means_nonexist</option></entry>
24433 <entry>for broken domains</entry>
24434 </row>
24435 <row>
24436 <entry><option>dns_check_names_pattern</option></entry>
24437 <entry>pre-DNS syntax check</entry>
24438 </row>
24439 <row>
24440 <entry><option>dns_dnssec_ok</option></entry>
24441 <entry>parameter for resolver</entry>
24442 </row>
24443 <row>
24444 <entry><option>dns_ipv4_lookup</option></entry>
24445 <entry>only v4 lookup for these domains</entry>
24446 </row>
24447 <row>
24448 <entry><option>dns_retrans</option></entry>
24449 <entry>parameter for resolver</entry>
24450 </row>
24451 <row>
24452 <entry><option>dns_retry</option></entry>
24453 <entry>parameter for resolver</entry>
24454 </row>
24455 <row>
24456 <entry><option>dns_trust_aa</option></entry>
24457 <entry>DNS zones trusted as authentic</entry>
24458 </row>
24459 <row>
24460 <entry><option>dns_use_edns0</option></entry>
24461 <entry>parameter for resolver</entry>
24462 </row>
24463 <row>
24464 <entry><option>hold_domains</option></entry>
24465 <entry>hold delivery for these domains</entry>
24466 </row>
24467 <row>
24468 <entry><option>local_interfaces</option></entry>
24469 <entry>for routing checks</entry>
24470 </row>
24471 <row>
24472 <entry><option>queue_domains</option></entry>
24473 <entry>no immediate delivery for these</entry>
24474 </row>
24475 <row>
24476 <entry><option>queue_fast_ramp</option></entry>
24477 <entry>parallel delivery with 2-phase queue run</entry>
24478 </row>
24479 <row>
24480 <entry><option>queue_only</option></entry>
24481 <entry>no immediate delivery at all</entry>
24482 </row>
24483 <row>
24484 <entry><option>queue_only_file</option></entry>
24485 <entry>no immediate delivery if file exists</entry>
24486 </row>
24487 <row>
24488 <entry><option>queue_only_load</option></entry>
24489 <entry>no immediate delivery if load is high</entry>
24490 </row>
24491 <row>
24492 <entry><option>queue_only_load_latch</option></entry>
24493 <entry>don&#x2019;t re-evaluate load for each message</entry>
24494 </row>
24495 <row>
24496 <entry><option>queue_only_override</option></entry>
24497 <entry>allow command line to override</entry>
24498 </row>
24499 <row>
24500 <entry><option>queue_run_in_order</option></entry>
24501 <entry>order of arrival</entry>
24502 </row>
24503 <row>
24504 <entry><option>queue_run_max</option></entry>
24505 <entry>of simultaneous queue runners</entry>
24506 </row>
24507 <row>
24508 <entry><option>queue_smtp_domains</option></entry>
24509 <entry>no immediate SMTP delivery for these</entry>
24510 </row>
24511 <row>
24512 <entry><option>remote_max_parallel</option></entry>
24513 <entry>parallel SMTP delivery per message</entry>
24514 </row>
24515 <row>
24516 <entry><option>remote_sort_domains</option></entry>
24517 <entry>order of remote deliveries</entry>
24518 </row>
24519 <row>
24520 <entry><option>retry_data_expire</option></entry>
24521 <entry>timeout for retry data</entry>
24522 </row>
24523 <row>
24524 <entry><option>retry_interval_max</option></entry>
24525 <entry>safety net for retry rules</entry>
24526 </row>
24527 </tbody>
24528 </tgroup>
24529 </informaltable>
24530 </section>
24531 <section id="SECID117">
24532 <title>Bounce and warning messages</title>
24533 <informaltable frame="none">
24534 <tgroup cols="2" colsep="0" rowsep="0">
24535 <colspec colwidth="196pt" align="left"/>
24536 <colspec colwidth="254pt" align="left"/>
24537 <tbody>
24538 <row>
24539 <entry><option>bounce_message_file</option></entry>
24540 <entry>content of bounce</entry>
24541 </row>
24542 <row>
24543 <entry><option>bounce_message_text</option></entry>
24544 <entry>content of bounce</entry>
24545 </row>
24546 <row>
24547 <entry><option>bounce_return_body</option></entry>
24548 <entry>include body if returning message</entry>
24549 </row>
24550 <row>
24551 <entry><option>bounce_return_linesize_limit</option></entry>
24552 <entry>limit on returned message line length</entry>
24553 </row>
24554 <row>
24555 <entry><option>bounce_return_message</option></entry>
24556 <entry>include original message in bounce</entry>
24557 </row>
24558 <row>
24559 <entry><option>bounce_return_size_limit</option></entry>
24560 <entry>limit on returned message</entry>
24561 </row>
24562 <row>
24563 <entry><option>bounce_sender_authentication</option></entry>
24564 <entry>send authenticated sender with bounce</entry>
24565 </row>
24566 <row>
24567 <entry><option>dsn_from</option></entry>
24568 <entry>set <emphasis>From:</emphasis> contents in bounces</entry>
24569 </row>
24570 <row>
24571 <entry><option>errors_copy</option></entry>
24572 <entry>copy bounce messages</entry>
24573 </row>
24574 <row>
24575 <entry><option>errors_reply_to</option></entry>
24576 <entry><emphasis>Reply-to:</emphasis> in bounces</entry>
24577 </row>
24578 <row>
24579 <entry><option>delay_warning</option></entry>
24580 <entry>time schedule</entry>
24581 </row>
24582 <row>
24583 <entry><option>delay_warning_condition</option></entry>
24584 <entry>condition for warning messages</entry>
24585 </row>
24586 <row>
24587 <entry><option>ignore_bounce_errors_after</option></entry>
24588 <entry>discard undeliverable bounces</entry>
24589 </row>
24590 <row>
24591 <entry><option>smtp_return_error_details</option></entry>
24592 <entry>give detail on rejections</entry>
24593 </row>
24594 <row>
24595 <entry><option>warn_message_file</option></entry>
24596 <entry>content of warning message</entry>
24597 </row>
24598 </tbody>
24599 </tgroup>
24600 </informaltable>
24601 </section>
24602 <section id="SECTalomo">
24603 <title>Alphabetical list of main options</title>
24604 <para>
24605 Those options that undergo string expansion before use are marked with
24606 &dagger;.
24607 </para>
24608 <para>
24609 <indexterm role="option">
24610 <primary><option>accept_8bitmime</option></primary>
24611 </indexterm>
24612 </para>
24613 <informaltable frame="all">
24614 <tgroup cols="4" colsep="0" rowsep="0">
24615 <colspec colwidth="8*" align="left"/>
24616 <colspec colwidth="6*" align="center"/>
24617 <colspec colwidth="6*" align="center"/>
24618 <colspec colwidth="6*" align="right"/>
24619 <tbody>
24620 <row>
24621 <entry><option>accept_8bitmime</option></entry>
24622 <entry>Use: <emphasis>main</emphasis></entry>
24623 <entry>Type: <emphasis>boolean</emphasis></entry>
24624 <entry>Default: <emphasis>true</emphasis></entry>
24625 </row>
24626 </tbody>
24627 </tgroup>
24628 </informaltable>
24629 <para>
24630 <indexterm role="concept">
24631 <primary>8BITMIME</primary>
24632 </indexterm>
24633 <indexterm role="concept">
24634 <primary>8-bit characters</primary>
24635 </indexterm>
24636 <indexterm role="concept">
24637 <primary>log</primary>
24638 <secondary>selectors</secondary>
24639 </indexterm>
24640 <indexterm role="concept">
24641 <primary>log</primary>
24642 <secondary>8BITMIME</secondary>
24643 </indexterm>
24644 <indexterm role="concept">
24645 <primary>ESMTP extensions</primary>
24646 <secondary>8BITMIME</secondary>
24647 </indexterm>
24648 This option causes Exim to send 8BITMIME in its response to an SMTP
24649 EHLO command, and to accept the BODY= parameter on MAIL commands.
24650 However, though Exim is 8-bit clean, it is not a protocol converter, and it
24651 takes no steps to do anything special with messages received by this route.
24652 </para>
24653 <para>
24654 Historically Exim kept this option off by default, but the maintainers
24655 feel that in today&#x2019;s Internet, this causes more problems than it solves.
24656 It now defaults to true.
24657 A more detailed analysis of the issues is provided by Dan Bernstein:
24658 </para>
24659 <literallayout>
24660 <emphasis role="bold"><ulink url="https://cr.yp.to/smtp/8bitmime.html">https://cr.yp.to/smtp/8bitmime.html</ulink></emphasis>
24661 </literallayout>
24662 <para>
24663 To log received 8BITMIME status use
24664 </para>
24665 <literallayout class="monospaced">
24666 log_selector = +8bitmime
24667 </literallayout>
24668 <para>
24669 <indexterm role="option">
24670 <primary><option>acl_not_smtp</option></primary>
24671 </indexterm>
24672 </para>
24673 <informaltable frame="all">
24674 <tgroup cols="4" colsep="0" rowsep="0">
24675 <colspec colwidth="8*" align="left"/>
24676 <colspec colwidth="6*" align="center"/>
24677 <colspec colwidth="6*" align="center"/>
24678 <colspec colwidth="6*" align="right"/>
24679 <tbody>
24680 <row>
24681 <entry><option>acl_not_smtp</option></entry>
24682 <entry>Use: <emphasis>main</emphasis></entry>
24683 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24684 <entry>Default: <emphasis>unset</emphasis></entry>
24685 </row>
24686 </tbody>
24687 </tgroup>
24688 </informaltable>
24689 <para>
24690 <indexterm role="concept">
24691 <primary>access control lists (ACLs)</primary>
24692 <secondary>for non-SMTP messages</secondary>
24693 </indexterm>
24694 <indexterm role="concept">
24695 <primary>non-SMTP messages</primary>
24696 <secondary>ACLs for</secondary>
24697 </indexterm>
24698 This option defines the ACL that is run when a non-SMTP message has been
24699 read and is on the point of being accepted. See chapter <xref linkend="CHAPACL"/> for
24700 further details.
24701 </para>
24702 <para>
24703 <indexterm role="option">
24704 <primary><option>acl_not_smtp_mime</option></primary>
24705 </indexterm>
24706 </para>
24707 <informaltable frame="all">
24708 <tgroup cols="4" colsep="0" rowsep="0">
24709 <colspec colwidth="8*" align="left"/>
24710 <colspec colwidth="6*" align="center"/>
24711 <colspec colwidth="6*" align="center"/>
24712 <colspec colwidth="6*" align="right"/>
24713 <tbody>
24714 <row>
24715 <entry><option>acl_not_smtp_mime</option></entry>
24716 <entry>Use: <emphasis>main</emphasis></entry>
24717 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24718 <entry>Default: <emphasis>unset</emphasis></entry>
24719 </row>
24720 </tbody>
24721 </tgroup>
24722 </informaltable>
24723 <para>
24724 This option defines the ACL that is run for individual MIME parts of non-SMTP
24725 messages. It operates in exactly the same way as <option>acl_smtp_mime</option> operates for
24726 SMTP messages.
24727 </para>
24728 <para>
24729 <indexterm role="option">
24730 <primary><option>acl_not_smtp_start</option></primary>
24731 </indexterm>
24732 </para>
24733 <informaltable frame="all">
24734 <tgroup cols="4" colsep="0" rowsep="0">
24735 <colspec colwidth="8*" align="left"/>
24736 <colspec colwidth="6*" align="center"/>
24737 <colspec colwidth="6*" align="center"/>
24738 <colspec colwidth="6*" align="right"/>
24739 <tbody>
24740 <row>
24741 <entry><option>acl_not_smtp_start</option></entry>
24742 <entry>Use: <emphasis>main</emphasis></entry>
24743 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24744 <entry>Default: <emphasis>unset</emphasis></entry>
24745 </row>
24746 </tbody>
24747 </tgroup>
24748 </informaltable>
24749 <para>
24750 <indexterm role="concept">
24751 <primary>access control lists (ACLs)</primary>
24752 <secondary>at start of non-SMTP message</secondary>
24753 </indexterm>
24754 <indexterm role="concept">
24755 <primary>non-SMTP messages</primary>
24756 <secondary>ACLs for</secondary>
24757 </indexterm>
24758 This option defines the ACL that is run before Exim starts reading a
24759 non-SMTP message. See chapter <xref linkend="CHAPACL"/> for further details.
24760 </para>
24761 <para>
24762 <indexterm role="option">
24763 <primary><option>acl_smtp_auth</option></primary>
24764 </indexterm>
24765 </para>
24766 <informaltable frame="all">
24767 <tgroup cols="4" colsep="0" rowsep="0">
24768 <colspec colwidth="8*" align="left"/>
24769 <colspec colwidth="6*" align="center"/>
24770 <colspec colwidth="6*" align="center"/>
24771 <colspec colwidth="6*" align="right"/>
24772 <tbody>
24773 <row>
24774 <entry><option>acl_smtp_auth</option></entry>
24775 <entry>Use: <emphasis>main</emphasis></entry>
24776 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24777 <entry>Default: <emphasis>unset</emphasis></entry>
24778 </row>
24779 </tbody>
24780 </tgroup>
24781 </informaltable>
24782 <para>
24783 <indexterm role="concept">
24784 <primary>access control lists (ACLs)</primary>
24785 <secondary>setting up for SMTP commands</secondary>
24786 </indexterm>
24787 <indexterm role="concept">
24788 <primary>AUTH</primary>
24789 <secondary>ACL for</secondary>
24790 </indexterm>
24791 This option defines the ACL that is run when an SMTP AUTH command is
24792 received. See chapter <xref linkend="CHAPACL"/> for further details.
24793 </para>
24794 <para>
24795 <indexterm role="option">
24796 <primary><option>acl_smtp_connect</option></primary>
24797 </indexterm>
24798 </para>
24799 <informaltable frame="all">
24800 <tgroup cols="4" colsep="0" rowsep="0">
24801 <colspec colwidth="8*" align="left"/>
24802 <colspec colwidth="6*" align="center"/>
24803 <colspec colwidth="6*" align="center"/>
24804 <colspec colwidth="6*" align="right"/>
24805 <tbody>
24806 <row>
24807 <entry><option>acl_smtp_connect</option></entry>
24808 <entry>Use: <emphasis>main</emphasis></entry>
24809 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24810 <entry>Default: <emphasis>unset</emphasis></entry>
24811 </row>
24812 </tbody>
24813 </tgroup>
24814 </informaltable>
24815 <para>
24816 <indexterm role="concept">
24817 <primary>access control lists (ACLs)</primary>
24818 <secondary>on SMTP connection</secondary>
24819 </indexterm>
24820 This option defines the ACL that is run when an SMTP connection is received.
24821 See chapter <xref linkend="CHAPACL"/> for further details.
24822 </para>
24823 <para>
24824 <indexterm role="option">
24825 <primary><option>acl_smtp_data</option></primary>
24826 </indexterm>
24827 </para>
24828 <informaltable frame="all">
24829 <tgroup cols="4" colsep="0" rowsep="0">
24830 <colspec colwidth="8*" align="left"/>
24831 <colspec colwidth="6*" align="center"/>
24832 <colspec colwidth="6*" align="center"/>
24833 <colspec colwidth="6*" align="right"/>
24834 <tbody>
24835 <row>
24836 <entry><option>acl_smtp_data</option></entry>
24837 <entry>Use: <emphasis>main</emphasis></entry>
24838 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24839 <entry>Default: <emphasis>unset</emphasis></entry>
24840 </row>
24841 </tbody>
24842 </tgroup>
24843 </informaltable>
24844 <para>
24845 <indexterm role="concept">
24846 <primary>DATA</primary>
24847 <secondary>ACL for</secondary>
24848 </indexterm>
24849 This option defines the ACL that is run after an SMTP DATA command has been
24850 processed and the message itself has been received, but before the final
24851 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
24852 </para>
24853 <para>
24854 <indexterm role="option">
24855 <primary><option>acl_smtp_data_prdr</option></primary>
24856 </indexterm>
24857 </para>
24858 <informaltable frame="all">
24859 <tgroup cols="4" colsep="0" rowsep="0">
24860 <colspec colwidth="8*" align="left"/>
24861 <colspec colwidth="6*" align="center"/>
24862 <colspec colwidth="6*" align="center"/>
24863 <colspec colwidth="6*" align="right"/>
24864 <tbody>
24865 <row>
24866 <entry><option>acl_smtp_data_prdr</option></entry>
24867 <entry>Use: <emphasis>main</emphasis></entry>
24868 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24869 <entry>Default: <emphasis>accept</emphasis></entry>
24870 </row>
24871 </tbody>
24872 </tgroup>
24873 </informaltable>
24874 <para>
24875 <indexterm role="concept">
24876 <primary>PRDR</primary>
24877 <secondary>ACL for</secondary>
24878 </indexterm>
24879 <indexterm role="concept">
24880 <primary>DATA</primary>
24881 <secondary>PRDR ACL for</secondary>
24882 </indexterm>
24883 <indexterm role="concept">
24884 <primary>access control lists (ACLs)</primary>
24885 <secondary>PRDR-related</secondary>
24886 </indexterm>
24887 <indexterm role="concept">
24888 <primary>access control lists (ACLs)</primary>
24889 <secondary>per-user data processing</secondary>
24890 </indexterm>
24891 This option defines the ACL that,
24892 if the PRDR feature has been negotiated,
24893 is run for each recipient after an SMTP DATA command has been
24894 processed and the message itself has been received, but before the
24895 acknowledgment is sent. See chapter <xref linkend="CHAPACL"/> for further details.
24896 </para>
24897 <para>
24898 <indexterm role="option">
24899 <primary><option>acl_smtp_dkim</option></primary>
24900 </indexterm>
24901 </para>
24902 <informaltable frame="all">
24903 <tgroup cols="4" colsep="0" rowsep="0">
24904 <colspec colwidth="8*" align="left"/>
24905 <colspec colwidth="6*" align="center"/>
24906 <colspec colwidth="6*" align="center"/>
24907 <colspec colwidth="6*" align="right"/>
24908 <tbody>
24909 <row>
24910 <entry><option>acl_smtp_dkim</option></entry>
24911 <entry>Use: <emphasis>main</emphasis></entry>
24912 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24913 <entry>Default: <emphasis>unset</emphasis></entry>
24914 </row>
24915 </tbody>
24916 </tgroup>
24917 </informaltable>
24918 <para>
24919 <indexterm role="concept">
24920 <primary>DKIM</primary>
24921 <secondary>ACL for</secondary>
24922 </indexterm>
24923 This option defines the ACL that is run for each DKIM signature
24924 (by default, or as specified in the dkim_verify_signers option)
24925 of a received message.
24926 See section <xref linkend="SECDKIMVFY"/> for further details.
24927 </para>
24928 <para>
24929 <indexterm role="option">
24930 <primary><option>acl_smtp_etrn</option></primary>
24931 </indexterm>
24932 </para>
24933 <informaltable frame="all">
24934 <tgroup cols="4" colsep="0" rowsep="0">
24935 <colspec colwidth="8*" align="left"/>
24936 <colspec colwidth="6*" align="center"/>
24937 <colspec colwidth="6*" align="center"/>
24938 <colspec colwidth="6*" align="right"/>
24939 <tbody>
24940 <row>
24941 <entry><option>acl_smtp_etrn</option></entry>
24942 <entry>Use: <emphasis>main</emphasis></entry>
24943 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24944 <entry>Default: <emphasis>unset</emphasis></entry>
24945 </row>
24946 </tbody>
24947 </tgroup>
24948 </informaltable>
24949 <para>
24950 <indexterm role="concept">
24951 <primary>ETRN</primary>
24952 <secondary>ACL for</secondary>
24953 </indexterm>
24954 This option defines the ACL that is run when an SMTP ETRN command is
24955 received. See chapter <xref linkend="CHAPACL"/> for further details.
24956 </para>
24957 <para>
24958 <indexterm role="option">
24959 <primary><option>acl_smtp_expn</option></primary>
24960 </indexterm>
24961 </para>
24962 <informaltable frame="all">
24963 <tgroup cols="4" colsep="0" rowsep="0">
24964 <colspec colwidth="8*" align="left"/>
24965 <colspec colwidth="6*" align="center"/>
24966 <colspec colwidth="6*" align="center"/>
24967 <colspec colwidth="6*" align="right"/>
24968 <tbody>
24969 <row>
24970 <entry><option>acl_smtp_expn</option></entry>
24971 <entry>Use: <emphasis>main</emphasis></entry>
24972 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
24973 <entry>Default: <emphasis>unset</emphasis></entry>
24974 </row>
24975 </tbody>
24976 </tgroup>
24977 </informaltable>
24978 <para>
24979 <indexterm role="concept">
24980 <primary>EXPN</primary>
24981 <secondary>ACL for</secondary>
24982 </indexterm>
24983 This option defines the ACL that is run when an SMTP EXPN command is
24984 received. See chapter <xref linkend="CHAPACL"/> for further details.
24985 </para>
24986 <para>
24987 <indexterm role="option">
24988 <primary><option>acl_smtp_helo</option></primary>
24989 </indexterm>
24990 </para>
24991 <informaltable frame="all">
24992 <tgroup cols="4" colsep="0" rowsep="0">
24993 <colspec colwidth="8*" align="left"/>
24994 <colspec colwidth="6*" align="center"/>
24995 <colspec colwidth="6*" align="center"/>
24996 <colspec colwidth="6*" align="right"/>
24997 <tbody>
24998 <row>
24999 <entry><option>acl_smtp_helo</option></entry>
25000 <entry>Use: <emphasis>main</emphasis></entry>
25001 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25002 <entry>Default: <emphasis>unset</emphasis></entry>
25003 </row>
25004 </tbody>
25005 </tgroup>
25006 </informaltable>
25007 <para>
25008 <indexterm role="concept">
25009 <primary>EHLO</primary>
25010 <secondary>ACL for</secondary>
25011 </indexterm>
25012 <indexterm role="concept">
25013 <primary>HELO</primary>
25014 <secondary>ACL for</secondary>
25015 </indexterm>
25016 This option defines the ACL that is run when an SMTP EHLO or HELO
25017 command is received. See chapter <xref linkend="CHAPACL"/> for further details.
25018 </para>
25019 <para>
25020 <indexterm role="option">
25021 <primary><option>acl_smtp_mail</option></primary>
25022 </indexterm>
25023 </para>
25024 <informaltable frame="all">
25025 <tgroup cols="4" colsep="0" rowsep="0">
25026 <colspec colwidth="8*" align="left"/>
25027 <colspec colwidth="6*" align="center"/>
25028 <colspec colwidth="6*" align="center"/>
25029 <colspec colwidth="6*" align="right"/>
25030 <tbody>
25031 <row>
25032 <entry><option>acl_smtp_mail</option></entry>
25033 <entry>Use: <emphasis>main</emphasis></entry>
25034 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25035 <entry>Default: <emphasis>unset</emphasis></entry>
25036 </row>
25037 </tbody>
25038 </tgroup>
25039 </informaltable>
25040 <para>
25041 <indexterm role="concept">
25042 <primary>MAIL</primary>
25043 <secondary>ACL for</secondary>
25044 </indexterm>
25045 This option defines the ACL that is run when an SMTP MAIL command is
25046 received. See chapter <xref linkend="CHAPACL"/> for further details.
25047 </para>
25048 <para>
25049 <indexterm role="option">
25050 <primary><option>acl_smtp_mailauth</option></primary>
25051 </indexterm>
25052 </para>
25053 <informaltable frame="all">
25054 <tgroup cols="4" colsep="0" rowsep="0">
25055 <colspec colwidth="8*" align="left"/>
25056 <colspec colwidth="6*" align="center"/>
25057 <colspec colwidth="6*" align="center"/>
25058 <colspec colwidth="6*" align="right"/>
25059 <tbody>
25060 <row>
25061 <entry><option>acl_smtp_mailauth</option></entry>
25062 <entry>Use: <emphasis>main</emphasis></entry>
25063 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25064 <entry>Default: <emphasis>unset</emphasis></entry>
25065 </row>
25066 </tbody>
25067 </tgroup>
25068 </informaltable>
25069 <para>
25070 <indexterm role="concept">
25071 <primary>AUTH</primary>
25072 <secondary>on MAIL command</secondary>
25073 </indexterm>
25074 This option defines the ACL that is run when there is an AUTH parameter on
25075 a MAIL command. See chapter <xref linkend="CHAPACL"/> for details of ACLs, and chapter
25076 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
25077 </para>
25078 <para>
25079 <indexterm role="option">
25080 <primary><option>acl_smtp_mime</option></primary>
25081 </indexterm>
25082 </para>
25083 <informaltable frame="all">
25084 <tgroup cols="4" colsep="0" rowsep="0">
25085 <colspec colwidth="8*" align="left"/>
25086 <colspec colwidth="6*" align="center"/>
25087 <colspec colwidth="6*" align="center"/>
25088 <colspec colwidth="6*" align="right"/>
25089 <tbody>
25090 <row>
25091 <entry><option>acl_smtp_mime</option></entry>
25092 <entry>Use: <emphasis>main</emphasis></entry>
25093 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25094 <entry>Default: <emphasis>unset</emphasis></entry>
25095 </row>
25096 </tbody>
25097 </tgroup>
25098 </informaltable>
25099 <para>
25100 <indexterm role="concept">
25101 <primary>MIME content scanning</primary>
25102 <secondary>ACL for</secondary>
25103 </indexterm>
25104 This option is available when Exim is built with the content-scanning
25105 extension. It defines the ACL that is run for each MIME part in a message. See
25106 section <xref linkend="SECTscanmimepart"/> for details.
25107 </para>
25108 <para>
25109 <indexterm role="option">
25110 <primary><option>acl_smtp_notquit</option></primary>
25111 </indexterm>
25112 </para>
25113 <informaltable frame="all">
25114 <tgroup cols="4" colsep="0" rowsep="0">
25115 <colspec colwidth="8*" align="left"/>
25116 <colspec colwidth="6*" align="center"/>
25117 <colspec colwidth="6*" align="center"/>
25118 <colspec colwidth="6*" align="right"/>
25119 <tbody>
25120 <row>
25121 <entry><option>acl_smtp_notquit</option></entry>
25122 <entry>Use: <emphasis>main</emphasis></entry>
25123 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25124 <entry>Default: <emphasis>unset</emphasis></entry>
25125 </row>
25126 </tbody>
25127 </tgroup>
25128 </informaltable>
25129 <para>
25130 <indexterm role="concept">
25131 <primary>not-QUIT, ACL for</primary>
25132 </indexterm>
25133 This option defines the ACL that is run when an SMTP session
25134 ends without a QUIT command being received.
25135 See chapter <xref linkend="CHAPACL"/> for further details.
25136 </para>
25137 <para>
25138 <indexterm role="option">
25139 <primary><option>acl_smtp_predata</option></primary>
25140 </indexterm>
25141 </para>
25142 <informaltable frame="all">
25143 <tgroup cols="4" colsep="0" rowsep="0">
25144 <colspec colwidth="8*" align="left"/>
25145 <colspec colwidth="6*" align="center"/>
25146 <colspec colwidth="6*" align="center"/>
25147 <colspec colwidth="6*" align="right"/>
25148 <tbody>
25149 <row>
25150 <entry><option>acl_smtp_predata</option></entry>
25151 <entry>Use: <emphasis>main</emphasis></entry>
25152 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25153 <entry>Default: <emphasis>unset</emphasis></entry>
25154 </row>
25155 </tbody>
25156 </tgroup>
25157 </informaltable>
25158 <para>
25159 This option defines the ACL that is run when an SMTP DATA command is
25160 received, before the message itself is received. See chapter <xref linkend="CHAPACL"/> for
25161 further details.
25162 </para>
25163 <para>
25164 <indexterm role="option">
25165 <primary><option>acl_smtp_quit</option></primary>
25166 </indexterm>
25167 </para>
25168 <informaltable frame="all">
25169 <tgroup cols="4" colsep="0" rowsep="0">
25170 <colspec colwidth="8*" align="left"/>
25171 <colspec colwidth="6*" align="center"/>
25172 <colspec colwidth="6*" align="center"/>
25173 <colspec colwidth="6*" align="right"/>
25174 <tbody>
25175 <row>
25176 <entry><option>acl_smtp_quit</option></entry>
25177 <entry>Use: <emphasis>main</emphasis></entry>
25178 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25179 <entry>Default: <emphasis>unset</emphasis></entry>
25180 </row>
25181 </tbody>
25182 </tgroup>
25183 </informaltable>
25184 <para>
25185 <indexterm role="concept">
25186 <primary>QUIT, ACL for</primary>
25187 </indexterm>
25188 This option defines the ACL that is run when an SMTP QUIT command is
25189 received. See chapter <xref linkend="CHAPACL"/> for further details.
25190 </para>
25191 <para>
25192 <indexterm role="option">
25193 <primary><option>acl_smtp_rcpt</option></primary>
25194 </indexterm>
25195 </para>
25196 <informaltable frame="all">
25197 <tgroup cols="4" colsep="0" rowsep="0">
25198 <colspec colwidth="8*" align="left"/>
25199 <colspec colwidth="6*" align="center"/>
25200 <colspec colwidth="6*" align="center"/>
25201 <colspec colwidth="6*" align="right"/>
25202 <tbody>
25203 <row>
25204 <entry><option>acl_smtp_rcpt</option></entry>
25205 <entry>Use: <emphasis>main</emphasis></entry>
25206 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25207 <entry>Default: <emphasis>unset</emphasis></entry>
25208 </row>
25209 </tbody>
25210 </tgroup>
25211 </informaltable>
25212 <para>
25213 <indexterm role="concept">
25214 <primary>RCPT</primary>
25215 <secondary>ACL for</secondary>
25216 </indexterm>
25217 This option defines the ACL that is run when an SMTP RCPT command is
25218 received. See chapter <xref linkend="CHAPACL"/> for further details.
25219 </para>
25220 <para>
25221 <indexterm role="option">
25222 <primary><option>acl_smtp_starttls</option></primary>
25223 </indexterm>
25224 </para>
25225 <informaltable frame="all">
25226 <tgroup cols="4" colsep="0" rowsep="0">
25227 <colspec colwidth="8*" align="left"/>
25228 <colspec colwidth="6*" align="center"/>
25229 <colspec colwidth="6*" align="center"/>
25230 <colspec colwidth="6*" align="right"/>
25231 <tbody>
25232 <row>
25233 <entry><option>acl_smtp_starttls</option></entry>
25234 <entry>Use: <emphasis>main</emphasis></entry>
25235 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25236 <entry>Default: <emphasis>unset</emphasis></entry>
25237 </row>
25238 </tbody>
25239 </tgroup>
25240 </informaltable>
25241 <para>
25242 <indexterm role="concept">
25243 <primary>STARTTLS, ACL for</primary>
25244 </indexterm>
25245 This option defines the ACL that is run when an SMTP STARTTLS command is
25246 received. See chapter <xref linkend="CHAPACL"/> for further details.
25247 </para>
25248 <para>
25249 <indexterm role="option">
25250 <primary><option>acl_smtp_vrfy</option></primary>
25251 </indexterm>
25252 </para>
25253 <informaltable frame="all">
25254 <tgroup cols="4" colsep="0" rowsep="0">
25255 <colspec colwidth="8*" align="left"/>
25256 <colspec colwidth="6*" align="center"/>
25257 <colspec colwidth="6*" align="center"/>
25258 <colspec colwidth="6*" align="right"/>
25259 <tbody>
25260 <row>
25261 <entry><option>acl_smtp_vrfy</option></entry>
25262 <entry>Use: <emphasis>main</emphasis></entry>
25263 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25264 <entry>Default: <emphasis>unset</emphasis></entry>
25265 </row>
25266 </tbody>
25267 </tgroup>
25268 </informaltable>
25269 <para>
25270 <indexterm role="concept">
25271 <primary>VRFY</primary>
25272 <secondary>ACL for</secondary>
25273 </indexterm>
25274 This option defines the ACL that is run when an SMTP VRFY command is
25275 received. See chapter <xref linkend="CHAPACL"/> for further details.
25276 </para>
25277 <para>
25278 <indexterm role="option">
25279 <primary><option>add_environment</option></primary>
25280 </indexterm>
25281 </para>
25282 <informaltable frame="all">
25283 <tgroup cols="4" colsep="0" rowsep="0">
25284 <colspec colwidth="8*" align="left"/>
25285 <colspec colwidth="6*" align="center"/>
25286 <colspec colwidth="6*" align="center"/>
25287 <colspec colwidth="6*" align="right"/>
25288 <tbody>
25289 <row>
25290 <entry><option>add_environment</option></entry>
25291 <entry>Use: <emphasis>main</emphasis></entry>
25292 <entry>Type: <emphasis>string list</emphasis></entry>
25293 <entry>Default: <emphasis>empty</emphasis></entry>
25294 </row>
25295 </tbody>
25296 </tgroup>
25297 </informaltable>
25298 <para>
25299 <indexterm role="concept">
25300 <primary>environment</primary>
25301 <secondary>set values</secondary>
25302 </indexterm>
25303 This option adds individual environment variables that the
25304 currently linked libraries and programs in child processes may use.
25305 Each list element should be of the form <quote>name=value</quote>.
25306 </para>
25307 <para>
25308 See <xref linkend="SECTpipeenv"/> for the environment of <command>pipe</command> transports.
25309 </para>
25310 <para>
25311 <indexterm role="option">
25312 <primary><option>admin_groups</option></primary>
25313 </indexterm>
25314 </para>
25315 <informaltable frame="all">
25316 <tgroup cols="4" colsep="0" rowsep="0">
25317 <colspec colwidth="8*" align="left"/>
25318 <colspec colwidth="6*" align="center"/>
25319 <colspec colwidth="6*" align="center"/>
25320 <colspec colwidth="6*" align="right"/>
25321 <tbody>
25322 <row>
25323 <entry><option>admin_groups</option></entry>
25324 <entry>Use: <emphasis>main</emphasis></entry>
25325 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
25326 <entry>Default: <emphasis>unset</emphasis></entry>
25327 </row>
25328 </tbody>
25329 </tgroup>
25330 </informaltable>
25331 <para>
25332 <indexterm role="concept">
25333 <primary>admin user</primary>
25334 </indexterm>
25335 This option is expanded just once, at the start of Exim&#x2019;s processing. If the
25336 current group or any of the supplementary groups of an Exim caller is in this
25337 colon-separated list, the caller has admin privileges. If all your system
25338 programmers are in a specific group, for example, you can give them all Exim
25339 admin privileges by putting that group in <option>admin_groups</option>. However, this does
25340 not permit them to read Exim&#x2019;s spool files (whose group owner is the Exim gid).
25341 To permit this, you have to add individuals to the Exim group.
25342 </para>
25343 <para>
25344 <indexterm role="option">
25345 <primary><option>allow_domain_literals</option></primary>
25346 </indexterm>
25347 </para>
25348 <informaltable frame="all">
25349 <tgroup cols="4" colsep="0" rowsep="0">
25350 <colspec colwidth="8*" align="left"/>
25351 <colspec colwidth="6*" align="center"/>
25352 <colspec colwidth="6*" align="center"/>
25353 <colspec colwidth="6*" align="right"/>
25354 <tbody>
25355 <row>
25356 <entry><option>allow_domain_literals</option></entry>
25357 <entry>Use: <emphasis>main</emphasis></entry>
25358 <entry>Type: <emphasis>boolean</emphasis></entry>
25359 <entry>Default: <emphasis>false</emphasis></entry>
25360 </row>
25361 </tbody>
25362 </tgroup>
25363 </informaltable>
25364 <para>
25365 <indexterm role="concept">
25366 <primary>domain literal</primary>
25367 </indexterm>
25368 If this option is set, the RFC 2822 domain literal format is permitted in
25369 email addresses. The option is not set by default, because the domain literal
25370 format is not normally required these days, and few people know about it. It
25371 has, however, been exploited by mail abusers.
25372 </para>
25373 <para>
25374 Unfortunately, it seems that some DNS black list maintainers are using this
25375 format to report black listing to postmasters. If you want to accept messages
25376 addressed to your hosts by IP address, you need to set
25377 <option>allow_domain_literals</option> true, and also to add <literal>@[]</literal> to the list of local
25378 domains (defined in the named domain list <option>local_domains</option> in the default
25379 configuration). This <quote>magic string</quote> matches the domain literal form of all
25380 the local host&#x2019;s IP addresses.
25381 </para>
25382 <para>
25383 <indexterm role="option">
25384 <primary><option>allow_mx_to_ip</option></primary>
25385 </indexterm>
25386 </para>
25387 <informaltable frame="all">
25388 <tgroup cols="4" colsep="0" rowsep="0">
25389 <colspec colwidth="8*" align="left"/>
25390 <colspec colwidth="6*" align="center"/>
25391 <colspec colwidth="6*" align="center"/>
25392 <colspec colwidth="6*" align="right"/>
25393 <tbody>
25394 <row>
25395 <entry><option>allow_mx_to_ip</option></entry>
25396 <entry>Use: <emphasis>main</emphasis></entry>
25397 <entry>Type: <emphasis>boolean</emphasis></entry>
25398 <entry>Default: <emphasis>false</emphasis></entry>
25399 </row>
25400 </tbody>
25401 </tgroup>
25402 </informaltable>
25403 <para>
25404 <indexterm role="concept">
25405 <primary>MX record</primary>
25406 <secondary>pointing to IP address</secondary>
25407 </indexterm>
25408 It appears that more and more DNS zone administrators are breaking the rules
25409 and putting domain names that look like IP addresses on the right hand side of
25410 MX records. Exim follows the rules and rejects this, giving an error message
25411 that explains the misconfiguration. However, some other MTAs support this
25412 practice, so to avoid <quote>Why can&#x2019;t Exim do this?</quote> complaints,
25413 <option>allow_mx_to_ip</option> exists, in order to enable this heinous activity. It is not
25414 recommended, except when you have no other choice.
25415 </para>
25416 <para>
25417 <indexterm role="option">
25418 <primary><option>allow_utf8_domains</option></primary>
25419 </indexterm>
25420 </para>
25421 <informaltable frame="all">
25422 <tgroup cols="4" colsep="0" rowsep="0">
25423 <colspec colwidth="8*" align="left"/>
25424 <colspec colwidth="6*" align="center"/>
25425 <colspec colwidth="6*" align="center"/>
25426 <colspec colwidth="6*" align="right"/>
25427 <tbody>
25428 <row>
25429 <entry><option>allow_utf8_domains</option></entry>
25430 <entry>Use: <emphasis>main</emphasis></entry>
25431 <entry>Type: <emphasis>boolean</emphasis></entry>
25432 <entry>Default: <emphasis>false</emphasis></entry>
25433 </row>
25434 </tbody>
25435 </tgroup>
25436 </informaltable>
25437 <para>
25438 <indexterm role="concept">
25439 <primary>domain</primary>
25440 <secondary>UTF-8 characters in</secondary>
25441 </indexterm>
25442 <indexterm role="concept">
25443 <primary>UTF-8</primary>
25444 <secondary>in domain name</secondary>
25445 </indexterm>
25446 Lots of discussion is going on about internationalized domain names. One
25447 camp is strongly in favour of just using UTF-8 characters, and it seems
25448 that at least two other MTAs permit this.
25449 This option allows Exim users to experiment if they wish.
25450 </para>
25451 <para>
25452 If it is set true, Exim&#x2019;s domain parsing function allows valid
25453 UTF-8 multicharacters to appear in domain name components, in addition to
25454 letters, digits, and hyphens.
25455 </para>
25456 <para>
25457 If Exim is built with internationalization support
25458 and the SMTPUTF8 ESMTP option is in use (see chapter <xref linkend="CHAPi18n"/>)
25459 this option can be left as default.
25460 Without that,
25461 if you want to look up such domain names in the DNS, you must also
25462 adjust the value of <option>dns_check_names_pattern</option> to match the extended form. A
25463 suitable setting is:
25464 </para>
25465 <literallayout class="monospaced">
25466 dns_check_names_pattern = (?i)^(?&gt;(?(1)\.|())[a-z0-9\xc0-\xff]\
25467   (?&gt;[-a-z0-9\x80-\xff]*[a-z0-9\x80-\xbf])?)+$
25468 </literallayout>
25469 <para>
25470 Alternatively, you can just disable this feature by setting
25471 </para>
25472 <literallayout class="monospaced">
25473 dns_check_names_pattern =
25474 </literallayout>
25475 <para>
25476 That is, set the option to an empty string so that no check is done.
25477 </para>
25478 <para>
25479 <indexterm role="option">
25480 <primary><option>auth_advertise_hosts</option></primary>
25481 </indexterm>
25482 </para>
25483 <informaltable frame="all">
25484 <tgroup cols="4" colsep="0" rowsep="0">
25485 <colspec colwidth="8*" align="left"/>
25486 <colspec colwidth="6*" align="center"/>
25487 <colspec colwidth="6*" align="center"/>
25488 <colspec colwidth="6*" align="right"/>
25489 <tbody>
25490 <row>
25491 <entry><option>auth_advertise_hosts</option></entry>
25492 <entry>Use: <emphasis>main</emphasis></entry>
25493 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
25494 <entry>Default: <emphasis>*</emphasis></entry>
25495 </row>
25496 </tbody>
25497 </tgroup>
25498 </informaltable>
25499 <para>
25500 <indexterm role="concept">
25501 <primary>authentication</primary>
25502 <secondary>advertising</secondary>
25503 </indexterm>
25504 <indexterm role="concept">
25505 <primary>AUTH</primary>
25506 <secondary>advertising</secondary>
25507 </indexterm>
25508 <indexterm role="concept">
25509 <primary>ESMTP extensions</primary>
25510 <secondary>AUTH</secondary>
25511 </indexterm>
25512 If any server authentication mechanisms are configured, Exim advertises them in
25513 response to an EHLO command only if the calling host matches this list.
25514 Otherwise, Exim does not advertise AUTH.
25515 Exim does not accept AUTH commands from clients to which it has not
25516 advertised the availability of AUTH. The advertising of individual
25517 authentication mechanisms can be controlled by the use of the
25518 <option>server_advertise_condition</option> generic authenticator option on the individual
25519 authenticators. See chapter <xref linkend="CHAPSMTPAUTH"/> for further details.
25520 </para>
25521 <para>
25522 Certain mail clients (for example, Netscape) require the user to provide a name
25523 and password for authentication if AUTH is advertised, even though it may
25524 not be needed (the host may accept messages from hosts on its local LAN without
25525 authentication, for example). The <option>auth_advertise_hosts</option> option can be used
25526 to make these clients more friendly by excluding them from the set of hosts to
25527 which Exim advertises AUTH.
25528 </para>
25529 <para>
25530 <indexterm role="concept">
25531 <primary>AUTH</primary>
25532 <secondary>advertising when encrypted</secondary>
25533 </indexterm>
25534 If you want to advertise the availability of AUTH only when the connection
25535 is encrypted using TLS, you can make use of the fact that the value of this
25536 option is expanded, with a setting like this:
25537 </para>
25538 <literallayout class="monospaced">
25539 auth_advertise_hosts = ${if eq{$tls_in_cipher}{}{}{*}}
25540 </literallayout>
25541 <para>
25542 <indexterm role="variable">
25543 <primary><varname>$tls_in_cipher</varname></primary>
25544 </indexterm>
25545 If <varname>$tls_in_cipher</varname> is empty, the session is not encrypted, and the result of
25546 the expansion is empty, thus matching no hosts. Otherwise, the result of the
25547 expansion is *, which matches all hosts.
25548 </para>
25549 <para>
25550 <indexterm role="option">
25551 <primary><option>auto_thaw</option></primary>
25552 </indexterm>
25553 </para>
25554 <informaltable frame="all">
25555 <tgroup cols="4" colsep="0" rowsep="0">
25556 <colspec colwidth="8*" align="left"/>
25557 <colspec colwidth="6*" align="center"/>
25558 <colspec colwidth="6*" align="center"/>
25559 <colspec colwidth="6*" align="right"/>
25560 <tbody>
25561 <row>
25562 <entry><option>auto_thaw</option></entry>
25563 <entry>Use: <emphasis>main</emphasis></entry>
25564 <entry>Type: <emphasis>time</emphasis></entry>
25565 <entry>Default: <emphasis>0s</emphasis></entry>
25566 </row>
25567 </tbody>
25568 </tgroup>
25569 </informaltable>
25570 <para>
25571 <indexterm role="concept">
25572 <primary>thawing messages</primary>
25573 </indexterm>
25574 <indexterm role="concept">
25575 <primary>unfreezing messages</primary>
25576 </indexterm>
25577 If this option is set to a time greater than zero, a queue runner will try a
25578 new delivery attempt on any frozen message, other than a bounce message, if
25579 this much time has passed since it was frozen. This may result in the message
25580 being re-frozen if nothing has changed since the last attempt. It is a way of
25581 saying <quote>keep on trying, even though there are big problems</quote>.
25582 </para>
25583 <para>
25584 <emphasis role="bold">Note</emphasis>: This is an old option, which predates <option>timeout_frozen_after</option> and
25585 <option>ignore_bounce_errors_after</option>. It is retained for compatibility, but it is not
25586 thought to be very useful any more, and its use should probably be avoided.
25587 </para>
25588 <para>
25589 <indexterm role="option">
25590 <primary><option>av_scanner</option></primary>
25591 </indexterm>
25592 </para>
25593 <informaltable frame="all">
25594 <tgroup cols="4" colsep="0" rowsep="0">
25595 <colspec colwidth="8*" align="left"/>
25596 <colspec colwidth="6*" align="center"/>
25597 <colspec colwidth="6*" align="center"/>
25598 <colspec colwidth="6*" align="right"/>
25599 <tbody>
25600 <row>
25601 <entry><option>av_scanner</option></entry>
25602 <entry>Use: <emphasis>main</emphasis></entry>
25603 <entry>Type: <emphasis>string</emphasis></entry>
25604 <entry>Default: <emphasis>see below</emphasis></entry>
25605 </row>
25606 </tbody>
25607 </tgroup>
25608 </informaltable>
25609 <para>
25610 This option is available if Exim is built with the content-scanning extension.
25611 It specifies which anti-virus scanner to use. The default value is:
25612 </para>
25613 <literallayout class="monospaced">
25614 sophie:/var/run/sophie
25615 </literallayout>
25616 <para>
25617 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
25618 before use. See section <xref linkend="SECTscanvirus"/> for further details.
25619 </para>
25620 <para>
25621 <indexterm role="option">
25622 <primary><option>bi_command</option></primary>
25623 </indexterm>
25624 </para>
25625 <informaltable frame="all">
25626 <tgroup cols="4" colsep="0" rowsep="0">
25627 <colspec colwidth="8*" align="left"/>
25628 <colspec colwidth="6*" align="center"/>
25629 <colspec colwidth="6*" align="center"/>
25630 <colspec colwidth="6*" align="right"/>
25631 <tbody>
25632 <row>
25633 <entry><option>bi_command</option></entry>
25634 <entry>Use: <emphasis>main</emphasis></entry>
25635 <entry>Type: <emphasis>string</emphasis></entry>
25636 <entry>Default: <emphasis>unset</emphasis></entry>
25637 </row>
25638 </tbody>
25639 </tgroup>
25640 </informaltable>
25641 <para>
25642 <indexterm role="option">
25643 <primary><option>-bi</option></primary>
25644 </indexterm>
25645 This option supplies the name of a command that is run when Exim is called with
25646 the <option>-bi</option> option (see chapter <xref linkend="CHAPcommandline"/>). The string value is
25647 just the command name, it is not a complete command line. If an argument is
25648 required, it must come from the <option>-oA</option> command line option.
25649 </para>
25650 <para>
25651 <indexterm role="option">
25652 <primary><option>bounce_message_file</option></primary>
25653 </indexterm>
25654 </para>
25655 <informaltable frame="all">
25656 <tgroup cols="4" colsep="0" rowsep="0">
25657 <colspec colwidth="8*" align="left"/>
25658 <colspec colwidth="6*" align="center"/>
25659 <colspec colwidth="6*" align="center"/>
25660 <colspec colwidth="6*" align="right"/>
25661 <tbody>
25662 <row>
25663 <entry><option>bounce_message_file</option></entry>
25664 <entry>Use: <emphasis>main</emphasis></entry>
25665 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
25666 <entry>Default: <emphasis>unset</emphasis></entry>
25667 </row>
25668 </tbody>
25669 </tgroup>
25670 </informaltable>
25671 <para>
25672 <indexterm role="concept">
25673 <primary>bounce message</primary>
25674 <secondary>customizing</secondary>
25675 </indexterm>
25676 <indexterm role="concept">
25677 <primary>customizing</primary>
25678 <secondary>bounce message</secondary>
25679 </indexterm>
25680 This option defines a template file containing paragraphs of text to be used
25681 for constructing bounce messages.  Details of the file&#x2019;s contents are given in
25682 chapter <xref linkend="CHAPemsgcust"/>.
25683 <indexterm role="concept">
25684 <primary>bounce_message_file</primary>
25685 <secondary>tainted data</secondary>
25686 </indexterm>
25687 The option is expanded to give the file path, which must be
25688 absolute and untainted.
25689 See also <option>warn_message_file</option>.
25690 </para>
25691 <para>
25692 <indexterm role="option">
25693 <primary><option>bounce_message_text</option></primary>
25694 </indexterm>
25695 </para>
25696 <informaltable frame="all">
25697 <tgroup cols="4" colsep="0" rowsep="0">
25698 <colspec colwidth="8*" align="left"/>
25699 <colspec colwidth="6*" align="center"/>
25700 <colspec colwidth="6*" align="center"/>
25701 <colspec colwidth="6*" align="right"/>
25702 <tbody>
25703 <row>
25704 <entry><option>bounce_message_text</option></entry>
25705 <entry>Use: <emphasis>main</emphasis></entry>
25706 <entry>Type: <emphasis>string</emphasis></entry>
25707 <entry>Default: <emphasis>unset</emphasis></entry>
25708 </row>
25709 </tbody>
25710 </tgroup>
25711 </informaltable>
25712 <para>
25713 When this option is set, its contents are included in the default bounce
25714 message immediately after <quote>This message was created automatically by mail
25715 delivery software.</quote> It is not used if <option>bounce_message_file</option> is set.
25716 </para>
25717 <para>
25718 <indexterm role="option">
25719 <primary><option>bounce_return_body</option></primary>
25720 </indexterm>
25721 </para>
25722 <informaltable frame="all">
25723 <tgroup cols="4" colsep="0" rowsep="0">
25724 <colspec colwidth="8*" align="left"/>
25725 <colspec colwidth="6*" align="center"/>
25726 <colspec colwidth="6*" align="center"/>
25727 <colspec colwidth="6*" align="right"/>
25728 <tbody>
25729 <row>
25730 <entry><option>bounce_return_body</option></entry>
25731 <entry>Use: <emphasis>main</emphasis></entry>
25732 <entry>Type: <emphasis>boolean</emphasis></entry>
25733 <entry>Default: <emphasis>true</emphasis></entry>
25734 </row>
25735 </tbody>
25736 </tgroup>
25737 </informaltable>
25738 <para>
25739 <indexterm role="concept">
25740 <primary>bounce message</primary>
25741 <secondary>including body</secondary>
25742 </indexterm>
25743 This option controls whether the body of an incoming message is included in a
25744 bounce message when <option>bounce_return_message</option> is true. The default setting
25745 causes the entire message, both header and body, to be returned (subject to the
25746 value of <option>bounce_return_size_limit</option>). If this option is false, only the
25747 message header is included. In the case of a non-SMTP message containing an
25748 error that is detected during reception, only those header lines preceding the
25749 point at which the error was detected are returned.
25750 <indexterm role="concept">
25751 <primary>bounce message</primary>
25752 <secondary>including original</secondary>
25753 </indexterm>
25754 </para>
25755 <para>
25756 <indexterm role="option">
25757 <primary><option>bounce_return_linesize_limit</option></primary>
25758 </indexterm>
25759 </para>
25760 <informaltable frame="all">
25761 <tgroup cols="4" colsep="0" rowsep="0">
25762 <colspec colwidth="8*" align="left"/>
25763 <colspec colwidth="6*" align="center"/>
25764 <colspec colwidth="6*" align="center"/>
25765 <colspec colwidth="6*" align="right"/>
25766 <tbody>
25767 <row>
25768 <entry><option>bounce_return_linesize_limit</option></entry>
25769 <entry>Use: <emphasis>main</emphasis></entry>
25770 <entry>Type: <emphasis>integer</emphasis></entry>
25771 <entry>Default: <emphasis>998</emphasis></entry>
25772 </row>
25773 </tbody>
25774 </tgroup>
25775 </informaltable>
25776 <para>
25777 <indexterm role="concept">
25778 <primary>size</primary>
25779 <secondary>of bounce lines, limit</secondary>
25780 </indexterm>
25781 <indexterm role="concept">
25782 <primary>bounce message</primary>
25783 <secondary>line length limit</secondary>
25784 </indexterm>
25785 <indexterm role="concept">
25786 <primary>limit</primary>
25787 <secondary>bounce message line length</secondary>
25788 </indexterm>
25789 This option sets a limit in bytes on the line length of messages
25790 that are returned to senders due to delivery problems,
25791 when <option>bounce_return_message</option> is true.
25792 The default value corresponds to RFC limits.
25793 If the message being returned has lines longer than this value it is
25794 treated as if the <option>bounce_return_size_limit</option> (below) restriction was exceeded.
25795 </para>
25796 <para>
25797 The option also applies to bounces returned when an error is detected
25798 during reception of a message.
25799 In this case lines from the original are truncated.
25800 </para>
25801 <para>
25802 The option does not apply to messages generated by an <command>autoreply</command> transport.
25803 </para>
25804 <para>
25805 <indexterm role="option">
25806 <primary><option>bounce_return_message</option></primary>
25807 </indexterm>
25808 </para>
25809 <informaltable frame="all">
25810 <tgroup cols="4" colsep="0" rowsep="0">
25811 <colspec colwidth="8*" align="left"/>
25812 <colspec colwidth="6*" align="center"/>
25813 <colspec colwidth="6*" align="center"/>
25814 <colspec colwidth="6*" align="right"/>
25815 <tbody>
25816 <row>
25817 <entry><option>bounce_return_message</option></entry>
25818 <entry>Use: <emphasis>main</emphasis></entry>
25819 <entry>Type: <emphasis>boolean</emphasis></entry>
25820 <entry>Default: <emphasis>true</emphasis></entry>
25821 </row>
25822 </tbody>
25823 </tgroup>
25824 </informaltable>
25825 <para>
25826 If this option is set false, none of the original message is included in
25827 bounce messages generated by Exim. See also <option>bounce_return_size_limit</option> and
25828 <option>bounce_return_body</option>.
25829 </para>
25830 <para>
25831 <indexterm role="option">
25832 <primary><option>bounce_return_size_limit</option></primary>
25833 </indexterm>
25834 </para>
25835 <informaltable frame="all">
25836 <tgroup cols="4" colsep="0" rowsep="0">
25837 <colspec colwidth="8*" align="left"/>
25838 <colspec colwidth="6*" align="center"/>
25839 <colspec colwidth="6*" align="center"/>
25840 <colspec colwidth="6*" align="right"/>
25841 <tbody>
25842 <row>
25843 <entry><option>bounce_return_size_limit</option></entry>
25844 <entry>Use: <emphasis>main</emphasis></entry>
25845 <entry>Type: <emphasis>integer</emphasis></entry>
25846 <entry>Default: <emphasis>100K</emphasis></entry>
25847 </row>
25848 </tbody>
25849 </tgroup>
25850 </informaltable>
25851 <para>
25852 <indexterm role="concept">
25853 <primary>size</primary>
25854 <secondary>of bounce, limit</secondary>
25855 </indexterm>
25856 <indexterm role="concept">
25857 <primary>bounce message</primary>
25858 <secondary>size limit</secondary>
25859 </indexterm>
25860 <indexterm role="concept">
25861 <primary>limit</primary>
25862 <secondary>bounce message size</secondary>
25863 </indexterm>
25864 This option sets a limit in bytes on the size of messages that are returned to
25865 senders as part of bounce messages when <option>bounce_return_message</option> is true. The
25866 limit should be less than the value of the global <option>message_size_limit</option> and of
25867 any <option>message_size_limit</option> settings on transports, to allow for the bounce text
25868 that Exim generates. If this option is set to zero there is no limit.
25869 </para>
25870 <para>
25871 When the body of any message that is to be included in a bounce message is
25872 greater than the limit, it is truncated, and a comment pointing this out is
25873 added at the top. The actual cutoff may be greater than the value given, owing
25874 to the use of buffering for transferring the message in chunks (typically 8K in
25875 size). The idea is to save bandwidth on those undeliverable 15-megabyte
25876 messages.
25877 </para>
25878 <para>
25879 <indexterm role="option">
25880 <primary><option>bounce_sender_authentication</option></primary>
25881 </indexterm>
25882 </para>
25883 <informaltable frame="all">
25884 <tgroup cols="4" colsep="0" rowsep="0">
25885 <colspec colwidth="8*" align="left"/>
25886 <colspec colwidth="6*" align="center"/>
25887 <colspec colwidth="6*" align="center"/>
25888 <colspec colwidth="6*" align="right"/>
25889 <tbody>
25890 <row>
25891 <entry><option>bounce_sender_authentication</option></entry>
25892 <entry>Use: <emphasis>main</emphasis></entry>
25893 <entry>Type: <emphasis>string</emphasis></entry>
25894 <entry>Default: <emphasis>unset</emphasis></entry>
25895 </row>
25896 </tbody>
25897 </tgroup>
25898 </informaltable>
25899 <para>
25900 <indexterm role="concept">
25901 <primary>bounce message</primary>
25902 <secondary>sender authentication</secondary>
25903 </indexterm>
25904 <indexterm role="concept">
25905 <primary>authentication</primary>
25906 <secondary>bounce message</secondary>
25907 </indexterm>
25908 <indexterm role="concept">
25909 <primary>AUTH</primary>
25910 <secondary>on bounce message</secondary>
25911 </indexterm>
25912 This option provides an authenticated sender address that is sent with any
25913 bounce messages generated by Exim that are sent over an authenticated SMTP
25914 connection. A typical setting might be:
25915 </para>
25916 <literallayout class="monospaced">
25917 bounce_sender_authentication = mailer-daemon@my.domain.example
25918 </literallayout>
25919 <para>
25920 which would cause bounce messages to be sent using the SMTP command:
25921 </para>
25922 <literallayout class="monospaced">
25923 MAIL FROM:&lt;&gt; AUTH=mailer-daemon@my.domain.example
25924 </literallayout>
25925 <para>
25926 The value of <option>bounce_sender_authentication</option> must always be a complete email
25927 address.
25928 </para>
25929 <para>
25930 <indexterm role="option">
25931 <primary><option>callout_domain_negative_expire</option></primary>
25932 </indexterm>
25933 </para>
25934 <informaltable frame="all">
25935 <tgroup cols="4" colsep="0" rowsep="0">
25936 <colspec colwidth="8*" align="left"/>
25937 <colspec colwidth="6*" align="center"/>
25938 <colspec colwidth="6*" align="center"/>
25939 <colspec colwidth="6*" align="right"/>
25940 <tbody>
25941 <row>
25942 <entry><option>callout_domain_negative_expire</option></entry>
25943 <entry>Use: <emphasis>main</emphasis></entry>
25944 <entry>Type: <emphasis>time</emphasis></entry>
25945 <entry>Default: <emphasis>3h</emphasis></entry>
25946 </row>
25947 </tbody>
25948 </tgroup>
25949 </informaltable>
25950 <para>
25951 <indexterm role="concept">
25952 <primary>caching</primary>
25953 <secondary>callout timeouts</secondary>
25954 </indexterm>
25955 <indexterm role="concept">
25956 <primary>callout</primary>
25957 <secondary>caching timeouts</secondary>
25958 </indexterm>
25959 This option specifies the expiry time for negative callout cache data for a
25960 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
25961 section <xref linkend="SECTcallvercache"/> for details of the caching.
25962 </para>
25963 <para>
25964 <indexterm role="option">
25965 <primary><option>callout_domain_positive_expire</option></primary>
25966 </indexterm>
25967 </para>
25968 <informaltable frame="all">
25969 <tgroup cols="4" colsep="0" rowsep="0">
25970 <colspec colwidth="8*" align="left"/>
25971 <colspec colwidth="6*" align="center"/>
25972 <colspec colwidth="6*" align="center"/>
25973 <colspec colwidth="6*" align="right"/>
25974 <tbody>
25975 <row>
25976 <entry><option>callout_domain_positive_expire</option></entry>
25977 <entry>Use: <emphasis>main</emphasis></entry>
25978 <entry>Type: <emphasis>time</emphasis></entry>
25979 <entry>Default: <emphasis>7d</emphasis></entry>
25980 </row>
25981 </tbody>
25982 </tgroup>
25983 </informaltable>
25984 <para>
25985 This option specifies the expiry time for positive callout cache data for a
25986 domain. See section <xref linkend="SECTcallver"/> for details of callout verification, and
25987 section <xref linkend="SECTcallvercache"/> for details of the caching.
25988 </para>
25989 <para>
25990 <indexterm role="option">
25991 <primary><option>callout_negative_expire</option></primary>
25992 </indexterm>
25993 </para>
25994 <informaltable frame="all">
25995 <tgroup cols="4" colsep="0" rowsep="0">
25996 <colspec colwidth="8*" align="left"/>
25997 <colspec colwidth="6*" align="center"/>
25998 <colspec colwidth="6*" align="center"/>
25999 <colspec colwidth="6*" align="right"/>
26000 <tbody>
26001 <row>
26002 <entry><option>callout_negative_expire</option></entry>
26003 <entry>Use: <emphasis>main</emphasis></entry>
26004 <entry>Type: <emphasis>time</emphasis></entry>
26005 <entry>Default: <emphasis>2h</emphasis></entry>
26006 </row>
26007 </tbody>
26008 </tgroup>
26009 </informaltable>
26010 <para>
26011 This option specifies the expiry time for negative callout cache data for an
26012 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
26013 section <xref linkend="SECTcallvercache"/> for details of the caching.
26014 </para>
26015 <para>
26016 <indexterm role="option">
26017 <primary><option>callout_positive_expire</option></primary>
26018 </indexterm>
26019 </para>
26020 <informaltable frame="all">
26021 <tgroup cols="4" colsep="0" rowsep="0">
26022 <colspec colwidth="8*" align="left"/>
26023 <colspec colwidth="6*" align="center"/>
26024 <colspec colwidth="6*" align="center"/>
26025 <colspec colwidth="6*" align="right"/>
26026 <tbody>
26027 <row>
26028 <entry><option>callout_positive_expire</option></entry>
26029 <entry>Use: <emphasis>main</emphasis></entry>
26030 <entry>Type: <emphasis>time</emphasis></entry>
26031 <entry>Default: <emphasis>24h</emphasis></entry>
26032 </row>
26033 </tbody>
26034 </tgroup>
26035 </informaltable>
26036 <para>
26037 This option specifies the expiry time for positive callout cache data for an
26038 address. See section <xref linkend="SECTcallver"/> for details of callout verification, and
26039 section <xref linkend="SECTcallvercache"/> for details of the caching.
26040 </para>
26041 <para>
26042 <indexterm role="option">
26043 <primary><option>callout_random_local_part</option></primary>
26044 </indexterm>
26045 </para>
26046 <informaltable frame="all">
26047 <tgroup cols="4" colsep="0" rowsep="0">
26048 <colspec colwidth="8*" align="left"/>
26049 <colspec colwidth="6*" align="center"/>
26050 <colspec colwidth="6*" align="center"/>
26051 <colspec colwidth="6*" align="right"/>
26052 <tbody>
26053 <row>
26054 <entry><option>callout_random_local_part</option></entry>
26055 <entry>Use: <emphasis>main</emphasis></entry>
26056 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26057 <entry>Default: <emphasis>see below</emphasis></entry>
26058 </row>
26059 </tbody>
26060 </tgroup>
26061 </informaltable>
26062 <para>
26063 This option defines the <quote>random</quote> local part that can be used as part of
26064 callout verification. The default value is
26065 </para>
26066 <literallayout class="monospaced">
26067 $primary_hostname-$tod_epoch-testing
26068 </literallayout>
26069 <para>
26070 See section <xref linkend="CALLaddparcall"/> for details of how this value is used.
26071 </para>
26072 <para>
26073 <indexterm role="option">
26074 <primary><option>check_log_inodes</option></primary>
26075 </indexterm>
26076 </para>
26077 <informaltable frame="all">
26078 <tgroup cols="4" colsep="0" rowsep="0">
26079 <colspec colwidth="8*" align="left"/>
26080 <colspec colwidth="6*" align="center"/>
26081 <colspec colwidth="6*" align="center"/>
26082 <colspec colwidth="6*" align="right"/>
26083 <tbody>
26084 <row>
26085 <entry><option>check_log_inodes</option></entry>
26086 <entry>Use: <emphasis>main</emphasis></entry>
26087 <entry>Type: <emphasis>integer</emphasis></entry>
26088 <entry>Default: <emphasis>100</emphasis></entry>
26089 </row>
26090 </tbody>
26091 </tgroup>
26092 </informaltable>
26093 <para>
26094 See <option>check_spool_space</option> below.
26095 </para>
26096 <para>
26097 <indexterm role="option">
26098 <primary><option>check_log_space</option></primary>
26099 </indexterm>
26100 </para>
26101 <informaltable frame="all">
26102 <tgroup cols="4" colsep="0" rowsep="0">
26103 <colspec colwidth="8*" align="left"/>
26104 <colspec colwidth="6*" align="center"/>
26105 <colspec colwidth="6*" align="center"/>
26106 <colspec colwidth="6*" align="right"/>
26107 <tbody>
26108 <row>
26109 <entry><option>check_log_space</option></entry>
26110 <entry>Use: <emphasis>main</emphasis></entry>
26111 <entry>Type: <emphasis>integer</emphasis></entry>
26112 <entry>Default: <emphasis>10M</emphasis></entry>
26113 </row>
26114 </tbody>
26115 </tgroup>
26116 </informaltable>
26117 <para>
26118 See <option>check_spool_space</option> below.
26119 </para>
26120 <para>
26121 <indexterm role="option">
26122 <primary><option>check_rfc2047_length</option></primary>
26123 </indexterm>
26124 <indexterm role="concept">
26125 <primary>RFC 2047</primary>
26126 <secondary>disabling length check</secondary>
26127 </indexterm>
26128 <indexterm role="option">
26129 <primary><option>check_rfc2047_length</option></primary>
26130 </indexterm>
26131 </para>
26132 <informaltable frame="all">
26133 <tgroup cols="4" colsep="0" rowsep="0">
26134 <colspec colwidth="8*" align="left"/>
26135 <colspec colwidth="6*" align="center"/>
26136 <colspec colwidth="6*" align="center"/>
26137 <colspec colwidth="6*" align="right"/>
26138 <tbody>
26139 <row>
26140 <entry><option>check_rfc2047_length</option></entry>
26141 <entry>Use: <emphasis>main</emphasis></entry>
26142 <entry>Type: <emphasis>boolean</emphasis></entry>
26143 <entry>Default: <emphasis>true</emphasis></entry>
26144 </row>
26145 </tbody>
26146 </tgroup>
26147 </informaltable>
26148 <para>
26149 RFC 2047 defines a way of encoding non-ASCII characters in headers using a
26150 system of <quote>encoded words</quote>. The RFC specifies a maximum length for an encoded
26151 word; strings to be encoded that exceed this length are supposed to use
26152 multiple encoded words. By default, Exim does not recognize encoded words that
26153 exceed the maximum length. However, it seems that some software, in violation
26154 of the RFC, generates overlong encoded words. If <option>check_rfc2047_length</option> is
26155 set false, Exim recognizes encoded words of any length.
26156 </para>
26157 <para>
26158 <indexterm role="option">
26159 <primary><option>check_spool_inodes</option></primary>
26160 </indexterm>
26161 </para>
26162 <informaltable frame="all">
26163 <tgroup cols="4" colsep="0" rowsep="0">
26164 <colspec colwidth="8*" align="left"/>
26165 <colspec colwidth="6*" align="center"/>
26166 <colspec colwidth="6*" align="center"/>
26167 <colspec colwidth="6*" align="right"/>
26168 <tbody>
26169 <row>
26170 <entry><option>check_spool_inodes</option></entry>
26171 <entry>Use: <emphasis>main</emphasis></entry>
26172 <entry>Type: <emphasis>integer</emphasis></entry>
26173 <entry>Default: <emphasis>100</emphasis></entry>
26174 </row>
26175 </tbody>
26176 </tgroup>
26177 </informaltable>
26178 <para>
26179 See <option>check_spool_space</option> below.
26180 </para>
26181 <para>
26182 <indexterm role="option">
26183 <primary><option>check_spool_space</option></primary>
26184 </indexterm>
26185 </para>
26186 <informaltable frame="all">
26187 <tgroup cols="4" colsep="0" rowsep="0">
26188 <colspec colwidth="8*" align="left"/>
26189 <colspec colwidth="6*" align="center"/>
26190 <colspec colwidth="6*" align="center"/>
26191 <colspec colwidth="6*" align="right"/>
26192 <tbody>
26193 <row>
26194 <entry><option>check_spool_space</option></entry>
26195 <entry>Use: <emphasis>main</emphasis></entry>
26196 <entry>Type: <emphasis>integer</emphasis></entry>
26197 <entry>Default: <emphasis>10M</emphasis></entry>
26198 </row>
26199 </tbody>
26200 </tgroup>
26201 </informaltable>
26202 <para>
26203 <indexterm role="concept">
26204 <primary>checking disk space</primary>
26205 </indexterm>
26206 <indexterm role="concept">
26207 <primary>disk space, checking</primary>
26208 </indexterm>
26209 <indexterm role="concept">
26210 <primary>spool directory</primary>
26211 <secondary>checking space</secondary>
26212 </indexterm>
26213 The four <option>check_...</option> options allow for checking of disk resources before a
26214 message is accepted.
26215 </para>
26216 <para>
26217 <indexterm role="variable">
26218 <primary><varname>$log_inodes</varname></primary>
26219 </indexterm>
26220 <indexterm role="variable">
26221 <primary><varname>$log_space</varname></primary>
26222 </indexterm>
26223 <indexterm role="variable">
26224 <primary><varname>$spool_inodes</varname></primary>
26225 </indexterm>
26226 <indexterm role="variable">
26227 <primary><varname>$spool_space</varname></primary>
26228 </indexterm>
26229 When any of these options are nonzero, they apply to all incoming messages. If you
26230 want to apply different checks to different kinds of message, you can do so by
26231 testing the variables <varname>$log_inodes</varname>, <varname>$log_space</varname>, <varname>$spool_inodes</varname>, and
26232 <varname>$spool_space</varname> in an ACL with appropriate additional conditions.
26233 </para>
26234 <para>
26235 <option>check_spool_space</option> and <option>check_spool_inodes</option> check the spool partition if
26236 either value is greater than zero, for example:
26237 </para>
26238 <literallayout class="monospaced">
26239 check_spool_space = 100M
26240 check_spool_inodes = 100
26241 </literallayout>
26242 <para>
26243 The spool partition is the one that contains the directory defined by
26244 SPOOL_DIRECTORY in <filename>Local/Makefile</filename>. It is used for holding messages in
26245 transit.
26246 </para>
26247 <para>
26248 <option>check_log_space</option> and <option>check_log_inodes</option>  check the partition in which log
26249 files are written if either is greater than zero. These should be set only if
26250 <option>log_file_path</option> and <option>spool_directory</option> refer to different partitions.
26251 </para>
26252 <para>
26253 If there is less space or fewer inodes than requested, Exim refuses to accept
26254 incoming mail. In the case of SMTP input this is done by giving a 452 temporary
26255 error response to the MAIL command. If ESMTP is in use and there was a
26256 SIZE parameter on the MAIL command, its value is added to the
26257 <option>check_spool_space</option> value, and the check is performed even if
26258 <option>check_spool_space</option> is zero, unless <option>no_smtp_check_spool_space</option> is set.
26259 </para>
26260 <para>
26261 The values for <option>check_spool_space</option> and <option>check_log_space</option> are held as a
26262 number of kilobytes (though specified in bytes).
26263 If a non-multiple of 1024 is specified, it is rounded up.
26264 </para>
26265 <para>
26266 For non-SMTP input and for batched SMTP input, the test is done at start-up; on
26267 failure a message is written to stderr and Exim exits with a non-zero code, as
26268 it obviously cannot send an error message of any kind.
26269 </para>
26270 <para>
26271 There is a slight performance penalty for these checks.
26272 Versions of Exim preceding 4.88 had these disabled by default;
26273 high-rate installations confident they will never run out of resources
26274 may wish to deliberately disable them.
26275 </para>
26276 <para>
26277 <indexterm role="option">
26278 <primary><option>chunking_advertise_hosts</option></primary>
26279 </indexterm>
26280 </para>
26281 <informaltable frame="all">
26282 <tgroup cols="4" colsep="0" rowsep="0">
26283 <colspec colwidth="8*" align="left"/>
26284 <colspec colwidth="6*" align="center"/>
26285 <colspec colwidth="6*" align="center"/>
26286 <colspec colwidth="6*" align="right"/>
26287 <tbody>
26288 <row>
26289 <entry><option>chunking_advertise_hosts</option></entry>
26290 <entry>Use: <emphasis>main</emphasis></entry>
26291 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
26292 <entry>Default: <emphasis>*</emphasis></entry>
26293 </row>
26294 </tbody>
26295 </tgroup>
26296 </informaltable>
26297 <para>
26298 <indexterm role="concept">
26299 <primary>CHUNKING</primary>
26300 <secondary>advertisement</secondary>
26301 </indexterm>
26302 <indexterm role="concept">
26303 <primary>RFC 3030</primary>
26304 <secondary>CHUNKING</secondary>
26305 </indexterm>
26306 <indexterm role="concept">
26307 <primary>ESMTP extensions</primary>
26308 <secondary>CHUNKING</secondary>
26309 </indexterm>
26310 The CHUNKING extension (RFC3030) will be advertised in the EHLO message to
26311 these hosts.
26312 Hosts may use the BDAT command as an alternate to DATA.
26313 </para>
26314 <para>
26315 <indexterm role="option">
26316 <primary><option>commandline_checks_require_admin</option></primary>
26317 </indexterm>
26318 </para>
26319 <informaltable frame="all">
26320 <tgroup cols="4" colsep="0" rowsep="0">
26321 <colspec colwidth="8*" align="left"/>
26322 <colspec colwidth="6*" align="center"/>
26323 <colspec colwidth="6*" align="center"/>
26324 <colspec colwidth="6*" align="right"/>
26325 <tbody>
26326 <row>
26327 <entry><option>commandline_checks_require_admin</option></entry>
26328 <entry>Use: <emphasis>main</emphasis></entry>
26329 <entry>Type: <emphasis>boolean</emphasis></entry>
26330 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
26331 </row>
26332 </tbody>
26333 </tgroup>
26334 </informaltable>
26335 <para>
26336 <indexterm role="concept">
26337 <primary>restricting access to features</primary>
26338 </indexterm>
26339 This option restricts various basic checking features to require an
26340 administrative user.
26341 This affects most of the <option>-b*</option> options, such as <option>-be</option>.
26342 </para>
26343 <para>
26344 <indexterm role="option">
26345 <primary><option>debug_store</option></primary>
26346 </indexterm>
26347 </para>
26348 <informaltable frame="all">
26349 <tgroup cols="4" colsep="0" rowsep="0">
26350 <colspec colwidth="8*" align="left"/>
26351 <colspec colwidth="6*" align="center"/>
26352 <colspec colwidth="6*" align="center"/>
26353 <colspec colwidth="6*" align="right"/>
26354 <tbody>
26355 <row>
26356 <entry><option>debug_store</option></entry>
26357 <entry>Use: <emphasis>main</emphasis></entry>
26358 <entry>Type: <emphasis>boolean</emphasis></entry>
26359 <entry>Default: <emphasis><literal>false</literal></emphasis></entry>
26360 </row>
26361 </tbody>
26362 </tgroup>
26363 </informaltable>
26364 <para>
26365 <indexterm role="concept">
26366 <primary>debugging</primary>
26367 <secondary>memory corruption</secondary>
26368 </indexterm>
26369 <indexterm role="concept">
26370 <primary>memory</primary>
26371 <secondary>debugging</secondary>
26372 </indexterm>
26373 This option, when true, enables extra checking in Exim&#x2019;s internal memory
26374 management.  For use when a memory corruption issue is being investigated,
26375 it should normally be left as default.
26376 </para>
26377 <para>
26378 <indexterm role="option">
26379 <primary><option>daemon_smtp_ports</option></primary>
26380 </indexterm>
26381 </para>
26382 <informaltable frame="all">
26383 <tgroup cols="4" colsep="0" rowsep="0">
26384 <colspec colwidth="8*" align="left"/>
26385 <colspec colwidth="6*" align="center"/>
26386 <colspec colwidth="6*" align="center"/>
26387 <colspec colwidth="6*" align="right"/>
26388 <tbody>
26389 <row>
26390 <entry><option>daemon_smtp_ports</option></entry>
26391 <entry>Use: <emphasis>main</emphasis></entry>
26392 <entry>Type: <emphasis>string</emphasis></entry>
26393 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
26394 </row>
26395 </tbody>
26396 </tgroup>
26397 </informaltable>
26398 <para>
26399 <indexterm role="concept">
26400 <primary>port</primary>
26401 <secondary>for daemon</secondary>
26402 </indexterm>
26403 <indexterm role="concept">
26404 <primary>TCP/IP</primary>
26405 <secondary>setting listening ports</secondary>
26406 </indexterm>
26407 This option specifies one or more default SMTP ports on which the Exim daemon
26408 listens. See chapter <xref linkend="CHAPinterfaces"/> for details of how it is used. For
26409 backward compatibility, <option>daemon_smtp_port</option> (singular) is a synonym.
26410 </para>
26411 <para>
26412 <indexterm role="option">
26413 <primary><option>daemon_startup_retries</option></primary>
26414 </indexterm>
26415 </para>
26416 <informaltable frame="all">
26417 <tgroup cols="4" colsep="0" rowsep="0">
26418 <colspec colwidth="8*" align="left"/>
26419 <colspec colwidth="6*" align="center"/>
26420 <colspec colwidth="6*" align="center"/>
26421 <colspec colwidth="6*" align="right"/>
26422 <tbody>
26423 <row>
26424 <entry><option>daemon_startup_retries</option></entry>
26425 <entry>Use: <emphasis>main</emphasis></entry>
26426 <entry>Type: <emphasis>integer</emphasis></entry>
26427 <entry>Default: <emphasis>9</emphasis></entry>
26428 </row>
26429 </tbody>
26430 </tgroup>
26431 </informaltable>
26432 <para>
26433 <indexterm role="concept">
26434 <primary>daemon startup, retrying</primary>
26435 </indexterm>
26436 This option, along with <option>daemon_startup_sleep</option>, controls the retrying done by
26437 the daemon at startup when it cannot immediately bind a listening socket
26438 (typically because the socket is already in use): <option>daemon_startup_retries</option>
26439 defines the number of retries after the first failure, and
26440 <option>daemon_startup_sleep</option> defines the length of time to wait between retries.
26441 </para>
26442 <para>
26443 <indexterm role="option">
26444 <primary><option>daemon_startup_sleep</option></primary>
26445 </indexterm>
26446 </para>
26447 <informaltable frame="all">
26448 <tgroup cols="4" colsep="0" rowsep="0">
26449 <colspec colwidth="8*" align="left"/>
26450 <colspec colwidth="6*" align="center"/>
26451 <colspec colwidth="6*" align="center"/>
26452 <colspec colwidth="6*" align="right"/>
26453 <tbody>
26454 <row>
26455 <entry><option>daemon_startup_sleep</option></entry>
26456 <entry>Use: <emphasis>main</emphasis></entry>
26457 <entry>Type: <emphasis>time</emphasis></entry>
26458 <entry>Default: <emphasis>30s</emphasis></entry>
26459 </row>
26460 </tbody>
26461 </tgroup>
26462 </informaltable>
26463 <para>
26464 See <option>daemon_startup_retries</option>.
26465 </para>
26466 <para>
26467 <indexterm role="option">
26468 <primary><option>delay_warning</option></primary>
26469 </indexterm>
26470 </para>
26471 <informaltable frame="all">
26472 <tgroup cols="4" colsep="0" rowsep="0">
26473 <colspec colwidth="8*" align="left"/>
26474 <colspec colwidth="6*" align="center"/>
26475 <colspec colwidth="6*" align="center"/>
26476 <colspec colwidth="6*" align="right"/>
26477 <tbody>
26478 <row>
26479 <entry><option>delay_warning</option></entry>
26480 <entry>Use: <emphasis>main</emphasis></entry>
26481 <entry>Type: <emphasis>time list</emphasis></entry>
26482 <entry>Default: <emphasis>24h</emphasis></entry>
26483 </row>
26484 </tbody>
26485 </tgroup>
26486 </informaltable>
26487 <para>
26488 <indexterm role="concept">
26489 <primary>warning of delay</primary>
26490 </indexterm>
26491 <indexterm role="concept">
26492 <primary>delay warning, specifying</primary>
26493 </indexterm>
26494 <indexterm role="concept">
26495 <primary>queue</primary>
26496 <secondary>delay warning</secondary>
26497 </indexterm>
26498 When a message is delayed, Exim sends a warning message to the sender at
26499 intervals specified by this option. The data is a colon-separated list of times
26500 after which to send warning messages. If the value of the option is an empty
26501 string or a zero time, no warnings are sent. Up to 10 times may be given. If a
26502 message has been in the queue for longer than the last time, the last interval
26503 between the times is used to compute subsequent warning times. For example,
26504 with
26505 </para>
26506 <literallayout class="monospaced">
26507 delay_warning = 4h:8h:24h
26508 </literallayout>
26509 <para>
26510 the first message is sent after 4 hours, the second after 8 hours, and
26511 the third one after 24 hours. After that, messages are sent every 16 hours,
26512 because that is the interval between the last two times on the list. If you set
26513 just one time, it specifies the repeat interval. For example, with:
26514 </para>
26515 <literallayout class="monospaced">
26516 delay_warning = 6h
26517 </literallayout>
26518 <para>
26519 messages are repeated every six hours. To stop warnings after a given time, set
26520 a very large time at the end of the list. For example:
26521 </para>
26522 <literallayout class="monospaced">
26523 delay_warning = 2h:12h:99d
26524 </literallayout>
26525 <para>
26526 Note that the option is only evaluated at the time a delivery attempt fails,
26527 which depends on retry and queue-runner configuration.
26528 Typically retries will be configured more frequently than warning messages.
26529 </para>
26530 <para>
26531 <indexterm role="option">
26532 <primary><option>delay_warning_condition</option></primary>
26533 </indexterm>
26534 </para>
26535 <informaltable frame="all">
26536 <tgroup cols="4" colsep="0" rowsep="0">
26537 <colspec colwidth="8*" align="left"/>
26538 <colspec colwidth="6*" align="center"/>
26539 <colspec colwidth="6*" align="center"/>
26540 <colspec colwidth="6*" align="right"/>
26541 <tbody>
26542 <row>
26543 <entry><option>delay_warning_condition</option></entry>
26544 <entry>Use: <emphasis>main</emphasis></entry>
26545 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26546 <entry>Default: <emphasis>see below</emphasis></entry>
26547 </row>
26548 </tbody>
26549 </tgroup>
26550 </informaltable>
26551 <para>
26552 <indexterm role="variable">
26553 <primary><varname>$domain</varname></primary>
26554 </indexterm>
26555 The string is expanded at the time a warning message might be sent. If all the
26556 deferred addresses have the same domain, it is set in <varname>$domain</varname> during the
26557 expansion. Otherwise <varname>$domain</varname> is empty. If the result of the expansion is a
26558 forced failure, an empty string, or a string matching any of <quote>0</quote>, <quote>no</quote> or
26559 <quote>false</quote> (the comparison being done caselessly) then the warning message is
26560 not sent. The default is:
26561 </para>
26562 <literallayout class="monospaced">
26563 delay_warning_condition = ${if or {\
26564   { !eq{$h_list-id:$h_list-post:$h_list-subscribe:}{} }\
26565   { match{$h_precedence:}{(?i)bulk|list|junk} }\
26566   { match{$h_auto-submitted:}{(?i)auto-generated|auto-replied} }\
26567   } {no}{yes}}
26568 </literallayout>
26569 <para>
26570 This suppresses the sending of warnings for messages that contain <emphasis>List-ID:</emphasis>,
26571 <emphasis>List-Post:</emphasis>, or <emphasis>List-Subscribe:</emphasis> headers, or have <quote>bulk</quote>, <quote>list</quote> or
26572 <quote>junk</quote> in a <emphasis>Precedence:</emphasis> header, or have <quote>auto-generated</quote> or
26573 <quote>auto-replied</quote> in an <emphasis>Auto-Submitted:</emphasis> header.
26574 </para>
26575 <para>
26576 <indexterm role="option">
26577 <primary><option>deliver_drop_privilege</option></primary>
26578 </indexterm>
26579 </para>
26580 <informaltable frame="all">
26581 <tgroup cols="4" colsep="0" rowsep="0">
26582 <colspec colwidth="8*" align="left"/>
26583 <colspec colwidth="6*" align="center"/>
26584 <colspec colwidth="6*" align="center"/>
26585 <colspec colwidth="6*" align="right"/>
26586 <tbody>
26587 <row>
26588 <entry><option>deliver_drop_privilege</option></entry>
26589 <entry>Use: <emphasis>main</emphasis></entry>
26590 <entry>Type: <emphasis>boolean</emphasis></entry>
26591 <entry>Default: <emphasis>false</emphasis></entry>
26592 </row>
26593 </tbody>
26594 </tgroup>
26595 </informaltable>
26596 <para>
26597 <indexterm role="concept">
26598 <primary>unprivileged delivery</primary>
26599 </indexterm>
26600 <indexterm role="concept">
26601 <primary>delivery</primary>
26602 <secondary>unprivileged</secondary>
26603 </indexterm>
26604 If this option is set true, Exim drops its root privilege at the start of a
26605 delivery process, and runs as the Exim user throughout. This severely restricts
26606 the kinds of local delivery that are possible, but is viable in certain types
26607 of configuration. There is a discussion about the use of root privilege in
26608 chapter <xref linkend="CHAPsecurity"/>.
26609 </para>
26610 <para>
26611 <indexterm role="option">
26612 <primary><option>deliver_queue_load_max</option></primary>
26613 </indexterm>
26614 </para>
26615 <informaltable frame="all">
26616 <tgroup cols="4" colsep="0" rowsep="0">
26617 <colspec colwidth="8*" align="left"/>
26618 <colspec colwidth="6*" align="center"/>
26619 <colspec colwidth="6*" align="center"/>
26620 <colspec colwidth="6*" align="right"/>
26621 <tbody>
26622 <row>
26623 <entry><option>deliver_queue_load_max</option></entry>
26624 <entry>Use: <emphasis>main</emphasis></entry>
26625 <entry>Type: <emphasis>fixed-point</emphasis></entry>
26626 <entry>Default: <emphasis>unset</emphasis></entry>
26627 </row>
26628 </tbody>
26629 </tgroup>
26630 </informaltable>
26631 <para>
26632 <indexterm role="concept">
26633 <primary>load average</primary>
26634 </indexterm>
26635 <indexterm role="concept">
26636 <primary>queue runner</primary>
26637 <secondary>abandoning</secondary>
26638 </indexterm>
26639 When this option is set, a queue run is abandoned if the system load average
26640 becomes greater than the value of the option. The option has no effect on
26641 ancient operating systems on which Exim cannot determine the load average.
26642 See also <option>queue_only_load</option> and <option>smtp_load_reserve</option>.
26643 </para>
26644 <para>
26645 <indexterm role="option">
26646 <primary><option>delivery_date_remove</option></primary>
26647 </indexterm>
26648 </para>
26649 <informaltable frame="all">
26650 <tgroup cols="4" colsep="0" rowsep="0">
26651 <colspec colwidth="8*" align="left"/>
26652 <colspec colwidth="6*" align="center"/>
26653 <colspec colwidth="6*" align="center"/>
26654 <colspec colwidth="6*" align="right"/>
26655 <tbody>
26656 <row>
26657 <entry><option>delivery_date_remove</option></entry>
26658 <entry>Use: <emphasis>main</emphasis></entry>
26659 <entry>Type: <emphasis>boolean</emphasis></entry>
26660 <entry>Default: <emphasis>true</emphasis></entry>
26661 </row>
26662 </tbody>
26663 </tgroup>
26664 </informaltable>
26665 <para>
26666 <indexterm role="concept">
26667 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
26668 </indexterm>
26669 Exim&#x2019;s transports have an option for adding a <emphasis>Delivery-date:</emphasis> header to a
26670 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
26671 handled. <emphasis>Delivery-date:</emphasis> records the actual time of delivery. Such headers
26672 should not be present in incoming messages, and this option causes them to be
26673 removed at the time the message is received, to avoid any problems that might
26674 occur when a delivered message is subsequently sent on to some other recipient.
26675 </para>
26676 <para>
26677 <indexterm role="option">
26678 <primary><option>disable_fsync</option></primary>
26679 </indexterm>
26680 </para>
26681 <informaltable frame="all">
26682 <tgroup cols="4" colsep="0" rowsep="0">
26683 <colspec colwidth="8*" align="left"/>
26684 <colspec colwidth="6*" align="center"/>
26685 <colspec colwidth="6*" align="center"/>
26686 <colspec colwidth="6*" align="right"/>
26687 <tbody>
26688 <row>
26689 <entry><option>disable_fsync</option></entry>
26690 <entry>Use: <emphasis>main</emphasis></entry>
26691 <entry>Type: <emphasis>boolean</emphasis></entry>
26692 <entry>Default: <emphasis>false</emphasis></entry>
26693 </row>
26694 </tbody>
26695 </tgroup>
26696 </informaltable>
26697 <para>
26698 <indexterm role="concept">
26699 <primary><function>fsync()</function>, disabling</primary>
26700 </indexterm>
26701 This option is available only if Exim was built with the compile-time option
26702 ENABLE_DISABLE_FSYNC. When this is not set, a reference to <option>disable_fsync</option> in
26703 a runtime configuration generates an <quote>unknown option</quote> error. You should not
26704 build Exim with ENABLE_DISABLE_FSYNC or set <option>disable_fsync</option> unless you
26705 really, really, really understand what you are doing. <emphasis>No pre-compiled
26706 distributions of Exim should ever make this option available.</emphasis>
26707 </para>
26708 <para>
26709 When <option>disable_fsync</option> is set true, Exim no longer calls <function>fsync()</function> to force
26710 updated files&#x2019; data to be written to disc before continuing. Unexpected events
26711 such as crashes and power outages may cause data to be lost or scrambled.
26712 Here be Dragons. <emphasis role="bold">Beware.</emphasis>
26713 </para>
26714 <para>
26715 <indexterm role="option">
26716 <primary><option>disable_ipv6</option></primary>
26717 </indexterm>
26718 </para>
26719 <informaltable frame="all">
26720 <tgroup cols="4" colsep="0" rowsep="0">
26721 <colspec colwidth="8*" align="left"/>
26722 <colspec colwidth="6*" align="center"/>
26723 <colspec colwidth="6*" align="center"/>
26724 <colspec colwidth="6*" align="right"/>
26725 <tbody>
26726 <row>
26727 <entry><option>disable_ipv6</option></entry>
26728 <entry>Use: <emphasis>main</emphasis></entry>
26729 <entry>Type: <emphasis>boolean</emphasis></entry>
26730 <entry>Default: <emphasis>false</emphasis></entry>
26731 </row>
26732 </tbody>
26733 </tgroup>
26734 </informaltable>
26735 <para>
26736 <indexterm role="concept">
26737 <primary>IPv6</primary>
26738 <secondary>disabling</secondary>
26739 </indexterm>
26740 If this option is set true, even if the Exim binary has IPv6 support, no IPv6
26741 activities take place. AAAA records are never looked up, and any IPv6 addresses
26742 that are listed in <option>local_interfaces</option>, data for the <option>manualroute</option> router,
26743 etc. are ignored. If IP literals are enabled, the <command>ipliteral</command> router declines
26744 to handle IPv6 literal addresses.
26745 </para>
26746 <para>
26747 <indexterm role="option">
26748 <primary><option>dkim_verify_hashes</option></primary>
26749 </indexterm>
26750 </para>
26751 <informaltable frame="all">
26752 <tgroup cols="4" colsep="0" rowsep="0">
26753 <colspec colwidth="8*" align="left"/>
26754 <colspec colwidth="6*" align="center"/>
26755 <colspec colwidth="6*" align="center"/>
26756 <colspec colwidth="6*" align="right"/>
26757 <tbody>
26758 <row>
26759 <entry><option>dkim_verify_hashes</option></entry>
26760 <entry>Use: <emphasis>main</emphasis></entry>
26761 <entry>Type: <emphasis>string list</emphasis></entry>
26762 <entry>Default: <emphasis>sha256 : sha512</emphasis></entry>
26763 </row>
26764 </tbody>
26765 </tgroup>
26766 </informaltable>
26767 <para>
26768 <indexterm role="concept">
26769 <primary>DKIM</primary>
26770 <secondary>selecting signature algorithms</secondary>
26771 </indexterm>
26772 This option gives a list of hash types which are acceptable in signatures,
26773 and an order of processing.
26774 Signatures with algorithms not in the list will be ignored.
26775 </para>
26776 <para>
26777 Acceptable values include:
26778 </para>
26779 <literallayout class="monospaced">
26780 sha1
26781 sha256
26782 sha512
26783 </literallayout>
26784 <para>
26785 Note that the acceptance of sha1 violates RFC 8301.
26786 </para>
26787 <para>
26788 <indexterm role="option">
26789 <primary><option>dkim_verify_keytypes</option></primary>
26790 </indexterm>
26791 </para>
26792 <informaltable frame="all">
26793 <tgroup cols="4" colsep="0" rowsep="0">
26794 <colspec colwidth="8*" align="left"/>
26795 <colspec colwidth="6*" align="center"/>
26796 <colspec colwidth="6*" align="center"/>
26797 <colspec colwidth="6*" align="right"/>
26798 <tbody>
26799 <row>
26800 <entry><option>dkim_verify_keytypes</option></entry>
26801 <entry>Use: <emphasis>main</emphasis></entry>
26802 <entry>Type: <emphasis>string list</emphasis></entry>
26803 <entry>Default: <emphasis>ed25519 : rsa</emphasis></entry>
26804 </row>
26805 </tbody>
26806 </tgroup>
26807 </informaltable>
26808 <para>
26809 This option gives a list of key types which are acceptable in signatures,
26810 and an order of processing.
26811 Signatures with algorithms not in the list will be ignored.
26812 </para>
26813 <para>
26814 <indexterm role="option">
26815 <primary><option>dkim_verify_min_keysizes</option></primary>
26816 </indexterm>
26817 </para>
26818 <informaltable frame="all">
26819 <tgroup cols="4" colsep="0" rowsep="0">
26820 <colspec colwidth="8*" align="left"/>
26821 <colspec colwidth="6*" align="center"/>
26822 <colspec colwidth="6*" align="center"/>
26823 <colspec colwidth="6*" align="right"/>
26824 <tbody>
26825 <row>
26826 <entry><option>dkim_verify_min_keysizes</option></entry>
26827 <entry>Use: <emphasis>main</emphasis></entry>
26828 <entry>Type: <emphasis>string list</emphasis></entry>
26829 <entry>Default: <emphasis>rsa=1024 ed25519=250</emphasis></entry>
26830 </row>
26831 </tbody>
26832 </tgroup>
26833 </informaltable>
26834 <para>
26835 This option gives a list of key sizes which are acceptable in signatures.
26836 The list is keyed by the algorithm type for the key; the values are in bits.
26837 Signatures with keys smaller than given by this option will fail verification.
26838 </para>
26839 <para>
26840 The default enforces the RFC 8301 minimum key size for RSA signatures.
26841 </para>
26842 <para>
26843 <indexterm role="option">
26844 <primary><option>dkim_verify_minimal</option></primary>
26845 </indexterm>
26846 </para>
26847 <informaltable frame="all">
26848 <tgroup cols="4" colsep="0" rowsep="0">
26849 <colspec colwidth="8*" align="left"/>
26850 <colspec colwidth="6*" align="center"/>
26851 <colspec colwidth="6*" align="center"/>
26852 <colspec colwidth="6*" align="right"/>
26853 <tbody>
26854 <row>
26855 <entry><option>dkim_verify_minimal</option></entry>
26856 <entry>Use: <emphasis>main</emphasis></entry>
26857 <entry>Type: <emphasis>boolean</emphasis></entry>
26858 <entry>Default: <emphasis>false</emphasis></entry>
26859 </row>
26860 </tbody>
26861 </tgroup>
26862 </informaltable>
26863 <para>
26864 If set to true, verification of signatures will terminate after the
26865 first success.
26866 </para>
26867 <para>
26868 <indexterm role="option">
26869 <primary><option>dkim_verify_signers</option></primary>
26870 </indexterm>
26871 </para>
26872 <informaltable frame="all">
26873 <tgroup cols="4" colsep="0" rowsep="0">
26874 <colspec colwidth="8*" align="left"/>
26875 <colspec colwidth="6*" align="center"/>
26876 <colspec colwidth="6*" align="center"/>
26877 <colspec colwidth="6*" align="right"/>
26878 <tbody>
26879 <row>
26880 <entry><option>dkim_verify_signers</option></entry>
26881 <entry>Use: <emphasis>main</emphasis></entry>
26882 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26883 <entry>Default: <emphasis>$dkim_signers</emphasis></entry>
26884 </row>
26885 </tbody>
26886 </tgroup>
26887 </informaltable>
26888 <para>
26889 <indexterm role="concept">
26890 <primary>DKIM</primary>
26891 <secondary>controlling calls to the ACL</secondary>
26892 </indexterm>
26893 This option gives a list of DKIM domains for which the DKIM ACL is run.
26894 It is expanded after the message is received; by default it runs
26895 the ACL once for each signature in the message.
26896 See section <xref linkend="SECDKIMVFY"/>.
26897 </para>
26898 <para>
26899 <indexterm role="option">
26900 <primary><option>dmarc_forensic_sender</option></primary>
26901 </indexterm>
26902 </para>
26903 <informaltable frame="all">
26904 <tgroup cols="4" colsep="0" rowsep="0">
26905 <colspec colwidth="8*" align="left"/>
26906 <colspec colwidth="6*" align="center"/>
26907 <colspec colwidth="6*" align="center"/>
26908 <colspec colwidth="6*" align="right"/>
26909 <tbody>
26910 <row>
26911 <entry><option>dmarc_forensic_sender</option></entry>
26912 <entry>Use: <emphasis>main</emphasis></entry>
26913 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
26914 <entry>Default: <emphasis>unset</emphasis></entry>
26915 </row>
26916 </tbody>
26917 </tgroup>
26918 </informaltable>
26919 <para>
26920 <indexterm role="option">
26921 <primary><option>dmarc_history_file</option></primary>
26922 </indexterm>
26923 </para>
26924 <informaltable frame="all">
26925 <tgroup cols="4" colsep="0" rowsep="0">
26926 <colspec colwidth="8*" align="left"/>
26927 <colspec colwidth="6*" align="center"/>
26928 <colspec colwidth="6*" align="center"/>
26929 <colspec colwidth="6*" align="right"/>
26930 <tbody>
26931 <row>
26932 <entry><option>dmarc_history_file</option></entry>
26933 <entry>Use: <emphasis>main</emphasis></entry>
26934 <entry>Type: <emphasis>string</emphasis></entry>
26935 <entry>Default: <emphasis>unset</emphasis></entry>
26936 </row>
26937 </tbody>
26938 </tgroup>
26939 </informaltable>
26940 <para>
26941 <indexterm role="option">
26942 <primary><option>dmarc_tld_file</option></primary>
26943 </indexterm>
26944 </para>
26945 <informaltable frame="all">
26946 <tgroup cols="4" colsep="0" rowsep="0">
26947 <colspec colwidth="8*" align="left"/>
26948 <colspec colwidth="6*" align="center"/>
26949 <colspec colwidth="6*" align="center"/>
26950 <colspec colwidth="6*" align="right"/>
26951 <tbody>
26952 <row>
26953 <entry><option>dmarc_tld_file</option></entry>
26954 <entry>Use: <emphasis>main</emphasis></entry>
26955 <entry>Type: <emphasis>string</emphasis></entry>
26956 <entry>Default: <emphasis>unset</emphasis></entry>
26957 </row>
26958 </tbody>
26959 </tgroup>
26960 </informaltable>
26961 <para>
26962 <indexterm role="concept">
26963 <primary>DMARC</primary>
26964 <secondary>main section options</secondary>
26965 </indexterm>
26966 These options control DMARC processing.
26967 See section <xref linkend="SECDMARC"/> for details.
26968 </para>
26969 <para>
26970 <indexterm role="option">
26971 <primary><option>dns_again_means_nonexist</option></primary>
26972 </indexterm>
26973 </para>
26974 <informaltable frame="all">
26975 <tgroup cols="4" colsep="0" rowsep="0">
26976 <colspec colwidth="8*" align="left"/>
26977 <colspec colwidth="6*" align="center"/>
26978 <colspec colwidth="6*" align="center"/>
26979 <colspec colwidth="6*" align="right"/>
26980 <tbody>
26981 <row>
26982 <entry><option>dns_again_means_nonexist</option></entry>
26983 <entry>Use: <emphasis>main</emphasis></entry>
26984 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
26985 <entry>Default: <emphasis>unset</emphasis></entry>
26986 </row>
26987 </tbody>
26988 </tgroup>
26989 </informaltable>
26990 <para>
26991 <indexterm role="concept">
26992 <primary>DNS</primary>
26993 <secondary><quote>try again</quote> response; overriding</secondary>
26994 </indexterm>
26995 DNS lookups give a <quote>try again</quote> response for the DNS errors
26996 <quote>non-authoritative host not found</quote> and <quote>SERVERFAIL</quote>. This can cause Exim to
26997 keep trying to deliver a message, or to give repeated temporary errors to
26998 incoming mail. Sometimes the effect is caused by a badly set up name server and
26999 may persist for a long time. If a domain which exhibits this problem matches
27000 anything in <option>dns_again_means_nonexist</option>, it is treated as if it did not exist.
27001 This option should be used with care. You can make it apply to reverse lookups
27002 by a setting such as this:
27003 </para>
27004 <literallayout class="monospaced">
27005 dns_again_means_nonexist = *.in-addr.arpa
27006 </literallayout>
27007 <para>
27008 This option applies to all DNS lookups that Exim does. It also applies when the
27009 <function>gethostbyname()</function> or <function>getipnodebyname()</function> functions give temporary errors,
27010 since these are most likely to be caused by DNS lookup problems. The
27011 <command>dnslookup</command> router has some options of its own for controlling what happens
27012 when lookups for MX or SRV records give temporary errors. These more specific
27013 options are applied after this global option.
27014 </para>
27015 <para>
27016 <indexterm role="option">
27017 <primary><option>dns_check_names_pattern</option></primary>
27018 </indexterm>
27019 </para>
27020 <informaltable frame="all">
27021 <tgroup cols="4" colsep="0" rowsep="0">
27022 <colspec colwidth="8*" align="left"/>
27023 <colspec colwidth="6*" align="center"/>
27024 <colspec colwidth="6*" align="center"/>
27025 <colspec colwidth="6*" align="right"/>
27026 <tbody>
27027 <row>
27028 <entry><option>dns_check_names_pattern</option></entry>
27029 <entry>Use: <emphasis>main</emphasis></entry>
27030 <entry>Type: <emphasis>string</emphasis></entry>
27031 <entry>Default: <emphasis>see below</emphasis></entry>
27032 </row>
27033 </tbody>
27034 </tgroup>
27035 </informaltable>
27036 <para>
27037 <indexterm role="concept">
27038 <primary>DNS</primary>
27039 <secondary>pre-check of name syntax</secondary>
27040 </indexterm>
27041 When this option is set to a non-empty string, it causes Exim to check domain
27042 names for characters that are not allowed in host names before handing them to
27043 the DNS resolver, because some resolvers give temporary errors for names that
27044 contain unusual characters. If a domain name contains any unwanted characters,
27045 a <quote>not found</quote> result is forced, and the resolver is not called. The check is
27046 done by matching the domain name against a regular expression, which is the
27047 value of this option. The default pattern is
27048 </para>
27049 <literallayout class="monospaced">
27050 dns_check_names_pattern = \
27051   (?i)^(?&gt;(?(1)\.|())[^\W_](?&gt;[a-z0-9/-]*[^\W_])?)+$
27052 </literallayout>
27053 <para>
27054 which permits only letters, digits, slashes, and hyphens in components, but
27055 they must start and end with a letter or digit. Slashes are not, in fact,
27056 permitted in host names, but they are found in certain NS records (which can be
27057 accessed in Exim by using a <option>dnsdb</option> lookup). If you set
27058 <option>allow_utf8_domains</option>, you must modify this pattern, or set the option to an
27059 empty string.
27060 </para>
27061 <para>
27062 <indexterm role="option">
27063 <primary><option>dns_csa_search_limit</option></primary>
27064 </indexterm>
27065 </para>
27066 <informaltable frame="all">
27067 <tgroup cols="4" colsep="0" rowsep="0">
27068 <colspec colwidth="8*" align="left"/>
27069 <colspec colwidth="6*" align="center"/>
27070 <colspec colwidth="6*" align="center"/>
27071 <colspec colwidth="6*" align="right"/>
27072 <tbody>
27073 <row>
27074 <entry><option>dns_csa_search_limit</option></entry>
27075 <entry>Use: <emphasis>main</emphasis></entry>
27076 <entry>Type: <emphasis>integer</emphasis></entry>
27077 <entry>Default: <emphasis>5</emphasis></entry>
27078 </row>
27079 </tbody>
27080 </tgroup>
27081 </informaltable>
27082 <para>
27083 This option controls the depth of parental searching for CSA SRV records in the
27084 DNS, as described in more detail in section <xref linkend="SECTverifyCSA"/>.
27085 </para>
27086 <para>
27087 <indexterm role="option">
27088 <primary><option>dns_csa_use_reverse</option></primary>
27089 </indexterm>
27090 </para>
27091 <informaltable frame="all">
27092 <tgroup cols="4" colsep="0" rowsep="0">
27093 <colspec colwidth="8*" align="left"/>
27094 <colspec colwidth="6*" align="center"/>
27095 <colspec colwidth="6*" align="center"/>
27096 <colspec colwidth="6*" align="right"/>
27097 <tbody>
27098 <row>
27099 <entry><option>dns_csa_use_reverse</option></entry>
27100 <entry>Use: <emphasis>main</emphasis></entry>
27101 <entry>Type: <emphasis>boolean</emphasis></entry>
27102 <entry>Default: <emphasis>true</emphasis></entry>
27103 </row>
27104 </tbody>
27105 </tgroup>
27106 </informaltable>
27107 <para>
27108 This option controls whether or not an IP address, given as a CSA domain, is
27109 reversed and looked up in the reverse DNS, as described in more detail in
27110 section <xref linkend="SECTverifyCSA"/>.
27111 </para>
27112 <para>
27113 <indexterm role="option">
27114 <primary><option>dns_cname_loops</option></primary>
27115 </indexterm>
27116 </para>
27117 <informaltable frame="all">
27118 <tgroup cols="4" colsep="0" rowsep="0">
27119 <colspec colwidth="8*" align="left"/>
27120 <colspec colwidth="6*" align="center"/>
27121 <colspec colwidth="6*" align="center"/>
27122 <colspec colwidth="6*" align="right"/>
27123 <tbody>
27124 <row>
27125 <entry><option>dns_cname_loops</option></entry>
27126 <entry>Use: <emphasis>main</emphasis></entry>
27127 <entry>Type: <emphasis>integer</emphasis></entry>
27128 <entry>Default: <emphasis>1</emphasis></entry>
27129 </row>
27130 </tbody>
27131 </tgroup>
27132 </informaltable>
27133 <para>
27134 <indexterm role="concept">
27135 <primary>DNS</primary>
27136 <secondary>CNAME following</secondary>
27137 </indexterm>
27138 This option controls the following of CNAME chains, needed if the resolver does
27139 not do it internally.
27140 As of 2018 most should, and the default can be left.
27141 If you have an ancient one, a value of 10 is likely needed.
27142 </para>
27143 <para>
27144 The default value of one CNAME-follow is needed
27145 thanks to the observed return for an MX request,
27146 given no MX presence but a CNAME to an A, of the CNAME.
27147 </para>
27148 <para>
27149 <indexterm role="option">
27150 <primary><option>dns_dnssec_ok</option></primary>
27151 </indexterm>
27152 </para>
27153 <informaltable frame="all">
27154 <tgroup cols="4" colsep="0" rowsep="0">
27155 <colspec colwidth="8*" align="left"/>
27156 <colspec colwidth="6*" align="center"/>
27157 <colspec colwidth="6*" align="center"/>
27158 <colspec colwidth="6*" align="right"/>
27159 <tbody>
27160 <row>
27161 <entry><option>dns_dnssec_ok</option></entry>
27162 <entry>Use: <emphasis>main</emphasis></entry>
27163 <entry>Type: <emphasis>integer</emphasis></entry>
27164 <entry>Default: <emphasis>-1</emphasis></entry>
27165 </row>
27166 </tbody>
27167 </tgroup>
27168 </informaltable>
27169 <para>
27170 <indexterm role="concept">
27171 <primary>DNS</primary>
27172 <secondary>resolver options</secondary>
27173 </indexterm>
27174 <indexterm role="concept">
27175 <primary>DNS</primary>
27176 <secondary>DNSSEC</secondary>
27177 </indexterm>
27178 If this option is set to a non-negative number then Exim will initialise the
27179 DNS resolver library to either use or not use DNSSEC, overriding the system
27180 default. A value of 0 coerces DNSSEC off, a value of 1 coerces DNSSEC on.
27181 </para>
27182 <para>
27183 If the resolver library does not support DNSSEC then this option has no effect.
27184 </para>
27185 <para>
27186 On Linux with glibc 2.31 or newer this is insufficient, the resolver library
27187 will default to stripping out a successful validation status.
27188 This will break a previously working Exim installation.
27189 Provided that you do trust the resolver (ie, is on localhost) you can tell
27190 glibc to pass through any successful validation with a new option in
27191 <filename>/etc/resolv.conf</filename>:
27192 </para>
27193 <literallayout class="monospaced">
27194 options trust-ad
27195 </literallayout>
27196 <para>
27197 <indexterm role="option">
27198 <primary><option>dns_ipv4_lookup</option></primary>
27199 </indexterm>
27200 </para>
27201 <informaltable frame="all">
27202 <tgroup cols="4" colsep="0" rowsep="0">
27203 <colspec colwidth="8*" align="left"/>
27204 <colspec colwidth="6*" align="center"/>
27205 <colspec colwidth="6*" align="center"/>
27206 <colspec colwidth="6*" align="right"/>
27207 <tbody>
27208 <row>
27209 <entry><option>dns_ipv4_lookup</option></entry>
27210 <entry>Use: <emphasis>main</emphasis></entry>
27211 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27212 <entry>Default: <emphasis>unset</emphasis></entry>
27213 </row>
27214 </tbody>
27215 </tgroup>
27216 </informaltable>
27217 <para>
27218 <indexterm role="concept">
27219 <primary>IPv6</primary>
27220 <secondary>DNS lookup for AAAA records</secondary>
27221 </indexterm>
27222 <indexterm role="concept">
27223 <primary>DNS</primary>
27224 <secondary>IPv6 lookup for AAAA records</secondary>
27225 </indexterm>
27226 <indexterm role="concept">
27227 <primary>DNS</primary>
27228 <secondary>IPv6 disabling</secondary>
27229 </indexterm>
27230 When Exim is compiled with IPv6 support and <option>disable_ipv6</option> is not set, it
27231 looks for IPv6 address records (AAAA records) as well as IPv4 address records
27232 (A records) when trying to find IP addresses for hosts, unless the host&#x2019;s
27233 domain matches this list.
27234 </para>
27235 <para>
27236 This is a fudge to help with name servers that give big delays or otherwise do
27237 not work for the AAAA record type. In due course, when the world&#x2019;s name
27238 servers have all been upgraded, there should be no need for this option.
27239 Note that all lookups, including those done for verification, are affected;
27240 this will result in verify failure for IPv6 connections or ones using names
27241 only valid for IPv6 addresses.
27242 </para>
27243 <para>
27244 <indexterm role="option">
27245 <primary><option>dns_retrans</option></primary>
27246 </indexterm>
27247 </para>
27248 <informaltable frame="all">
27249 <tgroup cols="4" colsep="0" rowsep="0">
27250 <colspec colwidth="8*" align="left"/>
27251 <colspec colwidth="6*" align="center"/>
27252 <colspec colwidth="6*" align="center"/>
27253 <colspec colwidth="6*" align="right"/>
27254 <tbody>
27255 <row>
27256 <entry><option>dns_retrans</option></entry>
27257 <entry>Use: <emphasis>main</emphasis></entry>
27258 <entry>Type: <emphasis>time</emphasis></entry>
27259 <entry>Default: <emphasis>0s</emphasis></entry>
27260 </row>
27261 </tbody>
27262 </tgroup>
27263 </informaltable>
27264 <para>
27265 <indexterm role="concept">
27266 <primary>DNS</primary>
27267 <secondary>resolver options</secondary>
27268 </indexterm>
27269 <indexterm role="concept">
27270 <primary>timeout</primary>
27271 <secondary>dns lookup</secondary>
27272 </indexterm>
27273 <indexterm role="concept">
27274 <primary>DNS</primary>
27275 <secondary>timeout</secondary>
27276 </indexterm>
27277 The options <option>dns_retrans</option> and <option>dns_retry</option> can be used to set the
27278 retransmission and retry parameters for DNS lookups. Values of zero (the
27279 defaults) leave the system default settings unchanged. The first value is the
27280 time between retries, and the second is the number of retries. It isn&#x2019;t
27281 totally clear exactly how these settings affect the total time a DNS lookup may
27282 take. I haven&#x2019;t found any documentation about timeouts on DNS lookups; these
27283 parameter values are available in the external resolver interface structure,
27284 but nowhere does it seem to describe how they are used or what you might want
27285 to set in them.
27286 See also the <option>slow_lookup_log</option> option.
27287 </para>
27288 <para>
27289 <indexterm role="option">
27290 <primary><option>dns_retry</option></primary>
27291 </indexterm>
27292 </para>
27293 <informaltable frame="all">
27294 <tgroup cols="4" colsep="0" rowsep="0">
27295 <colspec colwidth="8*" align="left"/>
27296 <colspec colwidth="6*" align="center"/>
27297 <colspec colwidth="6*" align="center"/>
27298 <colspec colwidth="6*" align="right"/>
27299 <tbody>
27300 <row>
27301 <entry><option>dns_retry</option></entry>
27302 <entry>Use: <emphasis>main</emphasis></entry>
27303 <entry>Type: <emphasis>integer</emphasis></entry>
27304 <entry>Default: <emphasis>0</emphasis></entry>
27305 </row>
27306 </tbody>
27307 </tgroup>
27308 </informaltable>
27309 <para>
27310 See <option>dns_retrans</option> above.
27311 </para>
27312 <para>
27313 <indexterm role="option">
27314 <primary><option>dns_trust_aa</option></primary>
27315 </indexterm>
27316 </para>
27317 <informaltable frame="all">
27318 <tgroup cols="4" colsep="0" rowsep="0">
27319 <colspec colwidth="8*" align="left"/>
27320 <colspec colwidth="6*" align="center"/>
27321 <colspec colwidth="6*" align="center"/>
27322 <colspec colwidth="6*" align="right"/>
27323 <tbody>
27324 <row>
27325 <entry><option>dns_trust_aa</option></entry>
27326 <entry>Use: <emphasis>main</emphasis></entry>
27327 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
27328 <entry>Default: <emphasis>unset</emphasis></entry>
27329 </row>
27330 </tbody>
27331 </tgroup>
27332 </informaltable>
27333 <para>
27334 <indexterm role="concept">
27335 <primary>DNS</primary>
27336 <secondary>resolver options</secondary>
27337 </indexterm>
27338 <indexterm role="concept">
27339 <primary>DNS</primary>
27340 <secondary>DNSSEC</secondary>
27341 </indexterm>
27342 If this option is set then lookup results marked with the AA bit
27343 (Authoritative Answer) are trusted the same way as if they were
27344 DNSSEC-verified. The authority section&#x2019;s name of the answer must
27345 match with this expanded domain list.
27346 </para>
27347 <para>
27348 Use this option only if you talk directly to a resolver that is
27349 authoritative for some zones and does not set the AD (Authentic Data)
27350 bit in the answer. Some DNS servers may have an configuration option to
27351 mark the answers from their own zones as verified (they set the AD bit).
27352 Others do not have this option. It is considered as poor practice using
27353 a resolver that is an authoritative server for some zones.
27354 </para>
27355 <para>
27356 Use this option only if you really have to (e.g. if you want
27357 to use DANE for remote delivery to a server that is listed in the DNS
27358 zones that your resolver is authoritative for).
27359 </para>
27360 <para>
27361 If the DNS answer packet has the AA bit set and contains resource record
27362 in the answer section, the name of the first NS record appearing in the
27363 authority section is compared against the list. If the answer packet is
27364 authoritative but the answer section is empty, the name of the first SOA
27365 record in the authoritative section is used instead.
27366 </para>
27367 <para>
27368 <indexterm role="concept">
27369 <primary>DNS</primary>
27370 <secondary>resolver options</secondary>
27371 </indexterm>
27372 <indexterm role="option">
27373 <primary><option>dns_use_edns0</option></primary>
27374 </indexterm>
27375 </para>
27376 <informaltable frame="all">
27377 <tgroup cols="4" colsep="0" rowsep="0">
27378 <colspec colwidth="8*" align="left"/>
27379 <colspec colwidth="6*" align="center"/>
27380 <colspec colwidth="6*" align="center"/>
27381 <colspec colwidth="6*" align="right"/>
27382 <tbody>
27383 <row>
27384 <entry><option>dns_use_edns0</option></entry>
27385 <entry>Use: <emphasis>main</emphasis></entry>
27386 <entry>Type: <emphasis>integer</emphasis></entry>
27387 <entry>Default: <emphasis>-1</emphasis></entry>
27388 </row>
27389 </tbody>
27390 </tgroup>
27391 </informaltable>
27392 <para>
27393 <indexterm role="concept">
27394 <primary>DNS</primary>
27395 <secondary>resolver options</secondary>
27396 </indexterm>
27397 <indexterm role="concept">
27398 <primary>DNS</primary>
27399 <secondary>EDNS0</secondary>
27400 </indexterm>
27401 <indexterm role="concept">
27402 <primary>DNS</primary>
27403 <secondary>OpenBSD</secondary>
27404 </indexterm>
27405 If this option is set to a non-negative number then Exim will initialise the
27406 DNS resolver library to either use or not use EDNS0 extensions, overriding
27407 the system default. A value of 0 coerces EDNS0 off, a value of 1 coerces EDNS0
27408 on.
27409 </para>
27410 <para>
27411 If the resolver library does not support EDNS0 then this option has no effect.
27412 </para>
27413 <para>
27414 OpenBSD&#x2019;s asr resolver routines are known to ignore the EDNS0 option; this
27415 means that DNSSEC will not work with Exim on that platform either, unless Exim
27416 is linked against an alternative DNS client library.
27417 </para>
27418 <para>
27419 <indexterm role="option">
27420 <primary><option>drop_cr</option></primary>
27421 </indexterm>
27422 </para>
27423 <informaltable frame="all">
27424 <tgroup cols="4" colsep="0" rowsep="0">
27425 <colspec colwidth="8*" align="left"/>
27426 <colspec colwidth="6*" align="center"/>
27427 <colspec colwidth="6*" align="center"/>
27428 <colspec colwidth="6*" align="right"/>
27429 <tbody>
27430 <row>
27431 <entry><option>drop_cr</option></entry>
27432 <entry>Use: <emphasis>main</emphasis></entry>
27433 <entry>Type: <emphasis>boolean</emphasis></entry>
27434 <entry>Default: <emphasis>false</emphasis></entry>
27435 </row>
27436 </tbody>
27437 </tgroup>
27438 </informaltable>
27439 <para>
27440 This is an obsolete option that is now a no-op. It used to affect the way Exim
27441 handled CR and LF characters in incoming messages. What happens now is
27442 described in section <xref linkend="SECTlineendings"/>.
27443 </para>
27444 <para>
27445 <indexterm role="option">
27446 <primary><option>dsn_advertise_hosts</option></primary>
27447 </indexterm>
27448 </para>
27449 <informaltable frame="all">
27450 <tgroup cols="4" colsep="0" rowsep="0">
27451 <colspec colwidth="8*" align="left"/>
27452 <colspec colwidth="6*" align="center"/>
27453 <colspec colwidth="6*" align="center"/>
27454 <colspec colwidth="6*" align="right"/>
27455 <tbody>
27456 <row>
27457 <entry><option>dsn_advertise_hosts</option></entry>
27458 <entry>Use: <emphasis>main</emphasis></entry>
27459 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
27460 <entry>Default: <emphasis>unset</emphasis></entry>
27461 </row>
27462 </tbody>
27463 </tgroup>
27464 </informaltable>
27465 <para>
27466 <indexterm role="concept">
27467 <primary>bounce messages</primary>
27468 <secondary>success</secondary>
27469 </indexterm>
27470 <indexterm role="concept">
27471 <primary>DSN</primary>
27472 <secondary>success</secondary>
27473 </indexterm>
27474 <indexterm role="concept">
27475 <primary>Delivery Status Notification</primary>
27476 <secondary>success</secondary>
27477 </indexterm>
27478 <indexterm role="concept">
27479 <primary>ESMTP extensions</primary>
27480 <secondary>DSN</secondary>
27481 </indexterm>
27482 DSN extensions (RFC3461) will be advertised in the EHLO message to,
27483 and accepted from, these hosts.
27484 Hosts may use the NOTIFY and ORCPT options on RCPT TO commands,
27485 and RET and ENVID options on MAIL FROM commands.
27486 A NOTIFY=SUCCESS option requests success-DSN messages.
27487 A NOTIFY= option with no argument requests that no delay or failure DSNs
27488 are sent.
27489 <emphasis role="bold">Note</emphasis>: Supplying success-DSN messages has been criticised
27490 on privacy grounds; it can leak details of internal forwarding.
27491 </para>
27492 <para>
27493 <indexterm role="option">
27494 <primary><option>dsn_from</option></primary>
27495 </indexterm>
27496 </para>
27497 <informaltable frame="all">
27498 <tgroup cols="4" colsep="0" rowsep="0">
27499 <colspec colwidth="8*" align="left"/>
27500 <colspec colwidth="6*" align="center"/>
27501 <colspec colwidth="6*" align="center"/>
27502 <colspec colwidth="6*" align="right"/>
27503 <tbody>
27504 <row>
27505 <entry><option>dsn_from</option></entry>
27506 <entry>Use: <emphasis>main</emphasis></entry>
27507 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27508 <entry>Default: <emphasis>see below</emphasis></entry>
27509 </row>
27510 </tbody>
27511 </tgroup>
27512 </informaltable>
27513 <para>
27514 <indexterm role="concept">
27515 <primary><emphasis>From:</emphasis> header line</primary>
27516 <secondary>in bounces</secondary>
27517 </indexterm>
27518 <indexterm role="concept">
27519 <primary>bounce messages</primary>
27520 <secondary><emphasis>From:</emphasis> line, specifying</secondary>
27521 </indexterm>
27522 This option can be used to vary the contents of <emphasis>From:</emphasis> header lines in
27523 bounces and other automatically generated messages (<quote>Delivery Status
27524 Notifications</quote> &ndash; hence the name of the option). The default setting is:
27525 </para>
27526 <literallayout class="monospaced">
27527 dsn_from = Mail Delivery System &lt;Mailer-Daemon@$qualify_domain&gt;
27528 </literallayout>
27529 <para>
27530 The value is expanded every time it is needed. If the expansion fails, a
27531 panic is logged, and the default value is used.
27532 </para>
27533 <para>
27534 <indexterm role="option">
27535 <primary><option>envelope_to_remove</option></primary>
27536 </indexterm>
27537 </para>
27538 <informaltable frame="all">
27539 <tgroup cols="4" colsep="0" rowsep="0">
27540 <colspec colwidth="8*" align="left"/>
27541 <colspec colwidth="6*" align="center"/>
27542 <colspec colwidth="6*" align="center"/>
27543 <colspec colwidth="6*" align="right"/>
27544 <tbody>
27545 <row>
27546 <entry><option>envelope_to_remove</option></entry>
27547 <entry>Use: <emphasis>main</emphasis></entry>
27548 <entry>Type: <emphasis>boolean</emphasis></entry>
27549 <entry>Default: <emphasis>true</emphasis></entry>
27550 </row>
27551 </tbody>
27552 </tgroup>
27553 </informaltable>
27554 <para>
27555 <indexterm role="concept">
27556 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
27557 </indexterm>
27558 Exim&#x2019;s transports have an option for adding an <emphasis>Envelope-to:</emphasis> header to a
27559 message when it is delivered, in exactly the same way as <emphasis>Return-path:</emphasis> is
27560 handled. <emphasis>Envelope-to:</emphasis> records the original recipient address from the
27561 message&#x2019;s envelope that caused the delivery to happen. Such headers should not
27562 be present in incoming messages, and this option causes them to be removed at
27563 the time the message is received, to avoid any problems that might occur when a
27564 delivered message is subsequently sent on to some other recipient.
27565 </para>
27566 <para>
27567 <indexterm role="option">
27568 <primary><option>errors_copy</option></primary>
27569 </indexterm>
27570 </para>
27571 <informaltable frame="all">
27572 <tgroup cols="4" colsep="0" rowsep="0">
27573 <colspec colwidth="8*" align="left"/>
27574 <colspec colwidth="6*" align="center"/>
27575 <colspec colwidth="6*" align="center"/>
27576 <colspec colwidth="6*" align="right"/>
27577 <tbody>
27578 <row>
27579 <entry><option>errors_copy</option></entry>
27580 <entry>Use: <emphasis>main</emphasis></entry>
27581 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
27582 <entry>Default: <emphasis>unset</emphasis></entry>
27583 </row>
27584 </tbody>
27585 </tgroup>
27586 </informaltable>
27587 <para>
27588 <indexterm role="concept">
27589 <primary>bounce message</primary>
27590 <secondary>copy to other address</secondary>
27591 </indexterm>
27592 <indexterm role="concept">
27593 <primary>copy of bounce message</primary>
27594 </indexterm>
27595 Setting this option causes Exim to send bcc copies of bounce messages that it
27596 generates to other addresses. <emphasis role="bold">Note</emphasis>: This does not apply to bounce messages
27597 coming from elsewhere. The value of the option is a colon-separated list of
27598 items. Each item consists of a pattern, terminated by white space, followed by
27599 a comma-separated list of email addresses. If a pattern contains spaces, it
27600 must be enclosed in double quotes.
27601 </para>
27602 <para>
27603 Each pattern is processed in the same way as a single item in an address list
27604 (see section <xref linkend="SECTaddresslist"/>). When a pattern matches the recipient of
27605 the bounce message, the message is copied to the addresses on the list. The
27606 items are scanned in order, and once a matching one is found, no further items
27607 are examined. For example:
27608 </para>
27609 <literallayout class="monospaced">
27610 errors_copy = spqr@mydomain   postmaster@mydomain.example :\
27611               rqps@mydomain   hostmaster@mydomain.example,\
27612                               postmaster@mydomain.example
27613 </literallayout>
27614 <para>
27615 <indexterm role="variable">
27616 <primary><varname>$domain</varname></primary>
27617 </indexterm>
27618 <indexterm role="variable">
27619 <primary><varname>$local_part</varname></primary>
27620 </indexterm>
27621 The address list is expanded before use. The expansion variables <varname>$local_part</varname>
27622 and <varname>$domain</varname> are set from the original recipient of the error message, and if
27623 there was any wildcard matching in the pattern, the expansion
27624 <indexterm role="concept">
27625 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
27626 <secondary>in <option>errors_copy</option></secondary>
27627 </indexterm>
27628 variables <varname>$0</varname>, <varname>$1</varname>, etc. are set in the normal way.
27629 </para>
27630 <para>
27631 <indexterm role="option">
27632 <primary><option>errors_reply_to</option></primary>
27633 </indexterm>
27634 </para>
27635 <informaltable frame="all">
27636 <tgroup cols="4" colsep="0" rowsep="0">
27637 <colspec colwidth="8*" align="left"/>
27638 <colspec colwidth="6*" align="center"/>
27639 <colspec colwidth="6*" align="center"/>
27640 <colspec colwidth="6*" align="right"/>
27641 <tbody>
27642 <row>
27643 <entry><option>errors_reply_to</option></entry>
27644 <entry>Use: <emphasis>main</emphasis></entry>
27645 <entry>Type: <emphasis>string</emphasis></entry>
27646 <entry>Default: <emphasis>unset</emphasis></entry>
27647 </row>
27648 </tbody>
27649 </tgroup>
27650 </informaltable>
27651 <para>
27652 <indexterm role="concept">
27653 <primary>bounce message</primary>
27654 <secondary><emphasis>Reply-to:</emphasis> in</secondary>
27655 </indexterm>
27656 By default, Exim&#x2019;s bounce and delivery warning messages contain the header line
27657 </para>
27658 <literallayout>
27659 <literal>From: Mail Delivery System &lt;Mailer-Daemon@</literal><emphasis>qualify-domain</emphasis><literal>&gt;</literal>
27660 </literallayout>
27661 <para>
27662 <indexterm role="option">
27663 <primary><option>quota_warn_message</option></primary>
27664 </indexterm>
27665 where <emphasis>qualify-domain</emphasis> is the value of the <option>qualify_domain</option> option.
27666 A warning message that is generated by the <option>quota_warn_message</option> option in an
27667 <command>appendfile</command> transport may contain its own <emphasis>From:</emphasis> header line that
27668 overrides the default.
27669 </para>
27670 <para>
27671 Experience shows that people reply to bounce messages. If the
27672 <option>errors_reply_to</option> option is set, a <emphasis>Reply-To:</emphasis> header is added to bounce
27673 and warning messages. For example:
27674 </para>
27675 <literallayout class="monospaced">
27676 errors_reply_to = postmaster@my.domain.example
27677 </literallayout>
27678 <para>
27679 The value of the option is not expanded. It must specify a valid RFC 2822
27680 address. However, if a warning message that is generated by the
27681 <option>quota_warn_message</option> option in an <command>appendfile</command> transport contain its
27682 own <emphasis>Reply-To:</emphasis> header line, the value of the <option>errors_reply_to</option> option is
27683 not used.
27684 </para>
27685 <para>
27686 <indexterm role="option">
27687 <primary><option>event_action</option></primary>
27688 </indexterm>
27689 </para>
27690 <informaltable frame="all">
27691 <tgroup cols="4" colsep="0" rowsep="0">
27692 <colspec colwidth="8*" align="left"/>
27693 <colspec colwidth="6*" align="center"/>
27694 <colspec colwidth="6*" align="center"/>
27695 <colspec colwidth="6*" align="right"/>
27696 <tbody>
27697 <row>
27698 <entry><option>event_action</option></entry>
27699 <entry>Use: <emphasis>main</emphasis></entry>
27700 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
27701 <entry>Default: <emphasis>unset</emphasis></entry>
27702 </row>
27703 </tbody>
27704 </tgroup>
27705 </informaltable>
27706 <para>
27707 <indexterm role="concept">
27708 <primary>events</primary>
27709 </indexterm>
27710 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
27711 For details see chapter <xref linkend="CHAPevents"/>.
27712 </para>
27713 <para>
27714 <indexterm role="option">
27715 <primary><option>exim_group</option></primary>
27716 </indexterm>
27717 </para>
27718 <informaltable frame="all">
27719 <tgroup cols="4" colsep="0" rowsep="0">
27720 <colspec colwidth="8*" align="left"/>
27721 <colspec colwidth="6*" align="center"/>
27722 <colspec colwidth="6*" align="center"/>
27723 <colspec colwidth="6*" align="right"/>
27724 <tbody>
27725 <row>
27726 <entry><option>exim_group</option></entry>
27727 <entry>Use: <emphasis>main</emphasis></entry>
27728 <entry>Type: <emphasis>string</emphasis></entry>
27729 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
27730 </row>
27731 </tbody>
27732 </tgroup>
27733 </informaltable>
27734 <para>
27735 <indexterm role="concept">
27736 <primary>gid (group id)</primary>
27737 <secondary>Exim&#x2019;s own</secondary>
27738 </indexterm>
27739 <indexterm role="concept">
27740 <primary>Exim group</primary>
27741 </indexterm>
27742 This option changes the gid under which Exim runs when it gives up root
27743 privilege. The default value is compiled into the binary. The value of this
27744 option is used only when <option>exim_user</option> is also set. Unless it consists entirely
27745 of digits, the string is looked up using <function>getgrnam()</function>, and failure causes a
27746 configuration error. See chapter <xref linkend="CHAPsecurity"/> for a discussion of
27747 security issues.
27748 </para>
27749 <para>
27750 <indexterm role="option">
27751 <primary><option>exim_path</option></primary>
27752 </indexterm>
27753 </para>
27754 <informaltable frame="all">
27755 <tgroup cols="4" colsep="0" rowsep="0">
27756 <colspec colwidth="8*" align="left"/>
27757 <colspec colwidth="6*" align="center"/>
27758 <colspec colwidth="6*" align="center"/>
27759 <colspec colwidth="6*" align="right"/>
27760 <tbody>
27761 <row>
27762 <entry><option>exim_path</option></entry>
27763 <entry>Use: <emphasis>main</emphasis></entry>
27764 <entry>Type: <emphasis>string</emphasis></entry>
27765 <entry>Default: <emphasis>see below</emphasis></entry>
27766 </row>
27767 </tbody>
27768 </tgroup>
27769 </informaltable>
27770 <para>
27771 <indexterm role="concept">
27772 <primary>Exim binary, path name</primary>
27773 </indexterm>
27774 This option specifies the path name of the Exim binary, which is used when Exim
27775 needs to re-exec itself. The default is set up to point to the file <emphasis>exim</emphasis> in
27776 the directory configured at compile time by the BIN_DIRECTORY setting. It
27777 is necessary to change <option>exim_path</option> if, exceptionally, Exim is run from some
27778 other place.
27779 <emphasis role="bold">Warning</emphasis>: Do not use a macro to define the value of this option, because
27780 you will break those Exim utilities that scan the configuration file to find
27781 where the binary is. (They then use the <option>-bP</option> option to extract option
27782 settings such as the value of <option>spool_directory</option>.)
27783 </para>
27784 <para>
27785 <indexterm role="option">
27786 <primary><option>exim_user</option></primary>
27787 </indexterm>
27788 </para>
27789 <informaltable frame="all">
27790 <tgroup cols="4" colsep="0" rowsep="0">
27791 <colspec colwidth="8*" align="left"/>
27792 <colspec colwidth="6*" align="center"/>
27793 <colspec colwidth="6*" align="center"/>
27794 <colspec colwidth="6*" align="right"/>
27795 <tbody>
27796 <row>
27797 <entry><option>exim_user</option></entry>
27798 <entry>Use: <emphasis>main</emphasis></entry>
27799 <entry>Type: <emphasis>string</emphasis></entry>
27800 <entry>Default: <emphasis>compile-time configured</emphasis></entry>
27801 </row>
27802 </tbody>
27803 </tgroup>
27804 </informaltable>
27805 <para>
27806 <indexterm role="concept">
27807 <primary>uid (user id)</primary>
27808 <secondary>Exim&#x2019;s own</secondary>
27809 </indexterm>
27810 <indexterm role="concept">
27811 <primary>Exim user</primary>
27812 </indexterm>
27813 This option changes the uid under which Exim runs when it gives up root
27814 privilege. The default value is compiled into the binary. Ownership of the run
27815 time configuration file and the use of the <option>-C</option> and <option>-D</option> command line
27816 options is checked against the values in the binary, not what is set here.
27817 </para>
27818 <para>
27819 Unless it consists entirely of digits, the string is looked up using
27820 <function>getpwnam()</function>, and failure causes a configuration error. If <option>exim_group</option> is
27821 not also supplied, the gid is taken from the result of <function>getpwnam()</function> if it is
27822 used. See chapter <xref linkend="CHAPsecurity"/> for a discussion of security issues.
27823 </para>
27824 <para>
27825 <indexterm role="option">
27826 <primary><option>exim_version</option></primary>
27827 </indexterm>
27828 </para>
27829 <informaltable frame="all">
27830 <tgroup cols="4" colsep="0" rowsep="0">
27831 <colspec colwidth="8*" align="left"/>
27832 <colspec colwidth="6*" align="center"/>
27833 <colspec colwidth="6*" align="center"/>
27834 <colspec colwidth="6*" align="right"/>
27835 <tbody>
27836 <row>
27837 <entry><option>exim_version</option></entry>
27838 <entry>Use: <emphasis>main</emphasis></entry>
27839 <entry>Type: <emphasis>string</emphasis></entry>
27840 <entry>Default: <emphasis>current version</emphasis></entry>
27841 </row>
27842 </tbody>
27843 </tgroup>
27844 </informaltable>
27845 <para>
27846 <indexterm role="concept">
27847 <primary>Exim version</primary>
27848 </indexterm>
27849 <indexterm role="concept">
27850 <primary>customizing</primary>
27851 <secondary>version number</secondary>
27852 </indexterm>
27853 <indexterm role="concept">
27854 <primary>version number of Exim</primary>
27855 <secondary>override</secondary>
27856 </indexterm>
27857 This option overrides the <varname>$version_number</varname>/<varname>$exim_version</varname> that Exim reports in
27858 various places.  Use with care; this may fool stupid security scanners.
27859 </para>
27860 <para>
27861 <indexterm role="option">
27862 <primary><option>extra_local_interfaces</option></primary>
27863 </indexterm>
27864 </para>
27865 <informaltable frame="all">
27866 <tgroup cols="4" colsep="0" rowsep="0">
27867 <colspec colwidth="8*" align="left"/>
27868 <colspec colwidth="6*" align="center"/>
27869 <colspec colwidth="6*" align="center"/>
27870 <colspec colwidth="6*" align="right"/>
27871 <tbody>
27872 <row>
27873 <entry><option>extra_local_interfaces</option></entry>
27874 <entry>Use: <emphasis>main</emphasis></entry>
27875 <entry>Type: <emphasis>string list</emphasis></entry>
27876 <entry>Default: <emphasis>unset</emphasis></entry>
27877 </row>
27878 </tbody>
27879 </tgroup>
27880 </informaltable>
27881 <para>
27882 This option defines network interfaces that are to be considered local when
27883 routing, but which are not used for listening by the daemon. See section
27884 <xref linkend="SECTreclocipadd"/> for details.
27885 </para>
27886 <para>
27887 <indexterm role="option">
27888 <primary><option>extract_addresses_remove_arguments</option></primary>
27889 </indexterm>
27890 </para>
27891 <informaltable frame="all">
27892 <tgroup cols="4" colsep="0" rowsep="0">
27893 <colspec colwidth="8*" align="left"/>
27894 <colspec colwidth="6*" align="center"/>
27895 <colspec colwidth="6*" align="center"/>
27896 <colspec colwidth="6*" align="right"/>
27897 <tbody>
27898 <row>
27899 <entry><option>extract_addresses_remove_arguments</option></entry>
27900 <entry>Use: <emphasis>main</emphasis></entry>
27901 <entry>Type: <emphasis>boolean</emphasis></entry>
27902 <entry>Default: <emphasis>true</emphasis></entry>
27903 </row>
27904 </tbody>
27905 </tgroup>
27906 </informaltable>
27907 <para>
27908 <indexterm role="option">
27909 <primary><option>-t</option></primary>
27910 </indexterm>
27911 <indexterm role="concept">
27912 <primary>command line</primary>
27913 <secondary>addresses with <option>-t</option></secondary>
27914 </indexterm>
27915 <indexterm role="concept">
27916 <primary>Sendmail compatibility</primary>
27917 <secondary><option>-t</option> option</secondary>
27918 </indexterm>
27919 According to some Sendmail documentation (Sun, IRIX, HP-UX), if any addresses
27920 are present on the command line when the <option>-t</option> option is used to build an
27921 envelope from a message&#x2019;s <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis> and <emphasis>Bcc:</emphasis> headers, the command
27922 line addresses are removed from the recipients list. This is also how Smail
27923 behaves. However, other Sendmail documentation (the O&#x2019;Reilly book) states that
27924 command line addresses are added to those obtained from the header lines. When
27925 <option>extract_addresses_remove_arguments</option> is true (the default), Exim subtracts
27926 argument headers. If it is set false, Exim adds rather than removes argument
27927 addresses.
27928 </para>
27929 <para>
27930 <indexterm role="option">
27931 <primary><option>finduser_retries</option></primary>
27932 </indexterm>
27933 </para>
27934 <informaltable frame="all">
27935 <tgroup cols="4" colsep="0" rowsep="0">
27936 <colspec colwidth="8*" align="left"/>
27937 <colspec colwidth="6*" align="center"/>
27938 <colspec colwidth="6*" align="center"/>
27939 <colspec colwidth="6*" align="right"/>
27940 <tbody>
27941 <row>
27942 <entry><option>finduser_retries</option></entry>
27943 <entry>Use: <emphasis>main</emphasis></entry>
27944 <entry>Type: <emphasis>integer</emphasis></entry>
27945 <entry>Default: <emphasis>0</emphasis></entry>
27946 </row>
27947 </tbody>
27948 </tgroup>
27949 </informaltable>
27950 <para>
27951 <indexterm role="concept">
27952 <primary>NIS, retrying user lookups</primary>
27953 </indexterm>
27954 On systems running NIS or other schemes in which user and group information is
27955 distributed from a remote system, there can be times when <function>getpwnam()</function> and
27956 related functions fail, even when given valid data, because things time out.
27957 Unfortunately these failures cannot be distinguished from genuine <quote>not found</quote>
27958 errors. If <option>finduser_retries</option> is set greater than zero, Exim will try that
27959 many extra times to find a user or a group, waiting for one second between
27960 retries.
27961 </para>
27962 <para>
27963 <indexterm role="concept">
27964 <primary><filename>/etc/passwd</filename></primary>
27965 <secondary>multiple reading of</secondary>
27966 </indexterm>
27967 You should not set this option greater than zero if your user information is in
27968 a traditional <filename>/etc/passwd</filename> file, because it will cause Exim needlessly to
27969 search the file multiple times for non-existent users, and also cause delay.
27970 </para>
27971 <para>
27972 <indexterm role="option">
27973 <primary><option>freeze_tell</option></primary>
27974 </indexterm>
27975 </para>
27976 <informaltable frame="all">
27977 <tgroup cols="4" colsep="0" rowsep="0">
27978 <colspec colwidth="8*" align="left"/>
27979 <colspec colwidth="6*" align="center"/>
27980 <colspec colwidth="6*" align="center"/>
27981 <colspec colwidth="6*" align="right"/>
27982 <tbody>
27983 <row>
27984 <entry><option>freeze_tell</option></entry>
27985 <entry>Use: <emphasis>main</emphasis></entry>
27986 <entry>Type: <emphasis>string list, comma separated</emphasis></entry>
27987 <entry>Default: <emphasis>unset</emphasis></entry>
27988 </row>
27989 </tbody>
27990 </tgroup>
27991 </informaltable>
27992 <para>
27993 <indexterm role="concept">
27994 <primary>freezing messages</primary>
27995 <secondary>sending a message when freezing</secondary>
27996 </indexterm>
27997 On encountering certain errors, or when configured to do so in a system filter,
27998 ACL, or special router, Exim freezes a message. This means that no further
27999 delivery attempts take place until an administrator thaws the message, or the
28000 <option>auto_thaw</option>, <option>ignore_bounce_errors_after</option>, or <option>timeout_frozen_after</option>
28001 feature cause it to be processed. If <option>freeze_tell</option> is set, Exim generates a
28002 warning message whenever it freezes something, unless the message it is
28003 freezing is a locally-generated bounce message. (Without this exception there
28004 is the possibility of looping.) The warning message is sent to the addresses
28005 supplied as the comma-separated value of this option. If several of the
28006 message&#x2019;s addresses cause freezing, only a single message is sent. If the
28007 freezing was automatic, the reason(s) for freezing can be found in the message
28008 log. If you configure freezing in a filter or ACL, you must arrange for any
28009 logging that you require.
28010 </para>
28011 <para>
28012 <indexterm role="option">
28013 <primary><option>gecos_name</option></primary>
28014 </indexterm>
28015 </para>
28016 <informaltable frame="all">
28017 <tgroup cols="4" colsep="0" rowsep="0">
28018 <colspec colwidth="8*" align="left"/>
28019 <colspec colwidth="6*" align="center"/>
28020 <colspec colwidth="6*" align="center"/>
28021 <colspec colwidth="6*" align="right"/>
28022 <tbody>
28023 <row>
28024 <entry><option>gecos_name</option></entry>
28025 <entry>Use: <emphasis>main</emphasis></entry>
28026 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
28027 <entry>Default: <emphasis>unset</emphasis></entry>
28028 </row>
28029 </tbody>
28030 </tgroup>
28031 </informaltable>
28032 <para>
28033 <indexterm role="concept">
28034 <primary>HP-UX</primary>
28035 </indexterm>
28036 <indexterm role="concept">
28037 <primary><quote>gecos</quote> field, parsing</primary>
28038 </indexterm>
28039 Some operating systems, notably HP-UX, use the <quote>gecos</quote> field in the system
28040 password file to hold other information in addition to users&#x2019; real names. Exim
28041 looks up this field for use when it is creating <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis>
28042 headers. If either <option>gecos_pattern</option> or <option>gecos_name</option> are unset, the contents
28043 of the field are used unchanged, except that, if an ampersand is encountered,
28044 it is replaced by the user&#x2019;s login name with the first character forced to
28045 upper case, since this is a convention that is observed on many systems.
28046 </para>
28047 <para>
28048 When these options are set, <option>gecos_pattern</option> is treated as a regular
28049 expression that is to be applied to the field (again with &amp; replaced by the
28050 login name), and if it matches, <option>gecos_name</option> is expanded and used as the
28051 user&#x2019;s name.
28052 </para>
28053 <para>
28054 <indexterm role="concept">
28055 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
28056 <secondary>in <option>gecos_name</option></secondary>
28057 </indexterm>
28058 Numeric variables such as <varname>$1</varname>, <varname>$2</varname>, etc. can be used in the expansion to
28059 pick up sub-fields that were matched by the pattern. In HP-UX, where the user&#x2019;s
28060 name terminates at the first comma, the following can be used:
28061 </para>
28062 <literallayout class="monospaced">
28063 gecos_pattern = ([^,]*)
28064 gecos_name = $1
28065 </literallayout>
28066 <para>
28067 <indexterm role="option">
28068 <primary><option>gecos_pattern</option></primary>
28069 </indexterm>
28070 </para>
28071 <informaltable frame="all">
28072 <tgroup cols="4" colsep="0" rowsep="0">
28073 <colspec colwidth="8*" align="left"/>
28074 <colspec colwidth="6*" align="center"/>
28075 <colspec colwidth="6*" align="center"/>
28076 <colspec colwidth="6*" align="right"/>
28077 <tbody>
28078 <row>
28079 <entry><option>gecos_pattern</option></entry>
28080 <entry>Use: <emphasis>main</emphasis></entry>
28081 <entry>Type: <emphasis>string</emphasis></entry>
28082 <entry>Default: <emphasis>unset</emphasis></entry>
28083 </row>
28084 </tbody>
28085 </tgroup>
28086 </informaltable>
28087 <para>
28088 See <option>gecos_name</option> above.
28089 </para>
28090 <para>
28091 <indexterm role="option">
28092 <primary><option>gnutls_compat_mode</option></primary>
28093 </indexterm>
28094 </para>
28095 <informaltable frame="all">
28096 <tgroup cols="4" colsep="0" rowsep="0">
28097 <colspec colwidth="8*" align="left"/>
28098 <colspec colwidth="6*" align="center"/>
28099 <colspec colwidth="6*" align="center"/>
28100 <colspec colwidth="6*" align="right"/>
28101 <tbody>
28102 <row>
28103 <entry><option>gnutls_compat_mode</option></entry>
28104 <entry>Use: <emphasis>main</emphasis></entry>
28105 <entry>Type: <emphasis>boolean</emphasis></entry>
28106 <entry>Default: <emphasis>unset</emphasis></entry>
28107 </row>
28108 </tbody>
28109 </tgroup>
28110 </informaltable>
28111 <para>
28112 This option controls whether GnuTLS is used in compatibility mode in an Exim
28113 server. This reduces security slightly, but improves interworking with older
28114 implementations of TLS.
28115 </para>
28116 <para>
28117 <indexterm role="option">
28118 <primary><option>gnutls_allow_auto_pkcs11</option></primary>
28119 </indexterm>
28120 </para>
28121 <informaltable frame="all">
28122 <tgroup cols="4" colsep="0" rowsep="0">
28123 <colspec colwidth="8*" align="left"/>
28124 <colspec colwidth="6*" align="center"/>
28125 <colspec colwidth="6*" align="center"/>
28126 <colspec colwidth="6*" align="right"/>
28127 <tbody>
28128 <row>
28129 <entry><option>gnutls_allow_auto_pkcs11</option></entry>
28130 <entry>Use: <emphasis>main</emphasis></entry>
28131 <entry>Type: <emphasis>boolean</emphasis></entry>
28132 <entry>Default: <emphasis>unset</emphasis></entry>
28133 </row>
28134 </tbody>
28135 </tgroup>
28136 </informaltable>
28137 <para>
28138 This option will let GnuTLS (2.12.0 or later) autoload PKCS11 modules with
28139 the p11-kit configuration files in <filename>/etc/pkcs11/modules/</filename>.
28140 </para>
28141 <para>
28142 See
28143 <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>
28144 for documentation.
28145 </para>
28146 <para>
28147 <indexterm role="option">
28148 <primary><option>headers_charset</option></primary>
28149 </indexterm>
28150 </para>
28151 <informaltable frame="all">
28152 <tgroup cols="4" colsep="0" rowsep="0">
28153 <colspec colwidth="8*" align="left"/>
28154 <colspec colwidth="6*" align="center"/>
28155 <colspec colwidth="6*" align="center"/>
28156 <colspec colwidth="6*" align="right"/>
28157 <tbody>
28158 <row>
28159 <entry><option>headers_charset</option></entry>
28160 <entry>Use: <emphasis>main</emphasis></entry>
28161 <entry>Type: <emphasis>string</emphasis></entry>
28162 <entry>Default: <emphasis>see below</emphasis></entry>
28163 </row>
28164 </tbody>
28165 </tgroup>
28166 </informaltable>
28167 <para>
28168 This option sets a default character set for translating from encoded MIME
28169 <quote>words</quote> in header lines, when referenced by an <varname>$h_xxx</varname> expansion item. The
28170 default is the value of HEADERS_CHARSET in <filename>Local/Makefile</filename>. The
28171 ultimate default is ISO-8859-1. For more details see the description of header
28172 insertions in section <xref linkend="SECTexpansionitems"/>.
28173 </para>
28174 <para>
28175 <indexterm role="option">
28176 <primary><option>header_maxsize</option></primary>
28177 </indexterm>
28178 </para>
28179 <informaltable frame="all">
28180 <tgroup cols="4" colsep="0" rowsep="0">
28181 <colspec colwidth="8*" align="left"/>
28182 <colspec colwidth="6*" align="center"/>
28183 <colspec colwidth="6*" align="center"/>
28184 <colspec colwidth="6*" align="right"/>
28185 <tbody>
28186 <row>
28187 <entry><option>header_maxsize</option></entry>
28188 <entry>Use: <emphasis>main</emphasis></entry>
28189 <entry>Type: <emphasis>integer</emphasis></entry>
28190 <entry>Default: <emphasis>see below</emphasis></entry>
28191 </row>
28192 </tbody>
28193 </tgroup>
28194 </informaltable>
28195 <para>
28196 <indexterm role="concept">
28197 <primary>header section</primary>
28198 <secondary>maximum size of</secondary>
28199 </indexterm>
28200 <indexterm role="concept">
28201 <primary>limit</primary>
28202 <secondary>size of message header section</secondary>
28203 </indexterm>
28204 This option controls the overall maximum size of a message&#x2019;s header
28205 section. The default is the value of HEADER_MAXSIZE in
28206 <filename>Local/Makefile</filename>; the default for that is 1M. Messages with larger header
28207 sections are rejected.
28208 </para>
28209 <para>
28210 <indexterm role="option">
28211 <primary><option>header_line_maxsize</option></primary>
28212 </indexterm>
28213 </para>
28214 <informaltable frame="all">
28215 <tgroup cols="4" colsep="0" rowsep="0">
28216 <colspec colwidth="8*" align="left"/>
28217 <colspec colwidth="6*" align="center"/>
28218 <colspec colwidth="6*" align="center"/>
28219 <colspec colwidth="6*" align="right"/>
28220 <tbody>
28221 <row>
28222 <entry><option>header_line_maxsize</option></entry>
28223 <entry>Use: <emphasis>main</emphasis></entry>
28224 <entry>Type: <emphasis>integer</emphasis></entry>
28225 <entry>Default: <emphasis>0</emphasis></entry>
28226 </row>
28227 </tbody>
28228 </tgroup>
28229 </informaltable>
28230 <para>
28231 <indexterm role="concept">
28232 <primary>header lines</primary>
28233 <secondary>maximum size of</secondary>
28234 </indexterm>
28235 <indexterm role="concept">
28236 <primary>limit</primary>
28237 <secondary>size of one header line</secondary>
28238 </indexterm>
28239 This option limits the length of any individual header line in a message, after
28240 all the continuations have been joined together. Messages with individual
28241 header lines that are longer than the limit are rejected. The default value of
28242 zero means <quote>no limit</quote>.
28243 </para>
28244 <para>
28245 <indexterm role="option">
28246 <primary><option>helo_accept_junk_hosts</option></primary>
28247 </indexterm>
28248 </para>
28249 <informaltable frame="all">
28250 <tgroup cols="4" colsep="0" rowsep="0">
28251 <colspec colwidth="8*" align="left"/>
28252 <colspec colwidth="6*" align="center"/>
28253 <colspec colwidth="6*" align="center"/>
28254 <colspec colwidth="6*" align="right"/>
28255 <tbody>
28256 <row>
28257 <entry><option>helo_accept_junk_hosts</option></entry>
28258 <entry>Use: <emphasis>main</emphasis></entry>
28259 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28260 <entry>Default: <emphasis>unset</emphasis></entry>
28261 </row>
28262 </tbody>
28263 </tgroup>
28264 </informaltable>
28265 <para>
28266 <indexterm role="concept">
28267 <primary>HELO</primary>
28268 <secondary>accepting junk data</secondary>
28269 </indexterm>
28270 <indexterm role="concept">
28271 <primary>EHLO</primary>
28272 <secondary>accepting junk data</secondary>
28273 </indexterm>
28274 Exim checks the syntax of HELO and EHLO commands for incoming SMTP
28275 mail, and gives an error response for invalid data. Unfortunately, there are
28276 some SMTP clients that send syntactic junk. They can be accommodated by setting
28277 this option. Note that this is a syntax check only. See <option>helo_verify_hosts</option>
28278 if you want to do semantic checking.
28279 See also <option>helo_allow_chars</option> for a way of extending the permitted character
28280 set.
28281 </para>
28282 <para>
28283 <indexterm role="option">
28284 <primary><option>helo_allow_chars</option></primary>
28285 </indexterm>
28286 </para>
28287 <informaltable frame="all">
28288 <tgroup cols="4" colsep="0" rowsep="0">
28289 <colspec colwidth="8*" align="left"/>
28290 <colspec colwidth="6*" align="center"/>
28291 <colspec colwidth="6*" align="center"/>
28292 <colspec colwidth="6*" align="right"/>
28293 <tbody>
28294 <row>
28295 <entry><option>helo_allow_chars</option></entry>
28296 <entry>Use: <emphasis>main</emphasis></entry>
28297 <entry>Type: <emphasis>string</emphasis></entry>
28298 <entry>Default: <emphasis>unset</emphasis></entry>
28299 </row>
28300 </tbody>
28301 </tgroup>
28302 </informaltable>
28303 <para>
28304 <indexterm role="concept">
28305 <primary>HELO</primary>
28306 <secondary>underscores in</secondary>
28307 </indexterm>
28308 <indexterm role="concept">
28309 <primary>EHLO</primary>
28310 <secondary>underscores in</secondary>
28311 </indexterm>
28312 <indexterm role="concept">
28313 <primary>underscore in EHLO/HELO</primary>
28314 </indexterm>
28315 This option can be set to a string of rogue characters that are permitted in
28316 all EHLO and HELO names in addition to the standard letters, digits,
28317 hyphens, and dots. If you really must allow underscores, you can set
28318 </para>
28319 <literallayout class="monospaced">
28320 helo_allow_chars = _
28321 </literallayout>
28322 <para>
28323 Note that the value is one string, not a list.
28324 </para>
28325 <para>
28326 <indexterm role="option">
28327 <primary><option>helo_lookup_domains</option></primary>
28328 </indexterm>
28329 </para>
28330 <informaltable frame="all">
28331 <tgroup cols="4" colsep="0" rowsep="0">
28332 <colspec colwidth="8*" align="left"/>
28333 <colspec colwidth="6*" align="center"/>
28334 <colspec colwidth="6*" align="center"/>
28335 <colspec colwidth="6*" align="right"/>
28336 <tbody>
28337 <row>
28338 <entry><option>helo_lookup_domains</option></entry>
28339 <entry>Use: <emphasis>main</emphasis></entry>
28340 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28341 <entry>Default: <emphasis><literal>@:@[]</literal></emphasis></entry>
28342 </row>
28343 </tbody>
28344 </tgroup>
28345 </informaltable>
28346 <para>
28347 <indexterm role="concept">
28348 <primary>HELO</primary>
28349 <secondary>forcing reverse lookup</secondary>
28350 </indexterm>
28351 <indexterm role="concept">
28352 <primary>EHLO</primary>
28353 <secondary>forcing reverse lookup</secondary>
28354 </indexterm>
28355 If the domain given by a client in a HELO or EHLO command matches this
28356 list, a reverse lookup is done in order to establish the host&#x2019;s true name. The
28357 default forces a lookup if the client host gives the server&#x2019;s name or any of
28358 its IP addresses (in brackets), something that broken clients have been seen to
28359 do.
28360 </para>
28361 <para>
28362 <indexterm role="option">
28363 <primary><option>helo_try_verify_hosts</option></primary>
28364 </indexterm>
28365 </para>
28366 <informaltable frame="all">
28367 <tgroup cols="4" colsep="0" rowsep="0">
28368 <colspec colwidth="8*" align="left"/>
28369 <colspec colwidth="6*" align="center"/>
28370 <colspec colwidth="6*" align="center"/>
28371 <colspec colwidth="6*" align="right"/>
28372 <tbody>
28373 <row>
28374 <entry><option>helo_try_verify_hosts</option></entry>
28375 <entry>Use: <emphasis>main</emphasis></entry>
28376 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28377 <entry>Default: <emphasis>unset</emphasis></entry>
28378 </row>
28379 </tbody>
28380 </tgroup>
28381 </informaltable>
28382 <para>
28383 <indexterm role="concept">
28384 <primary>HELO verifying</primary>
28385 <secondary>optional</secondary>
28386 </indexterm>
28387 <indexterm role="concept">
28388 <primary>EHLO</primary>
28389 <secondary>verifying, optional</secondary>
28390 </indexterm>
28391 By default, Exim just checks the syntax of HELO and EHLO commands (see
28392 <option>helo_accept_junk_hosts</option> and <option>helo_allow_chars</option>). However, some sites like
28393 to do more extensive checking of the data supplied by these commands. The ACL
28394 condition <literal>verify = helo</literal> is provided to make this possible.
28395 Formerly, it was necessary also to set this option (<option>helo_try_verify_hosts</option>)
28396 to force the check to occur. From release 4.53 onwards, this is no longer
28397 necessary. If the check has not been done before <literal>verify = helo</literal> is
28398 encountered, it is done at that time. Consequently, this option is obsolete.
28399 Its specification is retained here for backwards compatibility.
28400 </para>
28401 <para>
28402 When an EHLO or HELO command is received, if the calling host matches
28403 <option>helo_try_verify_hosts</option>, Exim checks that the host name given in the HELO or
28404 EHLO command either:
28405 </para>
28406 <itemizedlist>
28407 <listitem>
28408 <para>
28409 is an IP literal matching the calling address of the host, or
28410 </para>
28411 </listitem>
28412 <listitem>
28413 <para>
28414 <indexterm role="concept">
28415 <primary>DNS</primary>
28416 <secondary>reverse lookup</secondary>
28417 </indexterm>
28418 <indexterm role="concept">
28419 <primary>reverse DNS lookup</primary>
28420 </indexterm>
28421 matches the host name that Exim obtains by doing a reverse lookup of the
28422 calling host address, or
28423 </para>
28424 </listitem>
28425 <listitem>
28426 <para>
28427 when looked up in DNS yields the calling host address.
28428 </para>
28429 </listitem>
28430 </itemizedlist>
28431 <para>
28432 However, the EHLO or HELO command is not rejected if any of the checks
28433 fail. Processing continues, but the result of the check is remembered, and can
28434 be detected later in an ACL by the <literal>verify = helo</literal> condition.
28435 </para>
28436 <para>
28437 If DNS was used for successful verification, the variable
28438 <indexterm role="concept">
28439 <primary>DNS</primary>
28440 <secondary>DNSSEC</secondary>
28441 </indexterm>
28442 <varname>$helo_verify_dnssec</varname> records the DNSSEC status of the lookups.
28443 </para>
28444 <para>
28445 <indexterm role="option">
28446 <primary><option>helo_verify_hosts</option></primary>
28447 </indexterm>
28448 </para>
28449 <informaltable frame="all">
28450 <tgroup cols="4" colsep="0" rowsep="0">
28451 <colspec colwidth="8*" align="left"/>
28452 <colspec colwidth="6*" align="center"/>
28453 <colspec colwidth="6*" align="center"/>
28454 <colspec colwidth="6*" align="right"/>
28455 <tbody>
28456 <row>
28457 <entry><option>helo_verify_hosts</option></entry>
28458 <entry>Use: <emphasis>main</emphasis></entry>
28459 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28460 <entry>Default: <emphasis>unset</emphasis></entry>
28461 </row>
28462 </tbody>
28463 </tgroup>
28464 </informaltable>
28465 <para>
28466 <indexterm role="concept">
28467 <primary>HELO verifying</primary>
28468 <secondary>mandatory</secondary>
28469 </indexterm>
28470 <indexterm role="concept">
28471 <primary>EHLO</primary>
28472 <secondary>verifying, mandatory</secondary>
28473 </indexterm>
28474 Like <option>helo_try_verify_hosts</option>, this option is obsolete, and retained only for
28475 backwards compatibility. For hosts that match this option, Exim checks the host
28476 name given in the HELO or EHLO in the same way as for
28477 <option>helo_try_verify_hosts</option>. If the check fails, the HELO or EHLO command is
28478 rejected with a 550 error, and entries are written to the main and reject logs.
28479 If a MAIL command is received before EHLO or HELO, it is rejected with a 503
28480 error.
28481 </para>
28482 <para>
28483 <indexterm role="option">
28484 <primary><option>hold_domains</option></primary>
28485 </indexterm>
28486 </para>
28487 <informaltable frame="all">
28488 <tgroup cols="4" colsep="0" rowsep="0">
28489 <colspec colwidth="8*" align="left"/>
28490 <colspec colwidth="6*" align="center"/>
28491 <colspec colwidth="6*" align="center"/>
28492 <colspec colwidth="6*" align="right"/>
28493 <tbody>
28494 <row>
28495 <entry><option>hold_domains</option></entry>
28496 <entry>Use: <emphasis>main</emphasis></entry>
28497 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28498 <entry>Default: <emphasis>unset</emphasis></entry>
28499 </row>
28500 </tbody>
28501 </tgroup>
28502 </informaltable>
28503 <para>
28504 <indexterm role="concept">
28505 <primary>domain</primary>
28506 <secondary>delaying delivery</secondary>
28507 </indexterm>
28508 <indexterm role="concept">
28509 <primary>delivery</primary>
28510 <secondary>delaying certain domains</secondary>
28511 </indexterm>
28512 This option allows mail for particular domains to be held in the queue
28513 manually. The option is overridden if a message delivery is forced with the
28514 <option>-M</option>, <option>-qf</option>, <option>-Rf</option> or <option>-Sf</option> options, and also while testing or
28515 verifying addresses using <option>-bt</option> or <option>-bv</option>. Otherwise, if a domain matches an
28516 item in <option>hold_domains</option>, no routing or delivery for that address is done, and
28517 it is deferred every time the message is looked at.
28518 </para>
28519 <para>
28520 This option is intended as a temporary operational measure for delaying the
28521 delivery of mail while some problem is being sorted out, or some new
28522 configuration tested. If you just want to delay the processing of some
28523 domains until a queue run occurs, you should use <option>queue_domains</option> or
28524 <option>queue_smtp_domains</option>, not <option>hold_domains</option>.
28525 </para>
28526 <para>
28527 A setting of <option>hold_domains</option> does not override Exim&#x2019;s code for removing
28528 messages from the queue if they have been there longer than the longest retry
28529 time in any retry rule. If you want to hold messages for longer than the normal
28530 retry times, insert a dummy retry rule with a long retry time.
28531 </para>
28532 <para>
28533 <indexterm role="option">
28534 <primary><option>host_lookup</option></primary>
28535 </indexterm>
28536 </para>
28537 <informaltable frame="all">
28538 <tgroup cols="4" colsep="0" rowsep="0">
28539 <colspec colwidth="8*" align="left"/>
28540 <colspec colwidth="6*" align="center"/>
28541 <colspec colwidth="6*" align="center"/>
28542 <colspec colwidth="6*" align="right"/>
28543 <tbody>
28544 <row>
28545 <entry><option>host_lookup</option></entry>
28546 <entry>Use: <emphasis>main</emphasis></entry>
28547 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28548 <entry>Default: <emphasis>unset</emphasis></entry>
28549 </row>
28550 </tbody>
28551 </tgroup>
28552 </informaltable>
28553 <para>
28554 <indexterm role="concept">
28555 <primary>host name</primary>
28556 <secondary>lookup, forcing</secondary>
28557 </indexterm>
28558 Exim does not look up the name of a calling host from its IP address unless it
28559 is required to compare against some host list, or the host matches
28560 <option>helo_try_verify_hosts</option> or <option>helo_verify_hosts</option>, or the host matches this
28561 option (which normally contains IP addresses rather than host names). The
28562 default configuration file contains
28563 </para>
28564 <literallayout class="monospaced">
28565 host_lookup = *
28566 </literallayout>
28567 <para>
28568 which causes a lookup to happen for all hosts. If the expense of these lookups
28569 is felt to be too great, the setting can be changed or removed.
28570 </para>
28571 <para>
28572 After a successful reverse lookup, Exim does a forward lookup on the name it
28573 has obtained, to verify that it yields the IP address that it started with. If
28574 this check fails, Exim behaves as if the name lookup failed.
28575 </para>
28576 <para>
28577 <indexterm role="variable">
28578 <primary><varname>$host_lookup_failed</varname></primary>
28579 </indexterm>
28580 <indexterm role="variable">
28581 <primary><varname>$sender_host_name</varname></primary>
28582 </indexterm>
28583 After any kind of failure, the host name (in <varname>$sender_host_name</varname>) remains
28584 unset, and <varname>$host_lookup_failed</varname> is set to the string <quote>1</quote>. See also
28585 <option>dns_again_means_nonexist</option>, <option>helo_lookup_domains</option>, and
28586 <literal>verify = reverse_host_lookup</literal> in ACLs.
28587 </para>
28588 <para>
28589 <indexterm role="option">
28590 <primary><option>host_lookup_order</option></primary>
28591 </indexterm>
28592 </para>
28593 <informaltable frame="all">
28594 <tgroup cols="4" colsep="0" rowsep="0">
28595 <colspec colwidth="8*" align="left"/>
28596 <colspec colwidth="6*" align="center"/>
28597 <colspec colwidth="6*" align="center"/>
28598 <colspec colwidth="6*" align="right"/>
28599 <tbody>
28600 <row>
28601 <entry><option>host_lookup_order</option></entry>
28602 <entry>Use: <emphasis>main</emphasis></entry>
28603 <entry>Type: <emphasis>string list</emphasis></entry>
28604 <entry>Default: <emphasis><literal>bydns:byaddr</literal></emphasis></entry>
28605 </row>
28606 </tbody>
28607 </tgroup>
28608 </informaltable>
28609 <para>
28610 This option specifies the order of different lookup methods when Exim is trying
28611 to find a host name from an IP address. The default is to do a DNS lookup
28612 first, and then to try a local lookup (using <function>gethostbyaddr()</function> or equivalent)
28613 if that fails. You can change the order of these lookups, or omit one entirely,
28614 if you want.
28615 </para>
28616 <para>
28617 <emphasis role="bold">Warning</emphasis>: The <quote>byaddr</quote> method does not always yield aliases when there are
28618 multiple PTR records in the DNS and the IP address is not listed in
28619 <filename>/etc/hosts</filename>. Different operating systems give different results in this
28620 case. That is why the default tries a DNS lookup first.
28621 </para>
28622 <para>
28623 <indexterm role="option">
28624 <primary><option>host_reject_connection</option></primary>
28625 </indexterm>
28626 </para>
28627 <informaltable frame="all">
28628 <tgroup cols="4" colsep="0" rowsep="0">
28629 <colspec colwidth="8*" align="left"/>
28630 <colspec colwidth="6*" align="center"/>
28631 <colspec colwidth="6*" align="center"/>
28632 <colspec colwidth="6*" align="right"/>
28633 <tbody>
28634 <row>
28635 <entry><option>host_reject_connection</option></entry>
28636 <entry>Use: <emphasis>main</emphasis></entry>
28637 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28638 <entry>Default: <emphasis>unset</emphasis></entry>
28639 </row>
28640 </tbody>
28641 </tgroup>
28642 </informaltable>
28643 <para>
28644 <indexterm role="concept">
28645 <primary>host</primary>
28646 <secondary>rejecting connections from</secondary>
28647 </indexterm>
28648 If this option is set, incoming SMTP calls from the hosts listed are rejected
28649 as soon as the connection is made.
28650 This option is obsolete, and retained only for backward compatibility, because
28651 nowadays the ACL specified by <option>acl_smtp_connect</option> can also reject incoming
28652 connections immediately.
28653 </para>
28654 <para>
28655 The ability to give an immediate rejection (either by this option or using an
28656 ACL) is provided for use in unusual cases. Many hosts will just try again,
28657 sometimes without much delay. Normally, it is better to use an ACL to reject
28658 incoming messages at a later stage, such as after RCPT commands. See
28659 chapter <xref linkend="CHAPACL"/>.
28660 </para>
28661 <para>
28662 <indexterm role="option">
28663 <primary><option>hosts_connection_nolog</option></primary>
28664 </indexterm>
28665 </para>
28666 <informaltable frame="all">
28667 <tgroup cols="4" colsep="0" rowsep="0">
28668 <colspec colwidth="8*" align="left"/>
28669 <colspec colwidth="6*" align="center"/>
28670 <colspec colwidth="6*" align="center"/>
28671 <colspec colwidth="6*" align="right"/>
28672 <tbody>
28673 <row>
28674 <entry><option>hosts_connection_nolog</option></entry>
28675 <entry>Use: <emphasis>main</emphasis></entry>
28676 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28677 <entry>Default: <emphasis>unset</emphasis></entry>
28678 </row>
28679 </tbody>
28680 </tgroup>
28681 </informaltable>
28682 <para>
28683 <indexterm role="concept">
28684 <primary>host</primary>
28685 <secondary>not logging connections from</secondary>
28686 </indexterm>
28687 This option defines a list of hosts for which connection logging does not
28688 happen, even though the <option>smtp_connection</option> log selector is set. For example,
28689 you might want not to log SMTP connections from local processes, or from
28690 127.0.0.1, or from your local LAN. This option is consulted in the main loop of
28691 the daemon; you should therefore strive to restrict its value to a short inline
28692 list of IP addresses and networks. To disable logging SMTP connections from
28693 local processes, you must create a host list with an empty item. For example:
28694 </para>
28695 <literallayout class="monospaced">
28696 hosts_connection_nolog = :
28697 </literallayout>
28698 <para>
28699 If the <option>smtp_connection</option> log selector is not set, this option has no effect.
28700 </para>
28701 <para>
28702 <indexterm role="option">
28703 <primary><option>hosts_require_alpn</option></primary>
28704 </indexterm>
28705 </para>
28706 <informaltable frame="all">
28707 <tgroup cols="4" colsep="0" rowsep="0">
28708 <colspec colwidth="8*" align="left"/>
28709 <colspec colwidth="6*" align="center"/>
28710 <colspec colwidth="6*" align="center"/>
28711 <colspec colwidth="6*" align="right"/>
28712 <tbody>
28713 <row>
28714 <entry><option>hosts_require_alpn</option></entry>
28715 <entry>Use: <emphasis>main</emphasis></entry>
28716 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28717 <entry>Default: <emphasis>unset</emphasis></entry>
28718 </row>
28719 </tbody>
28720 </tgroup>
28721 </informaltable>
28722 <para>
28723 <indexterm role="concept">
28724 <primary>ALPN</primary>
28725 <secondary>require negotiation in server</secondary>
28726 </indexterm>
28727 <indexterm role="concept">
28728 <primary>TLS</primary>
28729 <secondary>ALPN</secondary>
28730 </indexterm>
28731 <indexterm role="concept">
28732 <primary>TLS</primary>
28733 <secondary>Application Layer Protocol Names</secondary>
28734 </indexterm>
28735 If the TLS library supports ALPN
28736 then a successful negotiation of ALPN will be required for any client
28737 matching the list, for TLS to be used.
28738 See also the <option>tls_alpn</option> option.
28739 </para>
28740 <para>
28741 <emphasis role="bold">Note</emphasis>: prevention of fallback to in-clear connection is not
28742 managed by this option, and should be done separately.
28743 </para>
28744 <para>
28745 <indexterm role="option">
28746 <primary><option>hosts_require_helo</option></primary>
28747 </indexterm>
28748 </para>
28749 <informaltable frame="all">
28750 <tgroup cols="4" colsep="0" rowsep="0">
28751 <colspec colwidth="8*" align="left"/>
28752 <colspec colwidth="6*" align="center"/>
28753 <colspec colwidth="6*" align="center"/>
28754 <colspec colwidth="6*" align="right"/>
28755 <tbody>
28756 <row>
28757 <entry><option>hosts_require_helo</option></entry>
28758 <entry>Use: <emphasis>main</emphasis></entry>
28759 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28760 <entry>Default: <emphasis>*</emphasis></entry>
28761 </row>
28762 </tbody>
28763 </tgroup>
28764 </informaltable>
28765 <para>
28766 <indexterm role="concept">
28767 <primary>HELO/EHLO</primary>
28768 <secondary>requiring</secondary>
28769 </indexterm>
28770 Exim will require an accepted HELO or EHLO command from a host matching
28771 this list, before accepting a MAIL command.
28772 </para>
28773 <para>
28774 <indexterm role="option">
28775 <primary><option>hosts_proxy</option></primary>
28776 </indexterm>
28777 </para>
28778 <informaltable frame="all">
28779 <tgroup cols="4" colsep="0" rowsep="0">
28780 <colspec colwidth="8*" align="left"/>
28781 <colspec colwidth="6*" align="center"/>
28782 <colspec colwidth="6*" align="center"/>
28783 <colspec colwidth="6*" align="right"/>
28784 <tbody>
28785 <row>
28786 <entry><option>hosts_proxy</option></entry>
28787 <entry>Use: <emphasis>main</emphasis></entry>
28788 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28789 <entry>Default: <emphasis>unset</emphasis></entry>
28790 </row>
28791 </tbody>
28792 </tgroup>
28793 </informaltable>
28794 <para>
28795 <indexterm role="concept">
28796 <primary>proxy</primary>
28797 <secondary>proxy protocol</secondary>
28798 </indexterm>
28799 This option enables use of Proxy Protocol proxies for incoming
28800 connections.  For details see section <xref linkend="SECTproxyInbound"/>.
28801 </para>
28802 <para>
28803 <indexterm role="option">
28804 <primary><option>hosts_treat_as_local</option></primary>
28805 </indexterm>
28806 </para>
28807 <informaltable frame="all">
28808 <tgroup cols="4" colsep="0" rowsep="0">
28809 <colspec colwidth="8*" align="left"/>
28810 <colspec colwidth="6*" align="center"/>
28811 <colspec colwidth="6*" align="center"/>
28812 <colspec colwidth="6*" align="right"/>
28813 <tbody>
28814 <row>
28815 <entry><option>hosts_treat_as_local</option></entry>
28816 <entry>Use: <emphasis>main</emphasis></entry>
28817 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
28818 <entry>Default: <emphasis>unset</emphasis></entry>
28819 </row>
28820 </tbody>
28821 </tgroup>
28822 </informaltable>
28823 <para>
28824 <indexterm role="concept">
28825 <primary>local host</primary>
28826 <secondary>domains treated as</secondary>
28827 </indexterm>
28828 <indexterm role="concept">
28829 <primary>host</primary>
28830 <secondary>treated as local</secondary>
28831 </indexterm>
28832 If this option is set, any host names that match the domain list are treated as
28833 if they were the local host when Exim is scanning host lists obtained from MX
28834 records
28835 or other sources. Note that the value of this option is a domain list, not a
28836 host list, because it is always used to check host names, not IP addresses.
28837 </para>
28838 <para>
28839 This option also applies when Exim is matching the special items
28840 <literal>@mx_any</literal>, <literal>@mx_primary</literal>, and <literal>@mx_secondary</literal> in a domain list (see
28841 section <xref linkend="SECTdomainlist"/>), and when checking the <option>hosts</option> option in the
28842 <command>smtp</command> transport for the local host (see the <option>allow_localhost</option> option in
28843 that transport). See also <option>local_interfaces</option>, <option>extra_local_interfaces</option>, and
28844 chapter <xref linkend="CHAPinterfaces"/>, which contains a discussion about local network
28845 interfaces and recognizing the local host.
28846 </para>
28847 <para>
28848 <indexterm role="option">
28849 <primary><option>ibase_servers</option></primary>
28850 </indexterm>
28851 </para>
28852 <informaltable frame="all">
28853 <tgroup cols="4" colsep="0" rowsep="0">
28854 <colspec colwidth="8*" align="left"/>
28855 <colspec colwidth="6*" align="center"/>
28856 <colspec colwidth="6*" align="center"/>
28857 <colspec colwidth="6*" align="right"/>
28858 <tbody>
28859 <row>
28860 <entry><option>ibase_servers</option></entry>
28861 <entry>Use: <emphasis>main</emphasis></entry>
28862 <entry>Type: <emphasis>string list</emphasis></entry>
28863 <entry>Default: <emphasis>unset</emphasis></entry>
28864 </row>
28865 </tbody>
28866 </tgroup>
28867 </informaltable>
28868 <para>
28869 <indexterm role="concept">
28870 <primary>InterBase</primary>
28871 <secondary>server list</secondary>
28872 </indexterm>
28873 This option provides a list of InterBase servers and associated connection data,
28874 to be used in conjunction with <command>ibase</command> lookups (see section <xref linkend="SECID72"/>).
28875 The option is available only if Exim has been built with InterBase support.
28876 </para>
28877 <para>
28878 <indexterm role="option">
28879 <primary><option>ignore_bounce_errors_after</option></primary>
28880 </indexterm>
28881 </para>
28882 <informaltable frame="all">
28883 <tgroup cols="4" colsep="0" rowsep="0">
28884 <colspec colwidth="8*" align="left"/>
28885 <colspec colwidth="6*" align="center"/>
28886 <colspec colwidth="6*" align="center"/>
28887 <colspec colwidth="6*" align="right"/>
28888 <tbody>
28889 <row>
28890 <entry><option>ignore_bounce_errors_after</option></entry>
28891 <entry>Use: <emphasis>main</emphasis></entry>
28892 <entry>Type: <emphasis>time</emphasis></entry>
28893 <entry>Default: <emphasis>10w</emphasis></entry>
28894 </row>
28895 </tbody>
28896 </tgroup>
28897 </informaltable>
28898 <para>
28899 <indexterm role="concept">
28900 <primary>bounce message</primary>
28901 <secondary>discarding</secondary>
28902 </indexterm>
28903 <indexterm role="concept">
28904 <primary>discarding bounce message</primary>
28905 </indexterm>
28906 This option affects the processing of bounce messages that cannot be delivered,
28907 that is, those that suffer a permanent delivery failure. (Bounce messages that
28908 suffer temporary delivery failures are of course retried in the usual way.)
28909 </para>
28910 <para>
28911 After a permanent delivery failure, bounce messages are frozen,
28912 because there is no sender to whom they can be returned. When a frozen bounce
28913 message has been in the queue for more than the given time, it is unfrozen at
28914 the next queue run, and a further delivery is attempted. If delivery fails
28915 again, the bounce message is discarded. This makes it possible to keep failed
28916 bounce messages around for a shorter time than the normal maximum retry time
28917 for frozen messages. For example,
28918 </para>
28919 <literallayout class="monospaced">
28920 ignore_bounce_errors_after = 12h
28921 </literallayout>
28922 <para>
28923 retries failed bounce message deliveries after 12 hours, discarding any further
28924 failures. If the value of this option is set to a zero time period, bounce
28925 failures are discarded immediately. Setting a very long time (as in the default
28926 value) has the effect of disabling this option. For ways of automatically
28927 dealing with other kinds of frozen message, see <option>auto_thaw</option> and
28928 <option>timeout_frozen_after</option>.
28929 </para>
28930 <para>
28931 <indexterm role="option">
28932 <primary><option>ignore_fromline_hosts</option></primary>
28933 </indexterm>
28934 </para>
28935 <informaltable frame="all">
28936 <tgroup cols="4" colsep="0" rowsep="0">
28937 <colspec colwidth="8*" align="left"/>
28938 <colspec colwidth="6*" align="center"/>
28939 <colspec colwidth="6*" align="center"/>
28940 <colspec colwidth="6*" align="right"/>
28941 <tbody>
28942 <row>
28943 <entry><option>ignore_fromline_hosts</option></entry>
28944 <entry>Use: <emphasis>main</emphasis></entry>
28945 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
28946 <entry>Default: <emphasis>unset</emphasis></entry>
28947 </row>
28948 </tbody>
28949 </tgroup>
28950 </informaltable>
28951 <para>
28952 <indexterm role="concept">
28953 <primary><quote>From</quote> line</primary>
28954 </indexterm>
28955 <indexterm role="concept">
28956 <primary>UUCP</primary>
28957 <secondary><quote>From</quote> line</secondary>
28958 </indexterm>
28959 Some broken SMTP clients insist on sending a UUCP-like <quote>From&nbsp;</quote> line before
28960 the headers of a message. By default this is treated as the start of the
28961 message&#x2019;s body, which means that any following headers are not recognized as
28962 such. Exim can be made to ignore it by setting <option>ignore_fromline_hosts</option> to
28963 match those hosts that insist on sending it. If the sender is actually a local
28964 process rather than a remote host, and is using <option>-bs</option> to inject the messages,
28965 <option>ignore_fromline_local</option> must be set to achieve this effect.
28966 </para>
28967 <para>
28968 <indexterm role="option">
28969 <primary><option>ignore_fromline_local</option></primary>
28970 </indexterm>
28971 </para>
28972 <informaltable frame="all">
28973 <tgroup cols="4" colsep="0" rowsep="0">
28974 <colspec colwidth="8*" align="left"/>
28975 <colspec colwidth="6*" align="center"/>
28976 <colspec colwidth="6*" align="center"/>
28977 <colspec colwidth="6*" align="right"/>
28978 <tbody>
28979 <row>
28980 <entry><option>ignore_fromline_local</option></entry>
28981 <entry>Use: <emphasis>main</emphasis></entry>
28982 <entry>Type: <emphasis>boolean</emphasis></entry>
28983 <entry>Default: <emphasis>false</emphasis></entry>
28984 </row>
28985 </tbody>
28986 </tgroup>
28987 </informaltable>
28988 <para>
28989 See <option>ignore_fromline_hosts</option> above.
28990 </para>
28991 <para>
28992 <indexterm role="option">
28993 <primary><option>keep_environment</option></primary>
28994 </indexterm>
28995 </para>
28996 <informaltable frame="all">
28997 <tgroup cols="4" colsep="0" rowsep="0">
28998 <colspec colwidth="8*" align="left"/>
28999 <colspec colwidth="6*" align="center"/>
29000 <colspec colwidth="6*" align="center"/>
29001 <colspec colwidth="6*" align="right"/>
29002 <tbody>
29003 <row>
29004 <entry><option>keep_environment</option></entry>
29005 <entry>Use: <emphasis>main</emphasis></entry>
29006 <entry>Type: <emphasis>string list</emphasis></entry>
29007 <entry>Default: <emphasis>unset</emphasis></entry>
29008 </row>
29009 </tbody>
29010 </tgroup>
29011 </informaltable>
29012 <para>
29013 <indexterm role="concept">
29014 <primary>environment</primary>
29015 <secondary>values from</secondary>
29016 </indexterm>
29017 This option contains a string list of environment variables to keep.
29018 You have to trust these variables or you have to be sure that
29019 these variables do not impose any security risk. Keep in mind that
29020 during the startup phase Exim is running with an effective UID 0 in most
29021 installations. As the default value is an empty list, the default
29022 environment for using libraries, running embedded Perl code, or running
29023 external binaries is empty, and does not not even contain PATH or HOME.
29024 </para>
29025 <para>
29026 Actually the list is interpreted as a list of patterns
29027 (<xref linkend="SECTlistexpand"/>), except that it is not expanded first.
29028 </para>
29029 <para>
29030 WARNING: Macro substitution is still done first, so having a macro
29031 FOO and having FOO_HOME in your <option>keep_environment</option> option may have
29032 unexpected results. You may work around this using a regular expression
29033 that does not match the macro name: ^[F]OO_HOME$.
29034 </para>
29035 <para>
29036 Current versions of Exim issue a warning during startup if you do not mention
29037 <option>keep_environment</option> in your runtime configuration file and if your
29038 current environment is not empty. Future versions may not issue that warning
29039 anymore.
29040 </para>
29041 <para>
29042 See the <option>add_environment</option> main config option for a way to set
29043 environment variables to a fixed value.  The environment for <command>pipe</command>
29044 transports is handled separately, see section <xref linkend="SECTpipeenv"/> for
29045 details.
29046 </para>
29047 <para>
29048 <indexterm role="option">
29049 <primary><option>keep_malformed</option></primary>
29050 </indexterm>
29051 </para>
29052 <informaltable frame="all">
29053 <tgroup cols="4" colsep="0" rowsep="0">
29054 <colspec colwidth="8*" align="left"/>
29055 <colspec colwidth="6*" align="center"/>
29056 <colspec colwidth="6*" align="center"/>
29057 <colspec colwidth="6*" align="right"/>
29058 <tbody>
29059 <row>
29060 <entry><option>keep_malformed</option></entry>
29061 <entry>Use: <emphasis>main</emphasis></entry>
29062 <entry>Type: <emphasis>time</emphasis></entry>
29063 <entry>Default: <emphasis>4d</emphasis></entry>
29064 </row>
29065 </tbody>
29066 </tgroup>
29067 </informaltable>
29068 <para>
29069 This option specifies the length of time to keep messages whose spool files
29070 have been corrupted in some way. This should, of course, never happen. At the
29071 next attempt to deliver such a message, it gets removed. The incident is
29072 logged.
29073 </para>
29074 <para>
29075 <indexterm role="option">
29076 <primary><option>ldap_ca_cert_dir</option></primary>
29077 </indexterm>
29078 </para>
29079 <informaltable frame="all">
29080 <tgroup cols="4" colsep="0" rowsep="0">
29081 <colspec colwidth="8*" align="left"/>
29082 <colspec colwidth="6*" align="center"/>
29083 <colspec colwidth="6*" align="center"/>
29084 <colspec colwidth="6*" align="right"/>
29085 <tbody>
29086 <row>
29087 <entry><option>ldap_ca_cert_dir</option></entry>
29088 <entry>Use: <emphasis>main</emphasis></entry>
29089 <entry>Type: <emphasis>string</emphasis></entry>
29090 <entry>Default: <emphasis>unset</emphasis></entry>
29091 </row>
29092 </tbody>
29093 </tgroup>
29094 </informaltable>
29095 <para>
29096 <indexterm role="concept">
29097 <primary>LDAP</primary>
29098 <secondary>,</secondary>
29099 </indexterm>
29100 <indexterm role="concept">
29101 <primary>certificate</primary>
29102 <secondary>directory for LDAP</secondary>
29103 </indexterm>
29104 This option indicates which directory contains CA certificates for verifying
29105 a TLS certificate presented by an LDAP server.
29106 While Exim does not provide a default value, your SSL library may.
29107 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
29108 and constrained to be a directory.
29109 </para>
29110 <para>
29111 <indexterm role="option">
29112 <primary><option>ldap_ca_cert_file</option></primary>
29113 </indexterm>
29114 </para>
29115 <informaltable frame="all">
29116 <tgroup cols="4" colsep="0" rowsep="0">
29117 <colspec colwidth="8*" align="left"/>
29118 <colspec colwidth="6*" align="center"/>
29119 <colspec colwidth="6*" align="center"/>
29120 <colspec colwidth="6*" align="right"/>
29121 <tbody>
29122 <row>
29123 <entry><option>ldap_ca_cert_file</option></entry>
29124 <entry>Use: <emphasis>main</emphasis></entry>
29125 <entry>Type: <emphasis>string</emphasis></entry>
29126 <entry>Default: <emphasis>unset</emphasis></entry>
29127 </row>
29128 </tbody>
29129 </tgroup>
29130 </informaltable>
29131 <para>
29132 <indexterm role="concept">
29133 <primary>LDAP</primary>
29134 <secondary>,</secondary>
29135 </indexterm>
29136 <indexterm role="concept">
29137 <primary>certificate</primary>
29138 <secondary>file for LDAP</secondary>
29139 </indexterm>
29140 This option indicates which file contains CA certificates for verifying
29141 a TLS certificate presented by an LDAP server.
29142 While Exim does not provide a default value, your SSL library may.
29143 Analogous to <option>tls_verify_certificates</option> but as a client-side option for LDAP
29144 and constrained to be a file.
29145 </para>
29146 <para>
29147 <indexterm role="option">
29148 <primary><option>ldap_cert_file</option></primary>
29149 </indexterm>
29150 </para>
29151 <informaltable frame="all">
29152 <tgroup cols="4" colsep="0" rowsep="0">
29153 <colspec colwidth="8*" align="left"/>
29154 <colspec colwidth="6*" align="center"/>
29155 <colspec colwidth="6*" align="center"/>
29156 <colspec colwidth="6*" align="right"/>
29157 <tbody>
29158 <row>
29159 <entry><option>ldap_cert_file</option></entry>
29160 <entry>Use: <emphasis>main</emphasis></entry>
29161 <entry>Type: <emphasis>string</emphasis></entry>
29162 <entry>Default: <emphasis>unset</emphasis></entry>
29163 </row>
29164 </tbody>
29165 </tgroup>
29166 </informaltable>
29167 <para>
29168 <indexterm role="concept">
29169 <primary>LDAP</primary>
29170 <secondary>TLS client certificate file</secondary>
29171 </indexterm>
29172 <indexterm role="concept">
29173 <primary>certificate</primary>
29174 <secondary>file for LDAP</secondary>
29175 </indexterm>
29176 This option indicates which file contains an TLS client certificate which
29177 Exim should present to the LDAP server during TLS negotiation.
29178 Should be used together with <option>ldap_cert_key</option>.
29179 </para>
29180 <para>
29181 <indexterm role="option">
29182 <primary><option>ldap_cert_key</option></primary>
29183 </indexterm>
29184 </para>
29185 <informaltable frame="all">
29186 <tgroup cols="4" colsep="0" rowsep="0">
29187 <colspec colwidth="8*" align="left"/>
29188 <colspec colwidth="6*" align="center"/>
29189 <colspec colwidth="6*" align="center"/>
29190 <colspec colwidth="6*" align="right"/>
29191 <tbody>
29192 <row>
29193 <entry><option>ldap_cert_key</option></entry>
29194 <entry>Use: <emphasis>main</emphasis></entry>
29195 <entry>Type: <emphasis>string</emphasis></entry>
29196 <entry>Default: <emphasis>unset</emphasis></entry>
29197 </row>
29198 </tbody>
29199 </tgroup>
29200 </informaltable>
29201 <para>
29202 <indexterm role="concept">
29203 <primary>LDAP</primary>
29204 <secondary>TLS client key file</secondary>
29205 </indexterm>
29206 <indexterm role="concept">
29207 <primary>certificate</primary>
29208 <secondary>key for LDAP</secondary>
29209 </indexterm>
29210 This option indicates which file contains the secret/private key to use
29211 to prove identity to the LDAP server during TLS negotiation.
29212 Should be used together with <option>ldap_cert_file</option>, which contains the
29213 identity to be proven.
29214 </para>
29215 <para>
29216 <indexterm role="option">
29217 <primary><option>ldap_cipher_suite</option></primary>
29218 </indexterm>
29219 </para>
29220 <informaltable frame="all">
29221 <tgroup cols="4" colsep="0" rowsep="0">
29222 <colspec colwidth="8*" align="left"/>
29223 <colspec colwidth="6*" align="center"/>
29224 <colspec colwidth="6*" align="center"/>
29225 <colspec colwidth="6*" align="right"/>
29226 <tbody>
29227 <row>
29228 <entry><option>ldap_cipher_suite</option></entry>
29229 <entry>Use: <emphasis>main</emphasis></entry>
29230 <entry>Type: <emphasis>string</emphasis></entry>
29231 <entry>Default: <emphasis>unset</emphasis></entry>
29232 </row>
29233 </tbody>
29234 </tgroup>
29235 </informaltable>
29236 <para>
29237 <indexterm role="concept">
29238 <primary>LDAP</primary>
29239 <secondary>TLS cipher suite</secondary>
29240 </indexterm>
29241 This controls the TLS cipher-suite negotiation during TLS negotiation with
29242 the LDAP server.  See <xref linkend="SECTreqciphssl"/> for more details of the format of
29243 cipher-suite options with OpenSSL (as used by LDAP client libraries).
29244 </para>
29245 <para>
29246 <indexterm role="option">
29247 <primary><option>ldap_default_servers</option></primary>
29248 </indexterm>
29249 </para>
29250 <informaltable frame="all">
29251 <tgroup cols="4" colsep="0" rowsep="0">
29252 <colspec colwidth="8*" align="left"/>
29253 <colspec colwidth="6*" align="center"/>
29254 <colspec colwidth="6*" align="center"/>
29255 <colspec colwidth="6*" align="right"/>
29256 <tbody>
29257 <row>
29258 <entry><option>ldap_default_servers</option></entry>
29259 <entry>Use: <emphasis>main</emphasis></entry>
29260 <entry>Type: <emphasis>string list</emphasis></entry>
29261 <entry>Default: <emphasis>unset</emphasis></entry>
29262 </row>
29263 </tbody>
29264 </tgroup>
29265 </informaltable>
29266 <para>
29267 <indexterm role="concept">
29268 <primary>LDAP</primary>
29269 <secondary>default servers</secondary>
29270 </indexterm>
29271 This option provides a list of LDAP servers which are tried in turn when an
29272 LDAP query does not contain a server. See section <xref linkend="SECTforldaque"/> for
29273 details of LDAP queries. This option is available only when Exim has been built
29274 with LDAP support.
29275 </para>
29276 <para>
29277 <indexterm role="option">
29278 <primary><option>ldap_require_cert</option></primary>
29279 </indexterm>
29280 </para>
29281 <informaltable frame="all">
29282 <tgroup cols="4" colsep="0" rowsep="0">
29283 <colspec colwidth="8*" align="left"/>
29284 <colspec colwidth="6*" align="center"/>
29285 <colspec colwidth="6*" align="center"/>
29286 <colspec colwidth="6*" align="right"/>
29287 <tbody>
29288 <row>
29289 <entry><option>ldap_require_cert</option></entry>
29290 <entry>Use: <emphasis>main</emphasis></entry>
29291 <entry>Type: <emphasis>string</emphasis></entry>
29292 <entry>Default: <emphasis>unset.</emphasis></entry>
29293 </row>
29294 </tbody>
29295 </tgroup>
29296 </informaltable>
29297 <para>
29298 <indexterm role="concept">
29299 <primary>LDAP</primary>
29300 <secondary>policy for LDAP server TLS cert presentation</secondary>
29301 </indexterm>
29302 This should be one of the values "hard", "demand", "allow", "try" or "never".
29303 A value other than one of these is interpreted as "never".
29304 See the entry "TLS_REQCERT" in your system man page for ldap.conf(5).
29305 Although Exim does not set a default, the LDAP library probably defaults
29306 to hard/demand.
29307 </para>
29308 <para>
29309 <indexterm role="option">
29310 <primary><option>ldap_start_tls</option></primary>
29311 </indexterm>
29312 </para>
29313 <informaltable frame="all">
29314 <tgroup cols="4" colsep="0" rowsep="0">
29315 <colspec colwidth="8*" align="left"/>
29316 <colspec colwidth="6*" align="center"/>
29317 <colspec colwidth="6*" align="center"/>
29318 <colspec colwidth="6*" align="right"/>
29319 <tbody>
29320 <row>
29321 <entry><option>ldap_start_tls</option></entry>
29322 <entry>Use: <emphasis>main</emphasis></entry>
29323 <entry>Type: <emphasis>boolean</emphasis></entry>
29324 <entry>Default: <emphasis>false</emphasis></entry>
29325 </row>
29326 </tbody>
29327 </tgroup>
29328 </informaltable>
29329 <para>
29330 <indexterm role="concept">
29331 <primary>LDAP</primary>
29332 <secondary>whether or not to negotiate TLS</secondary>
29333 </indexterm>
29334 If set, Exim will attempt to negotiate TLS with the LDAP server when
29335 connecting on a regular LDAP port.  This is the LDAP equivalent of SMTP&#x2019;s
29336 "STARTTLS".  This is distinct from using "ldaps", which is the LDAP form
29337 of SSL-on-connect.
29338 In the event of failure to negotiate TLS, the action taken is controlled
29339 by <option>ldap_require_cert</option>.
29340 This option is ignored for <literal>ldapi</literal> connections.
29341 </para>
29342 <para>
29343 <indexterm role="option">
29344 <primary><option>ldap_version</option></primary>
29345 </indexterm>
29346 </para>
29347 <informaltable frame="all">
29348 <tgroup cols="4" colsep="0" rowsep="0">
29349 <colspec colwidth="8*" align="left"/>
29350 <colspec colwidth="6*" align="center"/>
29351 <colspec colwidth="6*" align="center"/>
29352 <colspec colwidth="6*" align="right"/>
29353 <tbody>
29354 <row>
29355 <entry><option>ldap_version</option></entry>
29356 <entry>Use: <emphasis>main</emphasis></entry>
29357 <entry>Type: <emphasis>integer</emphasis></entry>
29358 <entry>Default: <emphasis>unset</emphasis></entry>
29359 </row>
29360 </tbody>
29361 </tgroup>
29362 </informaltable>
29363 <para>
29364 <indexterm role="concept">
29365 <primary>LDAP</primary>
29366 <secondary>protocol version, forcing</secondary>
29367 </indexterm>
29368 This option can be used to force Exim to set a specific protocol version for
29369 LDAP. If it option is unset, it is shown by the <option>-bP</option> command line option as
29370 -1. When this is the case, the default is 3 if LDAP_VERSION3 is defined in
29371 the LDAP headers; otherwise it is 2. This option is available only when Exim
29372 has been built with LDAP support.
29373 </para>
29374 <para>
29375 <indexterm role="option">
29376 <primary><option>local_from_check</option></primary>
29377 </indexterm>
29378 </para>
29379 <informaltable frame="all">
29380 <tgroup cols="4" colsep="0" rowsep="0">
29381 <colspec colwidth="8*" align="left"/>
29382 <colspec colwidth="6*" align="center"/>
29383 <colspec colwidth="6*" align="center"/>
29384 <colspec colwidth="6*" align="right"/>
29385 <tbody>
29386 <row>
29387 <entry><option>local_from_check</option></entry>
29388 <entry>Use: <emphasis>main</emphasis></entry>
29389 <entry>Type: <emphasis>boolean</emphasis></entry>
29390 <entry>Default: <emphasis>true</emphasis></entry>
29391 </row>
29392 </tbody>
29393 </tgroup>
29394 </informaltable>
29395 <para>
29396 <indexterm role="concept">
29397 <primary><emphasis>Sender:</emphasis> header line</primary>
29398 <secondary>disabling addition of</secondary>
29399 </indexterm>
29400 <indexterm role="concept">
29401 <primary><emphasis>From:</emphasis> header line</primary>
29402 <secondary>disabling checking of</secondary>
29403 </indexterm>
29404 When a message is submitted locally (that is, not over a TCP/IP connection) by
29405 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line, and
29406 checks that the <emphasis>From:</emphasis> header line matches the login of the calling user and
29407 the domain specified by <option>qualify_domain</option>.
29408 </para>
29409 <para>
29410 <emphasis role="bold">Note</emphasis>: An unqualified address (no domain) in the <emphasis>From:</emphasis> header in a
29411 locally submitted message is automatically qualified by Exim, unless the
29412 <option>-bnq</option> command line option is used.
29413 </para>
29414 <para>
29415 You can use <option>local_from_prefix</option> and <option>local_from_suffix</option> to permit affixes
29416 on the local part. If the <emphasis>From:</emphasis> header line does not match, Exim adds a
29417 <emphasis>Sender:</emphasis> header with an address constructed from the calling user&#x2019;s login
29418 and the default qualify domain.
29419 </para>
29420 <para>
29421 If <option>local_from_check</option> is set false, the <emphasis>From:</emphasis> header check is disabled,
29422 and no <emphasis>Sender:</emphasis> header is ever added. If, in addition, you want to retain
29423 <emphasis>Sender:</emphasis> header lines supplied by untrusted users, you must also set
29424 <option>local_sender_retain</option> to be true.
29425 </para>
29426 <para>
29427 <indexterm role="concept">
29428 <primary>envelope from</primary>
29429 </indexterm>
29430 <indexterm role="concept">
29431 <primary>envelope sender</primary>
29432 </indexterm>
29433 These options affect only the header lines in the message. The envelope sender
29434 is still forced to be the login id at the qualify domain unless
29435 <option>untrusted_set_sender</option> permits the user to supply an envelope sender.
29436 </para>
29437 <para>
29438 For messages received over TCP/IP, an ACL can specify <quote>submission mode</quote> to
29439 request similar header line checking. See section <xref linkend="SECTthesenhea"/>, which
29440 has more details about <emphasis>Sender:</emphasis> processing.
29441 </para>
29442 <para>
29443 <indexterm role="option">
29444 <primary><option>local_from_prefix</option></primary>
29445 </indexterm>
29446 </para>
29447 <informaltable frame="all">
29448 <tgroup cols="4" colsep="0" rowsep="0">
29449 <colspec colwidth="8*" align="left"/>
29450 <colspec colwidth="6*" align="center"/>
29451 <colspec colwidth="6*" align="center"/>
29452 <colspec colwidth="6*" align="right"/>
29453 <tbody>
29454 <row>
29455 <entry><option>local_from_prefix</option></entry>
29456 <entry>Use: <emphasis>main</emphasis></entry>
29457 <entry>Type: <emphasis>string</emphasis></entry>
29458 <entry>Default: <emphasis>unset</emphasis></entry>
29459 </row>
29460 </tbody>
29461 </tgroup>
29462 </informaltable>
29463 <para>
29464 When Exim checks the <emphasis>From:</emphasis> header line of locally submitted messages for
29465 matching the login id (see <option>local_from_check</option> above), it can be configured to
29466 ignore certain prefixes and suffixes in the local part of the address. This is
29467 done by setting <option>local_from_prefix</option> and/or <option>local_from_suffix</option> to
29468 appropriate lists, in the same form as the <option>local_part_prefix</option> and
29469 <option>local_part_suffix</option> router options (see chapter <xref linkend="CHAProutergeneric"/>). For
29470 example, if
29471 </para>
29472 <literallayout class="monospaced">
29473 local_from_prefix = *-
29474 </literallayout>
29475 <para>
29476 is set, a <emphasis>From:</emphasis> line containing
29477 </para>
29478 <literallayout class="monospaced">
29479 From: anything-user@your.domain.example
29480 </literallayout>
29481 <para>
29482 will not cause a <emphasis>Sender:</emphasis> header to be added if <emphasis>user@your.domain.example</emphasis>
29483 matches the actual sender address that is constructed from the login name and
29484 qualify domain.
29485 </para>
29486 <para>
29487 <indexterm role="option">
29488 <primary><option>local_from_suffix</option></primary>
29489 </indexterm>
29490 </para>
29491 <informaltable frame="all">
29492 <tgroup cols="4" colsep="0" rowsep="0">
29493 <colspec colwidth="8*" align="left"/>
29494 <colspec colwidth="6*" align="center"/>
29495 <colspec colwidth="6*" align="center"/>
29496 <colspec colwidth="6*" align="right"/>
29497 <tbody>
29498 <row>
29499 <entry><option>local_from_suffix</option></entry>
29500 <entry>Use: <emphasis>main</emphasis></entry>
29501 <entry>Type: <emphasis>string</emphasis></entry>
29502 <entry>Default: <emphasis>unset</emphasis></entry>
29503 </row>
29504 </tbody>
29505 </tgroup>
29506 </informaltable>
29507 <para>
29508 See <option>local_from_prefix</option> above.
29509 </para>
29510 <para>
29511 <indexterm role="option">
29512 <primary><option>local_interfaces</option></primary>
29513 </indexterm>
29514 </para>
29515 <informaltable frame="all">
29516 <tgroup cols="4" colsep="0" rowsep="0">
29517 <colspec colwidth="8*" align="left"/>
29518 <colspec colwidth="6*" align="center"/>
29519 <colspec colwidth="6*" align="center"/>
29520 <colspec colwidth="6*" align="right"/>
29521 <tbody>
29522 <row>
29523 <entry><option>local_interfaces</option></entry>
29524 <entry>Use: <emphasis>main</emphasis></entry>
29525 <entry>Type: <emphasis>string list</emphasis></entry>
29526 <entry>Default: <emphasis>see below</emphasis></entry>
29527 </row>
29528 </tbody>
29529 </tgroup>
29530 </informaltable>
29531 <para>
29532 This option controls which network interfaces are used by the daemon for
29533 listening; they are also used to identify the local host when routing. Chapter
29534 <xref linkend="CHAPinterfaces"/> contains a full description of this option and the related
29535 options <option>daemon_smtp_ports</option>, <option>extra_local_interfaces</option>,
29536 <option>hosts_treat_as_local</option>, and <option>tls_on_connect_ports</option>. The default value for
29537 <option>local_interfaces</option> is
29538 </para>
29539 <literallayout class="monospaced">
29540 local_interfaces = 0.0.0.0
29541 </literallayout>
29542 <para>
29543 when Exim is built without IPv6 support; otherwise it is
29544 </para>
29545 <literallayout class="monospaced">
29546 local_interfaces = &lt;; ::0 ; 0.0.0.0
29547 </literallayout>
29548 <para>
29549 <indexterm role="option">
29550 <primary><option>local_scan_timeout</option></primary>
29551 </indexterm>
29552 </para>
29553 <informaltable frame="all">
29554 <tgroup cols="4" colsep="0" rowsep="0">
29555 <colspec colwidth="8*" align="left"/>
29556 <colspec colwidth="6*" align="center"/>
29557 <colspec colwidth="6*" align="center"/>
29558 <colspec colwidth="6*" align="right"/>
29559 <tbody>
29560 <row>
29561 <entry><option>local_scan_timeout</option></entry>
29562 <entry>Use: <emphasis>main</emphasis></entry>
29563 <entry>Type: <emphasis>time</emphasis></entry>
29564 <entry>Default: <emphasis>5m</emphasis></entry>
29565 </row>
29566 </tbody>
29567 </tgroup>
29568 </informaltable>
29569 <para>
29570 <indexterm role="concept">
29571 <primary>timeout</primary>
29572 <secondary>for <function>local_scan()</function> function</secondary>
29573 </indexterm>
29574 <indexterm role="concept">
29575 <primary><function>local_scan()</function> function</primary>
29576 <secondary>timeout</secondary>
29577 </indexterm>
29578 This timeout applies to the <function>local_scan()</function> function (see chapter
29579 <xref linkend="CHAPlocalscan"/>). Zero means <quote>no timeout</quote>. If the timeout is exceeded,
29580 the incoming message is rejected with a temporary error if it is an SMTP
29581 message. For a non-SMTP message, the message is dropped and Exim ends with a
29582 non-zero code. The incident is logged on the main and reject logs.
29583 </para>
29584 <para>
29585 <indexterm role="option">
29586 <primary><option>local_sender_retain</option></primary>
29587 </indexterm>
29588 </para>
29589 <informaltable frame="all">
29590 <tgroup cols="4" colsep="0" rowsep="0">
29591 <colspec colwidth="8*" align="left"/>
29592 <colspec colwidth="6*" align="center"/>
29593 <colspec colwidth="6*" align="center"/>
29594 <colspec colwidth="6*" align="right"/>
29595 <tbody>
29596 <row>
29597 <entry><option>local_sender_retain</option></entry>
29598 <entry>Use: <emphasis>main</emphasis></entry>
29599 <entry>Type: <emphasis>boolean</emphasis></entry>
29600 <entry>Default: <emphasis>false</emphasis></entry>
29601 </row>
29602 </tbody>
29603 </tgroup>
29604 </informaltable>
29605 <para>
29606 <indexterm role="concept">
29607 <primary><emphasis>Sender:</emphasis> header line</primary>
29608 <secondary>retaining from local submission</secondary>
29609 </indexterm>
29610 When a message is submitted locally (that is, not over a TCP/IP connection) by
29611 an untrusted user, Exim removes any existing <emphasis>Sender:</emphasis> header line. If you
29612 do not want this to happen, you must set <option>local_sender_retain</option>, and you must
29613 also set <option>local_from_check</option> to be false (Exim will complain if you do not).
29614 See also the ACL modifier <literal>control = suppress_local_fixups</literal>. Section
29615 <xref linkend="SECTthesenhea"/> has more details about <emphasis>Sender:</emphasis> processing.
29616 </para>
29617 <para>
29618 <indexterm role="option">
29619 <primary><option>localhost_number</option></primary>
29620 </indexterm>
29621 </para>
29622 <informaltable frame="all">
29623 <tgroup cols="4" colsep="0" rowsep="0">
29624 <colspec colwidth="8*" align="left"/>
29625 <colspec colwidth="6*" align="center"/>
29626 <colspec colwidth="6*" align="center"/>
29627 <colspec colwidth="6*" align="right"/>
29628 <tbody>
29629 <row>
29630 <entry><option>localhost_number</option></entry>
29631 <entry>Use: <emphasis>main</emphasis></entry>
29632 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29633 <entry>Default: <emphasis>unset</emphasis></entry>
29634 </row>
29635 </tbody>
29636 </tgroup>
29637 </informaltable>
29638 <para>
29639 <indexterm role="concept">
29640 <primary>host</primary>
29641 <secondary>locally unique number for</secondary>
29642 </indexterm>
29643 <indexterm role="concept">
29644 <primary>message ids</primary>
29645 <secondary>with multiple hosts</secondary>
29646 </indexterm>
29647 <indexterm role="variable">
29648 <primary><varname>$localhost_number</varname></primary>
29649 </indexterm>
29650 Exim&#x2019;s message ids are normally unique only within the local host. If
29651 uniqueness among a set of hosts is required, each host must set a different
29652 value for the <option>localhost_number</option> option. The string is expanded immediately
29653 after reading the configuration file (so that a number can be computed from the
29654 host name, for example) and the result of the expansion must be a number in the
29655 range 0&ndash;16 (or 0&ndash;10 on operating systems with case-insensitive file
29656 systems). This is available in subsequent string expansions via the variable
29657 <varname>$localhost_number</varname>. When <option>localhost_number is set</option>, the final two
29658 characters of the message id, instead of just being a fractional part of the
29659 time, are computed from the time and the local host number as described in
29660 section <xref linkend="SECTmessiden"/>.
29661 </para>
29662 <para>
29663 <indexterm role="option">
29664 <primary><option>log_file_path</option></primary>
29665 </indexterm>
29666 </para>
29667 <informaltable frame="all">
29668 <tgroup cols="4" colsep="0" rowsep="0">
29669 <colspec colwidth="8*" align="left"/>
29670 <colspec colwidth="6*" align="center"/>
29671 <colspec colwidth="6*" align="center"/>
29672 <colspec colwidth="6*" align="right"/>
29673 <tbody>
29674 <row>
29675 <entry><option>log_file_path</option></entry>
29676 <entry>Use: <emphasis>main</emphasis></entry>
29677 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
29678 <entry>Default: <emphasis>set at compile time</emphasis></entry>
29679 </row>
29680 </tbody>
29681 </tgroup>
29682 </informaltable>
29683 <para>
29684 <indexterm role="concept">
29685 <primary>log</primary>
29686 <secondary>file path for</secondary>
29687 </indexterm>
29688 This option sets the path which is used to determine the names of Exim&#x2019;s log
29689 files, or indicates that logging is to be to syslog, or both. It is expanded
29690 when Exim is entered, so it can, for example, contain a reference to the host
29691 name. If no specific path is set for the log files at compile or runtime,
29692 or if the option is unset at runtime (i.e.  <literal>log_file_path = </literal>)
29693 they are written in a sub-directory called <filename>log</filename> in Exim&#x2019;s spool directory.
29694 A path must start with a slash.
29695 To send to syslog, use the word <quote>syslog</quote>.
29696 Chapter <xref linkend="CHAPlog"/> contains further details about Exim&#x2019;s logging, and
29697 section <xref linkend="SECTwhelogwri"/> describes how the contents of <option>log_file_path</option> are
29698 used. If this string is fixed at your installation (contains no expansion
29699 variables) it is recommended that you do not set this option in the
29700 configuration file, but instead supply the path using LOG_FILE_PATH in
29701 <filename>Local/Makefile</filename> so that it is available to Exim for logging errors detected
29702 early on &ndash; in particular, failure to read the configuration file.
29703 </para>
29704 <para>
29705 <indexterm role="option">
29706 <primary><option>log_selector</option></primary>
29707 </indexterm>
29708 </para>
29709 <informaltable frame="all">
29710 <tgroup cols="4" colsep="0" rowsep="0">
29711 <colspec colwidth="8*" align="left"/>
29712 <colspec colwidth="6*" align="center"/>
29713 <colspec colwidth="6*" align="center"/>
29714 <colspec colwidth="6*" align="right"/>
29715 <tbody>
29716 <row>
29717 <entry><option>log_selector</option></entry>
29718 <entry>Use: <emphasis>main</emphasis></entry>
29719 <entry>Type: <emphasis>string</emphasis></entry>
29720 <entry>Default: <emphasis>unset</emphasis></entry>
29721 </row>
29722 </tbody>
29723 </tgroup>
29724 </informaltable>
29725 <para>
29726 <indexterm role="concept">
29727 <primary>log</primary>
29728 <secondary>selectors</secondary>
29729 </indexterm>
29730 This option can be used to reduce or increase the number of things that Exim
29731 writes to its log files. Its argument is made up of names preceded by plus or
29732 minus characters. For example:
29733 </para>
29734 <literallayout class="monospaced">
29735 log_selector = +arguments -retry_defer
29736 </literallayout>
29737 <para>
29738 A list of possible names and what they control is given in the chapter on
29739 logging, in section <xref linkend="SECTlogselector"/>.
29740 </para>
29741 <para>
29742 <indexterm role="option">
29743 <primary><option>log_timezone</option></primary>
29744 </indexterm>
29745 </para>
29746 <informaltable frame="all">
29747 <tgroup cols="4" colsep="0" rowsep="0">
29748 <colspec colwidth="8*" align="left"/>
29749 <colspec colwidth="6*" align="center"/>
29750 <colspec colwidth="6*" align="center"/>
29751 <colspec colwidth="6*" align="right"/>
29752 <tbody>
29753 <row>
29754 <entry><option>log_timezone</option></entry>
29755 <entry>Use: <emphasis>main</emphasis></entry>
29756 <entry>Type: <emphasis>boolean</emphasis></entry>
29757 <entry>Default: <emphasis>false</emphasis></entry>
29758 </row>
29759 </tbody>
29760 </tgroup>
29761 </informaltable>
29762 <para>
29763 <indexterm role="concept">
29764 <primary>log</primary>
29765 <secondary>timezone for entries</secondary>
29766 </indexterm>
29767 <indexterm role="variable">
29768 <primary><varname>$tod_log</varname></primary>
29769 </indexterm>
29770 <indexterm role="variable">
29771 <primary><varname>$tod_zone</varname></primary>
29772 </indexterm>
29773 By default, the timestamps on log lines are in local time without the
29774 timezone. This means that if your timezone changes twice a year, the timestamps
29775 in log lines are ambiguous for an hour when the clocks go back. One way of
29776 avoiding this problem is to set the timezone to UTC. An alternative is to set
29777 <option>log_timezone</option> true. This turns on the addition of the timezone offset to
29778 timestamps in log lines. Turning on this option can add quite a lot to the size
29779 of log files because each line is extended by 6 characters. Note that the
29780 <varname>$tod_log</varname> variable contains the log timestamp without the zone, but there is
29781 another variable called <varname>$tod_zone</varname> that contains just the timezone offset.
29782 </para>
29783 <para>
29784 <indexterm role="option">
29785 <primary><option>lookup_open_max</option></primary>
29786 </indexterm>
29787 </para>
29788 <informaltable frame="all">
29789 <tgroup cols="4" colsep="0" rowsep="0">
29790 <colspec colwidth="8*" align="left"/>
29791 <colspec colwidth="6*" align="center"/>
29792 <colspec colwidth="6*" align="center"/>
29793 <colspec colwidth="6*" align="right"/>
29794 <tbody>
29795 <row>
29796 <entry><option>lookup_open_max</option></entry>
29797 <entry>Use: <emphasis>main</emphasis></entry>
29798 <entry>Type: <emphasis>integer</emphasis></entry>
29799 <entry>Default: <emphasis>25</emphasis></entry>
29800 </row>
29801 </tbody>
29802 </tgroup>
29803 </informaltable>
29804 <para>
29805 <indexterm role="concept">
29806 <primary>too many open files</primary>
29807 </indexterm>
29808 <indexterm role="concept">
29809 <primary>open files, too many</primary>
29810 </indexterm>
29811 <indexterm role="concept">
29812 <primary>file</primary>
29813 <secondary>too many open</secondary>
29814 </indexterm>
29815 <indexterm role="concept">
29816 <primary>lookup</primary>
29817 <secondary>maximum open files</secondary>
29818 </indexterm>
29819 <indexterm role="concept">
29820 <primary>limit</primary>
29821 <secondary>open files for lookups</secondary>
29822 </indexterm>
29823 This option limits the number of simultaneously open files for single-key
29824 lookups that use regular files (that is, <command>lsearch</command>, <command>dbm</command>, and <command>cdb</command>).
29825 Exim normally keeps these files open during routing, because often the same
29826 file is required several times. If the limit is reached, Exim closes the least
29827 recently used file. Note that if you are using the <emphasis>ndbm</emphasis> library, it
29828 actually opens two files for each logical DBM database, though it still counts
29829 as one for the purposes of <option>lookup_open_max</option>. If you are getting <quote>too many
29830 open files</quote> errors with NDBM, you need to reduce the value of
29831 <option>lookup_open_max</option>.
29832 </para>
29833 <para>
29834 <indexterm role="option">
29835 <primary><option>max_username_length</option></primary>
29836 </indexterm>
29837 </para>
29838 <informaltable frame="all">
29839 <tgroup cols="4" colsep="0" rowsep="0">
29840 <colspec colwidth="8*" align="left"/>
29841 <colspec colwidth="6*" align="center"/>
29842 <colspec colwidth="6*" align="center"/>
29843 <colspec colwidth="6*" align="right"/>
29844 <tbody>
29845 <row>
29846 <entry><option>max_username_length</option></entry>
29847 <entry>Use: <emphasis>main</emphasis></entry>
29848 <entry>Type: <emphasis>integer</emphasis></entry>
29849 <entry>Default: <emphasis>0</emphasis></entry>
29850 </row>
29851 </tbody>
29852 </tgroup>
29853 </informaltable>
29854 <para>
29855 <indexterm role="concept">
29856 <primary>length of login name</primary>
29857 </indexterm>
29858 <indexterm role="concept">
29859 <primary>user name</primary>
29860 <secondary>maximum length</secondary>
29861 </indexterm>
29862 <indexterm role="concept">
29863 <primary>limit</primary>
29864 <secondary>user name length</secondary>
29865 </indexterm>
29866 Some operating systems are broken in that they truncate long arguments to
29867 <function>getpwnam()</function> to eight characters, instead of returning <quote>no such user</quote>. If
29868 this option is set greater than zero, any attempt to call <function>getpwnam()</function> with
29869 an argument that is longer behaves as if <function>getpwnam()</function> failed.
29870 </para>
29871 <para>
29872 <indexterm role="option">
29873 <primary><option>message_body_newlines</option></primary>
29874 </indexterm>
29875 </para>
29876 <informaltable frame="all">
29877 <tgroup cols="4" colsep="0" rowsep="0">
29878 <colspec colwidth="8*" align="left"/>
29879 <colspec colwidth="6*" align="center"/>
29880 <colspec colwidth="6*" align="center"/>
29881 <colspec colwidth="6*" align="right"/>
29882 <tbody>
29883 <row>
29884 <entry><option>message_body_newlines</option></entry>
29885 <entry>Use: <emphasis>main</emphasis></entry>
29886 <entry>Type: <emphasis>bool</emphasis></entry>
29887 <entry>Default: <emphasis>false</emphasis></entry>
29888 </row>
29889 </tbody>
29890 </tgroup>
29891 </informaltable>
29892 <para>
29893 <indexterm role="concept">
29894 <primary>message body</primary>
29895 <secondary>newlines in variables</secondary>
29896 </indexterm>
29897 <indexterm role="concept">
29898 <primary>newline</primary>
29899 <secondary>in message body variables</secondary>
29900 </indexterm>
29901 <indexterm role="variable">
29902 <primary><varname>$message_body</varname></primary>
29903 </indexterm>
29904 <indexterm role="variable">
29905 <primary><varname>$message_body_end</varname></primary>
29906 </indexterm>
29907 By default, newlines in the message body are replaced by spaces when setting
29908 the <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables. If this
29909 option is set true, this no longer happens.
29910 </para>
29911 <para>
29912 <indexterm role="option">
29913 <primary><option>message_body_visible</option></primary>
29914 </indexterm>
29915 </para>
29916 <informaltable frame="all">
29917 <tgroup cols="4" colsep="0" rowsep="0">
29918 <colspec colwidth="8*" align="left"/>
29919 <colspec colwidth="6*" align="center"/>
29920 <colspec colwidth="6*" align="center"/>
29921 <colspec colwidth="6*" align="right"/>
29922 <tbody>
29923 <row>
29924 <entry><option>message_body_visible</option></entry>
29925 <entry>Use: <emphasis>main</emphasis></entry>
29926 <entry>Type: <emphasis>integer</emphasis></entry>
29927 <entry>Default: <emphasis>500</emphasis></entry>
29928 </row>
29929 </tbody>
29930 </tgroup>
29931 </informaltable>
29932 <para>
29933 <indexterm role="concept">
29934 <primary>body of message</primary>
29935 <secondary>visible size</secondary>
29936 </indexterm>
29937 <indexterm role="concept">
29938 <primary>message body</primary>
29939 <secondary>visible size</secondary>
29940 </indexterm>
29941 <indexterm role="variable">
29942 <primary><varname>$message_body</varname></primary>
29943 </indexterm>
29944 <indexterm role="variable">
29945 <primary><varname>$message_body_end</varname></primary>
29946 </indexterm>
29947 This option specifies how much of a message&#x2019;s body is to be included in the
29948 <varname>$message_body</varname> and <varname>$message_body_end</varname> expansion variables.
29949 </para>
29950 <para>
29951 <indexterm role="option">
29952 <primary><option>message_id_header_domain</option></primary>
29953 </indexterm>
29954 </para>
29955 <informaltable frame="all">
29956 <tgroup cols="4" colsep="0" rowsep="0">
29957 <colspec colwidth="8*" align="left"/>
29958 <colspec colwidth="6*" align="center"/>
29959 <colspec colwidth="6*" align="center"/>
29960 <colspec colwidth="6*" align="right"/>
29961 <tbody>
29962 <row>
29963 <entry><option>message_id_header_domain</option></entry>
29964 <entry>Use: <emphasis>main</emphasis></entry>
29965 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
29966 <entry>Default: <emphasis>unset</emphasis></entry>
29967 </row>
29968 </tbody>
29969 </tgroup>
29970 </informaltable>
29971 <para>
29972 <indexterm role="concept">
29973 <primary><emphasis>Message-ID:</emphasis> header line</primary>
29974 </indexterm>
29975 If this option is set, the string is expanded and used as the right hand side
29976 (domain) of the <emphasis>Message-ID:</emphasis> header that Exim creates if a
29977 locally-originated incoming message does not have one. <quote>Locally-originated</quote>
29978 means <quote>not received over TCP/IP.</quote>
29979 Otherwise, the primary host name is used.
29980 Only letters, digits, dot and hyphen are accepted; any other characters are
29981 replaced by hyphens. If the expansion is forced to fail, or if the result is an
29982 empty string, the option is ignored.
29983 </para>
29984 <para>
29985 <indexterm role="option">
29986 <primary><option>message_id_header_text</option></primary>
29987 </indexterm>
29988 </para>
29989 <informaltable frame="all">
29990 <tgroup cols="4" colsep="0" rowsep="0">
29991 <colspec colwidth="8*" align="left"/>
29992 <colspec colwidth="6*" align="center"/>
29993 <colspec colwidth="6*" align="center"/>
29994 <colspec colwidth="6*" align="right"/>
29995 <tbody>
29996 <row>
29997 <entry><option>message_id_header_text</option></entry>
29998 <entry>Use: <emphasis>main</emphasis></entry>
29999 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30000 <entry>Default: <emphasis>unset</emphasis></entry>
30001 </row>
30002 </tbody>
30003 </tgroup>
30004 </informaltable>
30005 <para>
30006 If this variable is set, the string is expanded and used to augment the text of
30007 the <emphasis>Message-id:</emphasis> header that Exim creates if a locally-originated incoming
30008 message does not have one. The text of this header is required by RFC 2822 to
30009 take the form of an address. By default, Exim uses its internal message id as
30010 the local part, and the primary host name as the domain. If this option is set,
30011 it is expanded, and provided the expansion is not forced to fail, and does not
30012 yield an empty string, the result is inserted into the header immediately
30013 before the @, separated from the internal message id by a dot. Any characters
30014 that are illegal in an address are automatically converted into hyphens. This
30015 means that variables such as <varname>$tod_log</varname> can be used, because the spaces and
30016 colons will become hyphens.
30017 </para>
30018 <para>
30019 <indexterm role="option">
30020 <primary><option>message_logs</option></primary>
30021 </indexterm>
30022 </para>
30023 <informaltable frame="all">
30024 <tgroup cols="4" colsep="0" rowsep="0">
30025 <colspec colwidth="8*" align="left"/>
30026 <colspec colwidth="6*" align="center"/>
30027 <colspec colwidth="6*" align="center"/>
30028 <colspec colwidth="6*" align="right"/>
30029 <tbody>
30030 <row>
30031 <entry><option>message_logs</option></entry>
30032 <entry>Use: <emphasis>main</emphasis></entry>
30033 <entry>Type: <emphasis>boolean</emphasis></entry>
30034 <entry>Default: <emphasis>true</emphasis></entry>
30035 </row>
30036 </tbody>
30037 </tgroup>
30038 </informaltable>
30039 <para>
30040 <indexterm role="concept">
30041 <primary>message logs</primary>
30042 <secondary>disabling</secondary>
30043 </indexterm>
30044 <indexterm role="concept">
30045 <primary>log</primary>
30046 <secondary>message log; disabling</secondary>
30047 </indexterm>
30048 If this option is turned off, per-message log files are not created in the
30049 <filename>msglog</filename> spool sub-directory. This reduces the amount of disk I/O required by
30050 Exim, by reducing the number of files involved in handling a message from a
30051 minimum of four (header spool file, body spool file, delivery journal, and
30052 per-message log) to three. The other major I/O activity is Exim&#x2019;s main log,
30053 which is not affected by this option.
30054 </para>
30055 <para>
30056 <indexterm role="option">
30057 <primary><option>message_size_limit</option></primary>
30058 </indexterm>
30059 </para>
30060 <informaltable frame="all">
30061 <tgroup cols="4" colsep="0" rowsep="0">
30062 <colspec colwidth="8*" align="left"/>
30063 <colspec colwidth="6*" align="center"/>
30064 <colspec colwidth="6*" align="center"/>
30065 <colspec colwidth="6*" align="right"/>
30066 <tbody>
30067 <row>
30068 <entry><option>message_size_limit</option></entry>
30069 <entry>Use: <emphasis>main</emphasis></entry>
30070 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30071 <entry>Default: <emphasis>50M</emphasis></entry>
30072 </row>
30073 </tbody>
30074 </tgroup>
30075 </informaltable>
30076 <para>
30077 <indexterm role="concept">
30078 <primary>message</primary>
30079 <secondary>size limit</secondary>
30080 </indexterm>
30081 <indexterm role="concept">
30082 <primary>limit</primary>
30083 <secondary>message size</secondary>
30084 </indexterm>
30085 <indexterm role="concept">
30086 <primary>size</primary>
30087 <secondary>of message, limit</secondary>
30088 </indexterm>
30089 This option limits the maximum size of message that Exim will process. The
30090 value is expanded for each incoming connection so, for example, it can be made
30091 to depend on the IP address of the remote host for messages arriving via
30092 TCP/IP. After expansion, the value must be a sequence of decimal digits,
30093 optionally followed by K or M.
30094 </para>
30095 <para>
30096 <indexterm role="concept">
30097 <primary>SIZE</primary>
30098 <secondary>ESMTP extension, advertising</secondary>
30099 </indexterm>
30100 <indexterm role="concept">
30101 <primary>ESMTP extensions</primary>
30102 <secondary>SIZE</secondary>
30103 </indexterm>
30104 If nonzero the value will be advertised as a parameter to the ESMTP SIZE
30105 service extension keyword.
30106 </para>
30107 <para>
30108 <emphasis role="bold">Note</emphasis>: This limit cannot be made to depend on a message&#x2019;s sender or any
30109 other properties of an individual message, because it has to be advertised in
30110 the server&#x2019;s response to EHLO. String expansion failure causes a temporary
30111 error. A value of zero means no limit, but its use is not recommended. See also
30112 <option>bounce_return_size_limit</option>.
30113 </para>
30114 <para>
30115 Incoming SMTP messages are failed with a 552 error if the limit is
30116 exceeded; locally-generated messages either get a stderr message or a delivery
30117 failure message to the sender, depending on the <option>-oe</option> setting. Rejection of
30118 an oversized message is logged in both the main and the reject logs. See also
30119 the generic transport option <option>message_size_limit</option>, which limits the size of
30120 message that an individual transport can process.
30121 </para>
30122 <para>
30123 If you use a virus-scanner and set this option to to a value larger than the
30124 maximum size that your virus-scanner is configured to support, you may get
30125 failures triggered by large mails.  The right size to configure for the
30126 virus-scanner depends upon what data is passed and the options in use but it&#x2019;s
30127 probably safest to just set it to a little larger than this value.  E.g., with a
30128 default Exim message size of 50M and a default ClamAV StreamMaxLength of 10M,
30129 some problems may result.
30130 </para>
30131 <para>
30132 A value of 0 will disable size limit checking; Exim will still advertise the
30133 SIZE extension in an EHLO response, but without a limit, so as to permit
30134 SMTP clients to still indicate the message size along with the MAIL verb.
30135 </para>
30136 <para>
30137 <indexterm role="option">
30138 <primary><option>move_frozen_messages</option></primary>
30139 </indexterm>
30140 </para>
30141 <informaltable frame="all">
30142 <tgroup cols="4" colsep="0" rowsep="0">
30143 <colspec colwidth="8*" align="left"/>
30144 <colspec colwidth="6*" align="center"/>
30145 <colspec colwidth="6*" align="center"/>
30146 <colspec colwidth="6*" align="right"/>
30147 <tbody>
30148 <row>
30149 <entry><option>move_frozen_messages</option></entry>
30150 <entry>Use: <emphasis>main</emphasis></entry>
30151 <entry>Type: <emphasis>boolean</emphasis></entry>
30152 <entry>Default: <emphasis>false</emphasis></entry>
30153 </row>
30154 </tbody>
30155 </tgroup>
30156 </informaltable>
30157 <para>
30158 <indexterm role="concept">
30159 <primary>frozen messages</primary>
30160 <secondary>moving</secondary>
30161 </indexterm>
30162 This option, which is available only if Exim has been built with the setting
30163 </para>
30164 <literallayout class="monospaced">
30165 SUPPORT_MOVE_FROZEN_MESSAGES=yes
30166 </literallayout>
30167 <para>
30168 in <filename>Local/Makefile</filename>, causes frozen messages and their message logs to be
30169 moved from the <filename>input</filename> and <filename>msglog</filename> directories on the spool to <filename>Finput</filename>
30170 and <filename>Fmsglog</filename>, respectively. There is currently no support in Exim or the
30171 standard utilities for handling such moved messages, and they do not show up in
30172 lists generated by <option>-bp</option> or by the Exim monitor.
30173 </para>
30174 <para>
30175 <indexterm role="option">
30176 <primary><option>mua_wrapper</option></primary>
30177 </indexterm>
30178 </para>
30179 <informaltable frame="all">
30180 <tgroup cols="4" colsep="0" rowsep="0">
30181 <colspec colwidth="8*" align="left"/>
30182 <colspec colwidth="6*" align="center"/>
30183 <colspec colwidth="6*" align="center"/>
30184 <colspec colwidth="6*" align="right"/>
30185 <tbody>
30186 <row>
30187 <entry><option>mua_wrapper</option></entry>
30188 <entry>Use: <emphasis>main</emphasis></entry>
30189 <entry>Type: <emphasis>boolean</emphasis></entry>
30190 <entry>Default: <emphasis>false</emphasis></entry>
30191 </row>
30192 </tbody>
30193 </tgroup>
30194 </informaltable>
30195 <para>
30196 Setting this option true causes Exim to run in a very restrictive mode in which
30197 it passes messages synchronously to a smart host. Chapter <xref linkend="CHAPnonqueueing"/>
30198 contains a full description of this facility.
30199 </para>
30200 <para>
30201 <indexterm role="option">
30202 <primary><option>mysql_servers</option></primary>
30203 </indexterm>
30204 </para>
30205 <informaltable frame="all">
30206 <tgroup cols="4" colsep="0" rowsep="0">
30207 <colspec colwidth="8*" align="left"/>
30208 <colspec colwidth="6*" align="center"/>
30209 <colspec colwidth="6*" align="center"/>
30210 <colspec colwidth="6*" align="right"/>
30211 <tbody>
30212 <row>
30213 <entry><option>mysql_servers</option></entry>
30214 <entry>Use: <emphasis>main</emphasis></entry>
30215 <entry>Type: <emphasis>string list</emphasis></entry>
30216 <entry>Default: <emphasis>unset</emphasis></entry>
30217 </row>
30218 </tbody>
30219 </tgroup>
30220 </informaltable>
30221 <para>
30222 <indexterm role="concept">
30223 <primary>MySQL</primary>
30224 <secondary>server list</secondary>
30225 </indexterm>
30226 This option provides a list of MySQL servers and associated connection data, to
30227 be used in conjunction with <command>mysql</command> lookups (see section <xref linkend="SECID72"/>). The
30228 option is available only if Exim has been built with MySQL support.
30229 </para>
30230 <para>
30231 <indexterm role="option">
30232 <primary><option>never_users</option></primary>
30233 </indexterm>
30234 </para>
30235 <informaltable frame="all">
30236 <tgroup cols="4" colsep="0" rowsep="0">
30237 <colspec colwidth="8*" align="left"/>
30238 <colspec colwidth="6*" align="center"/>
30239 <colspec colwidth="6*" align="center"/>
30240 <colspec colwidth="6*" align="right"/>
30241 <tbody>
30242 <row>
30243 <entry><option>never_users</option></entry>
30244 <entry>Use: <emphasis>main</emphasis></entry>
30245 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
30246 <entry>Default: <emphasis>unset</emphasis></entry>
30247 </row>
30248 </tbody>
30249 </tgroup>
30250 </informaltable>
30251 <para>
30252 This option is expanded just once, at the start of Exim&#x2019;s processing. Local
30253 message deliveries are normally run in processes that are setuid to the
30254 recipient, and remote deliveries are normally run under Exim&#x2019;s own uid and gid.
30255 It is usually desirable to prevent any deliveries from running as root, as a
30256 safety precaution.
30257 </para>
30258 <para>
30259 When Exim is built, an option called FIXED_NEVER_USERS can be set to a
30260 list of users that must not be used for local deliveries. This list is fixed in
30261 the binary and cannot be overridden by the configuration file. By default, it
30262 contains just the single user name <quote>root</quote>. The <option>never_users</option> runtime option
30263 can be used to add more users to the fixed list.
30264 </para>
30265 <para>
30266 If a message is to be delivered as one of the users on the fixed list or the
30267 <option>never_users</option> list, an error occurs, and delivery is deferred. A common
30268 example is
30269 </para>
30270 <literallayout class="monospaced">
30271 never_users = root:daemon:bin
30272 </literallayout>
30273 <para>
30274 Including root is redundant if it is also on the fixed list, but it does no
30275 harm. This option overrides the <option>pipe_as_creator</option> option of the <command>pipe</command>
30276 transport driver.
30277 </para>
30278 <para>
30279 <indexterm role="option">
30280 <primary><option>notifier_socket</option></primary>
30281 </indexterm>
30282 </para>
30283 <informaltable frame="all">
30284 <tgroup cols="4" colsep="0" rowsep="0">
30285 <colspec colwidth="8*" align="left"/>
30286 <colspec colwidth="6*" align="center"/>
30287 <colspec colwidth="6*" align="center"/>
30288 <colspec colwidth="6*" align="right"/>
30289 <tbody>
30290 <row>
30291 <entry><option>notifier_socket</option></entry>
30292 <entry>Use: <emphasis>main</emphasis></entry>
30293 <entry>Type: <emphasis>string</emphasis></entry>
30294 <entry>Default: <emphasis>$spool_directory/exim_daemon_notify</emphasis></entry>
30295 </row>
30296 </tbody>
30297 </tgroup>
30298 </informaltable>
30299 <para>
30300 This option gives the name for a unix-domain socket on which the daemon
30301 listens for work and information-requests.
30302 Only installations running multiple daemons sharing a spool directory
30303 should need to modify the default.
30304 </para>
30305 <para>
30306 The option is expanded before use.
30307 If the platform supports Linux-style abstract socket names, the result
30308 is used with a nul byte prefixed.
30309 Otherwise,
30310 it should be a full path name and use a directory accessible
30311 to Exim.
30312 </para>
30313 <para>
30314 If this option is set as empty,
30315 or the command line <option>-oY</option> option is used, or
30316 the command line uses a <option>-oX</option> option and does not use <option>-oP</option>,
30317 then a notifier socket is not created.
30318 </para>
30319 <para>
30320 <indexterm role="option">
30321 <primary><option>openssl_options</option></primary>
30322 </indexterm>
30323 </para>
30324 <informaltable frame="all">
30325 <tgroup cols="4" colsep="0" rowsep="0">
30326 <colspec colwidth="8*" align="left"/>
30327 <colspec colwidth="6*" align="center"/>
30328 <colspec colwidth="6*" align="center"/>
30329 <colspec colwidth="6*" align="right"/>
30330 <tbody>
30331 <row>
30332 <entry><option>openssl_options</option></entry>
30333 <entry>Use: <emphasis>main</emphasis></entry>
30334 <entry>Type: <emphasis>string list</emphasis></entry>
30335 <entry>Default: <emphasis>+no_sslv2 +no_sslv3 +single_dh_use +no_ticket +no_renegotiation</emphasis></entry>
30336 </row>
30337 </tbody>
30338 </tgroup>
30339 </informaltable>
30340 <para>
30341 <indexterm role="concept">
30342 <primary>OpenSSL </primary>
30343 <secondary>compatibility</secondary>
30344 </indexterm>
30345 This option allows an administrator to adjust the SSL options applied
30346 by OpenSSL to connections.  It is given as a space-separated list of items,
30347 each one to be +added or -subtracted from the current value.
30348 </para>
30349 <para>
30350 This option is only available if Exim is built against OpenSSL.  The values
30351 available for this option vary according to the age of your OpenSSL install.
30352 The <quote>all</quote> value controls a subset of flags which are available, typically
30353 the bug workaround options.  The <emphasis>SSL_CTX_set_options</emphasis> man page will
30354 list the values known on your system and Exim should support all the
30355 <quote>bug workaround</quote> options and many of the <quote>modifying</quote> options.  The Exim
30356 names lose the leading <quote>SSL_OP_</quote> and are lower-cased.
30357 </para>
30358 <para>
30359 Note that adjusting the options can have severe impact upon the security of
30360 SSL as used by Exim.  It is possible to disable safety checks and shoot
30361 yourself in the foot in various unpleasant ways.  This option should not be
30362 adjusted lightly.  An unrecognised item will be detected at startup, by
30363 invoking Exim with the <option>-bV</option> flag.
30364 </para>
30365 <para>
30366 The option affects Exim operating both as a server and as a client.
30367 </para>
30368 <para>
30369 Historical note: prior to release 4.80, Exim defaulted this value to
30370 "+dont_insert_empty_fragments", which may still be needed for compatibility
30371 with some clients, but which lowers security by increasing exposure to
30372 some now infamous attacks.
30373 </para>
30374 <para>
30375 Examples:
30376 </para>
30377 <literallayout class="monospaced">
30378 # Make both old MS and old Eudora happy:
30379 openssl_options = -all +microsoft_big_sslv3_buffer \
30380                        +dont_insert_empty_fragments
30381
30382 # Disable older protocol versions:
30383 openssl_options = +no_sslv2 +no_sslv3
30384 </literallayout>
30385 <para>
30386 Possible options may include:
30387 </para>
30388 <itemizedlist>
30389 <listitem>
30390 <para>
30391 <literal>all</literal>
30392 </para>
30393 </listitem>
30394 <listitem>
30395 <para>
30396 <literal>allow_unsafe_legacy_renegotiation</literal>
30397 </para>
30398 </listitem>
30399 <listitem>
30400 <para>
30401 <literal>cipher_server_preference</literal>
30402 </para>
30403 </listitem>
30404 <listitem>
30405 <para>
30406 <literal>dont_insert_empty_fragments</literal>
30407 </para>
30408 </listitem>
30409 <listitem>
30410 <para>
30411 <literal>ephemeral_rsa</literal>
30412 </para>
30413 </listitem>
30414 <listitem>
30415 <para>
30416 <literal>legacy_server_connect</literal>
30417 </para>
30418 </listitem>
30419 <listitem>
30420 <para>
30421 <literal>microsoft_big_sslv3_buffer</literal>
30422 </para>
30423 </listitem>
30424 <listitem>
30425 <para>
30426 <literal>microsoft_sess_id_bug</literal>
30427 </para>
30428 </listitem>
30429 <listitem>
30430 <para>
30431 <literal>msie_sslv2_rsa_padding</literal>
30432 </para>
30433 </listitem>
30434 <listitem>
30435 <para>
30436 <literal>netscape_challenge_bug</literal>
30437 </para>
30438 </listitem>
30439 <listitem>
30440 <para>
30441 <literal>netscape_reuse_cipher_change_bug</literal>
30442 </para>
30443 </listitem>
30444 <listitem>
30445 <para>
30446 <literal>no_compression</literal>
30447 </para>
30448 </listitem>
30449 <listitem>
30450 <para>
30451 <literal>no_session_resumption_on_renegotiation</literal>
30452 </para>
30453 </listitem>
30454 <listitem>
30455 <para>
30456 <literal>no_sslv2</literal>
30457 </para>
30458 </listitem>
30459 <listitem>
30460 <para>
30461 <literal>no_sslv3</literal>
30462 </para>
30463 </listitem>
30464 <listitem>
30465 <para>
30466 <literal>no_ticket</literal>
30467 </para>
30468 </listitem>
30469 <listitem>
30470 <para>
30471 <literal>no_tlsv1</literal>
30472 </para>
30473 </listitem>
30474 <listitem>
30475 <para>
30476 <literal>no_tlsv1_1</literal>
30477 </para>
30478 </listitem>
30479 <listitem>
30480 <para>
30481 <literal>no_tlsv1_2</literal>
30482 </para>
30483 </listitem>
30484 <listitem>
30485 <para>
30486 <literal>safari_ecdhe_ecdsa_bug</literal>
30487 </para>
30488 </listitem>
30489 <listitem>
30490 <para>
30491 <literal>single_dh_use</literal>
30492 </para>
30493 </listitem>
30494 <listitem>
30495 <para>
30496 <literal>single_ecdh_use</literal>
30497 </para>
30498 </listitem>
30499 <listitem>
30500 <para>
30501 <literal>ssleay_080_client_dh_bug</literal>
30502 </para>
30503 </listitem>
30504 <listitem>
30505 <para>
30506 <literal>sslref2_reuse_cert_type_bug</literal>
30507 </para>
30508 </listitem>
30509 <listitem>
30510 <para>
30511 <literal>tls_block_padding_bug</literal>
30512 </para>
30513 </listitem>
30514 <listitem>
30515 <para>
30516 <literal>tls_d5_bug</literal>
30517 </para>
30518 </listitem>
30519 <listitem>
30520 <para>
30521 <literal>tls_rollback_bug</literal>
30522 </para>
30523 </listitem>
30524 </itemizedlist>
30525 <para>
30526 As an aside, the <literal>safari_ecdhe_ecdsa_bug</literal> item is a misnomer and affects
30527 all clients connecting using the MacOS SecureTransport TLS facility prior
30528 to MacOS 10.8.4, including email clients.  If you see old MacOS clients failing
30529 to negotiate TLS then this option value might help, provided that your OpenSSL
30530 release is new enough to contain this work-around.  This may be a situation
30531 where you have to upgrade OpenSSL to get buggy clients working.
30532 </para>
30533 <para>
30534 <indexterm role="option">
30535 <primary><option>oracle_servers</option></primary>
30536 </indexterm>
30537 </para>
30538 <informaltable frame="all">
30539 <tgroup cols="4" colsep="0" rowsep="0">
30540 <colspec colwidth="8*" align="left"/>
30541 <colspec colwidth="6*" align="center"/>
30542 <colspec colwidth="6*" align="center"/>
30543 <colspec colwidth="6*" align="right"/>
30544 <tbody>
30545 <row>
30546 <entry><option>oracle_servers</option></entry>
30547 <entry>Use: <emphasis>main</emphasis></entry>
30548 <entry>Type: <emphasis>string list</emphasis></entry>
30549 <entry>Default: <emphasis>unset</emphasis></entry>
30550 </row>
30551 </tbody>
30552 </tgroup>
30553 </informaltable>
30554 <para>
30555 <indexterm role="concept">
30556 <primary>Oracle</primary>
30557 <secondary>server list</secondary>
30558 </indexterm>
30559 This option provides a list of Oracle servers and associated connection data,
30560 to be used in conjunction with <command>oracle</command> lookups (see section <xref linkend="SECID72"/>).
30561 The option is available only if Exim has been built with Oracle support.
30562 </para>
30563 <para>
30564 <indexterm role="option">
30565 <primary><option>percent_hack_domains</option></primary>
30566 </indexterm>
30567 </para>
30568 <informaltable frame="all">
30569 <tgroup cols="4" colsep="0" rowsep="0">
30570 <colspec colwidth="8*" align="left"/>
30571 <colspec colwidth="6*" align="center"/>
30572 <colspec colwidth="6*" align="center"/>
30573 <colspec colwidth="6*" align="right"/>
30574 <tbody>
30575 <row>
30576 <entry><option>percent_hack_domains</option></entry>
30577 <entry>Use: <emphasis>main</emphasis></entry>
30578 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
30579 <entry>Default: <emphasis>unset</emphasis></entry>
30580 </row>
30581 </tbody>
30582 </tgroup>
30583 </informaltable>
30584 <para>
30585 <indexterm role="concept">
30586 <primary><quote>percent hack</quote></primary>
30587 </indexterm>
30588 <indexterm role="concept">
30589 <primary>source routing</primary>
30590 <secondary>in email address</secondary>
30591 </indexterm>
30592 <indexterm role="concept">
30593 <primary>address</primary>
30594 <secondary>source-routed</secondary>
30595 </indexterm>
30596 The <quote>percent hack</quote> is the convention whereby a local part containing a
30597 percent sign is re-interpreted as a new email address, with the percent
30598 replaced by @. This is sometimes called <quote>source routing</quote>, though that term is
30599 also applied to RFC 2822 addresses that begin with an @ character. If this
30600 option is set, Exim implements the percent facility for those domains listed,
30601 but no others. This happens before an incoming SMTP address is tested against
30602 an ACL.
30603 </para>
30604 <para>
30605 <emphasis role="bold">Warning</emphasis>: The <quote>percent hack</quote> has often been abused by people who are
30606 trying to get round relaying restrictions. For this reason, it is best avoided
30607 if at all possible. Unfortunately, a number of less security-conscious MTAs
30608 implement it unconditionally. If you are running Exim on a gateway host, and
30609 routing mail through to internal MTAs without processing the local parts, it is
30610 a good idea to reject recipient addresses with percent characters in their
30611 local parts. Exim&#x2019;s default configuration does this.
30612 </para>
30613 <para>
30614 <indexterm role="option">
30615 <primary><option>perl_at_start</option></primary>
30616 </indexterm>
30617 </para>
30618 <informaltable frame="all">
30619 <tgroup cols="4" colsep="0" rowsep="0">
30620 <colspec colwidth="8*" align="left"/>
30621 <colspec colwidth="6*" align="center"/>
30622 <colspec colwidth="6*" align="center"/>
30623 <colspec colwidth="6*" align="right"/>
30624 <tbody>
30625 <row>
30626 <entry><option>perl_at_start</option></entry>
30627 <entry>Use: <emphasis>main</emphasis></entry>
30628 <entry>Type: <emphasis>boolean</emphasis></entry>
30629 <entry>Default: <emphasis>false</emphasis></entry>
30630 </row>
30631 </tbody>
30632 </tgroup>
30633 </informaltable>
30634 <para>
30635 <indexterm role="concept">
30636 <primary>Perl</primary>
30637 </indexterm>
30638 This option is available only when Exim is built with an embedded Perl
30639 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
30640 </para>
30641 <para>
30642 <indexterm role="option">
30643 <primary><option>perl_startup</option></primary>
30644 </indexterm>
30645 </para>
30646 <informaltable frame="all">
30647 <tgroup cols="4" colsep="0" rowsep="0">
30648 <colspec colwidth="8*" align="left"/>
30649 <colspec colwidth="6*" align="center"/>
30650 <colspec colwidth="6*" align="center"/>
30651 <colspec colwidth="6*" align="right"/>
30652 <tbody>
30653 <row>
30654 <entry><option>perl_startup</option></entry>
30655 <entry>Use: <emphasis>main</emphasis></entry>
30656 <entry>Type: <emphasis>string</emphasis></entry>
30657 <entry>Default: <emphasis>unset</emphasis></entry>
30658 </row>
30659 </tbody>
30660 </tgroup>
30661 </informaltable>
30662 <para>
30663 <indexterm role="concept">
30664 <primary>Perl</primary>
30665 </indexterm>
30666 This option is available only when Exim is built with an embedded Perl
30667 interpreter. See chapter <xref linkend="CHAPperl"/> for details of its use.
30668 </para>
30669 <para>
30670 <indexterm role="option">
30671 <primary><option>perl_taintmode</option></primary>
30672 </indexterm>
30673 </para>
30674 <informaltable frame="all">
30675 <tgroup cols="4" colsep="0" rowsep="0">
30676 <colspec colwidth="8*" align="left"/>
30677 <colspec colwidth="6*" align="center"/>
30678 <colspec colwidth="6*" align="center"/>
30679 <colspec colwidth="6*" align="right"/>
30680 <tbody>
30681 <row>
30682 <entry><option>perl_taintmode</option></entry>
30683 <entry>Use: <emphasis>main</emphasis></entry>
30684 <entry>Type: <emphasis>boolean</emphasis></entry>
30685 <entry>Default: <emphasis>false</emphasis></entry>
30686 </row>
30687 </tbody>
30688 </tgroup>
30689 </informaltable>
30690 <para>
30691 <indexterm role="concept">
30692 <primary>Perl</primary>
30693 </indexterm>
30694 This option enables the taint mode of the embedded Perl interpreter.
30695 </para>
30696 <para>
30697 <indexterm role="option">
30698 <primary><option>pgsql_servers</option></primary>
30699 </indexterm>
30700 </para>
30701 <informaltable frame="all">
30702 <tgroup cols="4" colsep="0" rowsep="0">
30703 <colspec colwidth="8*" align="left"/>
30704 <colspec colwidth="6*" align="center"/>
30705 <colspec colwidth="6*" align="center"/>
30706 <colspec colwidth="6*" align="right"/>
30707 <tbody>
30708 <row>
30709 <entry><option>pgsql_servers</option></entry>
30710 <entry>Use: <emphasis>main</emphasis></entry>
30711 <entry>Type: <emphasis>string list</emphasis></entry>
30712 <entry>Default: <emphasis>unset</emphasis></entry>
30713 </row>
30714 </tbody>
30715 </tgroup>
30716 </informaltable>
30717 <para>
30718 <indexterm role="concept">
30719 <primary>PostgreSQL lookup type</primary>
30720 <secondary>server list</secondary>
30721 </indexterm>
30722 This option provides a list of PostgreSQL servers and associated connection
30723 data, to be used in conjunction with <command>pgsql</command> lookups (see section
30724 <xref linkend="SECID72"/>). The option is available only if Exim has been built with
30725 PostgreSQL support.
30726 </para>
30727 <para>
30728 <indexterm role="option">
30729 <primary><option>pid_file_path</option></primary>
30730 </indexterm>
30731 </para>
30732 <informaltable frame="all">
30733 <tgroup cols="4" colsep="0" rowsep="0">
30734 <colspec colwidth="8*" align="left"/>
30735 <colspec colwidth="6*" align="center"/>
30736 <colspec colwidth="6*" align="center"/>
30737 <colspec colwidth="6*" align="right"/>
30738 <tbody>
30739 <row>
30740 <entry><option>pid_file_path</option></entry>
30741 <entry>Use: <emphasis>main</emphasis></entry>
30742 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
30743 <entry>Default: <emphasis>set at compile time</emphasis></entry>
30744 </row>
30745 </tbody>
30746 </tgroup>
30747 </informaltable>
30748 <para>
30749 <indexterm role="concept">
30750 <primary>daemon</primary>
30751 <secondary>pid file path</secondary>
30752 </indexterm>
30753 <indexterm role="concept">
30754 <primary>pid file, path for</primary>
30755 </indexterm>
30756 This option sets the name of the file to which the Exim daemon writes its
30757 process id. The string is expanded, so it can contain, for example, references
30758 to the host name:
30759 </para>
30760 <literallayout class="monospaced">
30761 pid_file_path = /var/log/$primary_hostname/exim.pid
30762 </literallayout>
30763 <para>
30764 If no path is set, the pid is written to the file <filename>exim-daemon.pid</filename> in Exim&#x2019;s
30765 spool directory.
30766 The value set by the option can be overridden by the <option>-oP</option> command line
30767 option. A pid file is not written if a <quote>non-standard</quote> daemon is run by means
30768 of the <option>-oX</option> option, unless a path is explicitly supplied by <option>-oP</option>.
30769 </para>
30770 <para>
30771 <indexterm role="option">
30772 <primary><option>pipelining_advertise_hosts</option></primary>
30773 </indexterm>
30774 </para>
30775 <informaltable frame="all">
30776 <tgroup cols="4" colsep="0" rowsep="0">
30777 <colspec colwidth="8*" align="left"/>
30778 <colspec colwidth="6*" align="center"/>
30779 <colspec colwidth="6*" align="center"/>
30780 <colspec colwidth="6*" align="right"/>
30781 <tbody>
30782 <row>
30783 <entry><option>pipelining_advertise_hosts</option></entry>
30784 <entry>Use: <emphasis>main</emphasis></entry>
30785 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30786 <entry>Default: <emphasis>*</emphasis></entry>
30787 </row>
30788 </tbody>
30789 </tgroup>
30790 </informaltable>
30791 <para>
30792 <indexterm role="concept">
30793 <primary>PIPELINING</primary>
30794 <secondary>suppressing advertising</secondary>
30795 </indexterm>
30796 <indexterm role="concept">
30797 <primary>ESMTP extensions</primary>
30798 <secondary>PIPELINING</secondary>
30799 </indexterm>
30800 This option can be used to suppress the advertisement of the SMTP
30801 PIPELINING extension to specific hosts. See also the <emphasis role="bold">no_pipelining</emphasis>
30802 control in section <xref linkend="SECTcontrols"/>. When PIPELINING is not advertised and
30803 <option>smtp_enforce_sync</option> is true, an Exim server enforces strict synchronization
30804 for each SMTP command and response. When PIPELINING is advertised, Exim assumes
30805 that clients will use it; <quote>out of order</quote> commands that are <quote>expected</quote> do
30806 not count as protocol errors (see <option>smtp_max_synprot_errors</option>).
30807 </para>
30808 <para>
30809 <indexterm role="option">
30810 <primary><option>pipelining_connect_advertise_hosts</option></primary>
30811 </indexterm>
30812 </para>
30813 <informaltable frame="all">
30814 <tgroup cols="4" colsep="0" rowsep="0">
30815 <colspec colwidth="8*" align="left"/>
30816 <colspec colwidth="6*" align="center"/>
30817 <colspec colwidth="6*" align="center"/>
30818 <colspec colwidth="6*" align="right"/>
30819 <tbody>
30820 <row>
30821 <entry><option>pipelining_connect_advertise_hosts</option></entry>
30822 <entry>Use: <emphasis>main</emphasis></entry>
30823 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
30824 <entry>Default: <emphasis>*</emphasis></entry>
30825 </row>
30826 </tbody>
30827 </tgroup>
30828 </informaltable>
30829 <para>
30830 <indexterm role="concept">
30831 <primary>pipelining</primary>
30832 <secondary>early connection</secondary>
30833 </indexterm>
30834 <indexterm role="concept">
30835 <primary>pipelining</primary>
30836 <secondary>PIPECONNECT</secondary>
30837 </indexterm>
30838 <indexterm role="concept">
30839 <primary>ESMTP extensions</primary>
30840 <secondary>PIPECONNECT</secondary>
30841 </indexterm>
30842 If Exim is built without the DISABLE_PIPE_CONNECT build option
30843 this option controls which hosts the facility is advertised to
30844 and from which pipeline early-connection (before MAIL) SMTP
30845 commands are acceptable.
30846 When used, the pipelining saves on roundtrip times.
30847 </para>
30848 <para>
30849 See also the <option>hosts_pipe_connect</option> smtp transport option.
30850 </para>
30851 <para>
30852 The SMTP service extension keyword advertised is <quote>PIPECONNECT</quote>;
30853 it permits the client to pipeline
30854 TCP connection and hello command (inclear phase),
30855 or TLS-establishment and hello command (encrypted phase),
30856 on later connections to the same host.
30857 </para>
30858 <para>
30859 <indexterm role="option">
30860 <primary><option>prdr_enable</option></primary>
30861 </indexterm>
30862 </para>
30863 <informaltable frame="all">
30864 <tgroup cols="4" colsep="0" rowsep="0">
30865 <colspec colwidth="8*" align="left"/>
30866 <colspec colwidth="6*" align="center"/>
30867 <colspec colwidth="6*" align="center"/>
30868 <colspec colwidth="6*" align="right"/>
30869 <tbody>
30870 <row>
30871 <entry><option>prdr_enable</option></entry>
30872 <entry>Use: <emphasis>main</emphasis></entry>
30873 <entry>Type: <emphasis>boolean</emphasis></entry>
30874 <entry>Default: <emphasis>false</emphasis></entry>
30875 </row>
30876 </tbody>
30877 </tgroup>
30878 </informaltable>
30879 <para>
30880 <indexterm role="concept">
30881 <primary>PRDR</primary>
30882 <secondary>enabling on server</secondary>
30883 </indexterm>
30884 <indexterm role="concept">
30885 <primary>ESMTP extensions</primary>
30886 <secondary>PRDR</secondary>
30887 </indexterm>
30888 This option can be used to enable the Per-Recipient Data Response extension
30889 to SMTP, defined by Eric Hall.
30890 If the option is set, PRDR is advertised by Exim when operating as a server.
30891 If the client requests PRDR, and more than one recipient, for a message
30892 an additional ACL is called for each recipient after the message content
30893 is received.  See section <xref linkend="SECTPRDRACL"/>.
30894 </para>
30895 <para>
30896 <indexterm role="option">
30897 <primary><option>preserve_message_logs</option></primary>
30898 </indexterm>
30899 </para>
30900 <informaltable frame="all">
30901 <tgroup cols="4" colsep="0" rowsep="0">
30902 <colspec colwidth="8*" align="left"/>
30903 <colspec colwidth="6*" align="center"/>
30904 <colspec colwidth="6*" align="center"/>
30905 <colspec colwidth="6*" align="right"/>
30906 <tbody>
30907 <row>
30908 <entry><option>preserve_message_logs</option></entry>
30909 <entry>Use: <emphasis>main</emphasis></entry>
30910 <entry>Type: <emphasis>boolean</emphasis></entry>
30911 <entry>Default: <emphasis>false</emphasis></entry>
30912 </row>
30913 </tbody>
30914 </tgroup>
30915 </informaltable>
30916 <para>
30917 <indexterm role="concept">
30918 <primary>message logs</primary>
30919 <secondary>preserving</secondary>
30920 </indexterm>
30921 If this option is set, message log files are not deleted when messages are
30922 completed. Instead, they are moved to a sub-directory of the spool directory
30923 called <filename>msglog.OLD</filename>, where they remain available for statistical or debugging
30924 purposes. This is a dangerous option to set on systems with any appreciable
30925 volume of mail. Use with care!
30926 </para>
30927 <para>
30928 <indexterm role="option">
30929 <primary><option>primary_hostname</option></primary>
30930 </indexterm>
30931 </para>
30932 <informaltable frame="all">
30933 <tgroup cols="4" colsep="0" rowsep="0">
30934 <colspec colwidth="8*" align="left"/>
30935 <colspec colwidth="6*" align="center"/>
30936 <colspec colwidth="6*" align="center"/>
30937 <colspec colwidth="6*" align="right"/>
30938 <tbody>
30939 <row>
30940 <entry><option>primary_hostname</option></entry>
30941 <entry>Use: <emphasis>main</emphasis></entry>
30942 <entry>Type: <emphasis>string</emphasis></entry>
30943 <entry>Default: <emphasis>see below</emphasis></entry>
30944 </row>
30945 </tbody>
30946 </tgroup>
30947 </informaltable>
30948 <para>
30949 <indexterm role="concept">
30950 <primary>name</primary>
30951 <secondary>of local host</secondary>
30952 </indexterm>
30953 <indexterm role="concept">
30954 <primary>host</primary>
30955 <secondary>name of local</secondary>
30956 </indexterm>
30957 <indexterm role="concept">
30958 <primary>local host</primary>
30959 <secondary>name of</secondary>
30960 </indexterm>
30961 <indexterm role="variable">
30962 <primary><varname>$primary_hostname</varname></primary>
30963 </indexterm>
30964 This specifies the name of the current host. It is used in the default EHLO or
30965 HELO command for outgoing SMTP messages (changeable via the <option>helo_data</option>
30966 option in the <command>smtp</command> transport), and as the default for <option>qualify_domain</option>.
30967 The value is also used by default in some SMTP response messages from an Exim
30968 server. This can be changed dynamically by setting <option>smtp_active_hostname</option>.
30969 </para>
30970 <para>
30971 If <option>primary_hostname</option> is not set, Exim calls <function>uname()</function> to find the host
30972 name. If this fails, Exim panics and dies. If the name returned by <function>uname()</function>
30973 contains only one component, Exim passes it to <function>gethostbyname()</function> (or
30974 <function>getipnodebyname()</function> when available) in order to obtain the fully qualified
30975 version. The variable <varname>$primary_hostname</varname> contains the host name, whether set
30976 explicitly by this option, or defaulted.
30977 </para>
30978 <para>
30979 <indexterm role="option">
30980 <primary><option>print_topbitchars</option></primary>
30981 </indexterm>
30982 </para>
30983 <informaltable frame="all">
30984 <tgroup cols="4" colsep="0" rowsep="0">
30985 <colspec colwidth="8*" align="left"/>
30986 <colspec colwidth="6*" align="center"/>
30987 <colspec colwidth="6*" align="center"/>
30988 <colspec colwidth="6*" align="right"/>
30989 <tbody>
30990 <row>
30991 <entry><option>print_topbitchars</option></entry>
30992 <entry>Use: <emphasis>main</emphasis></entry>
30993 <entry>Type: <emphasis>boolean</emphasis></entry>
30994 <entry>Default: <emphasis>false</emphasis></entry>
30995 </row>
30996 </tbody>
30997 </tgroup>
30998 </informaltable>
30999 <para>
31000 <indexterm role="concept">
31001 <primary>printing characters</primary>
31002 </indexterm>
31003 <indexterm role="concept">
31004 <primary>8-bit characters</primary>
31005 </indexterm>
31006 By default, Exim considers only those characters whose codes lie in the range
31007 32&ndash;126 to be printing characters. In a number of circumstances (for example,
31008 when writing log entries) non-printing characters are converted into escape
31009 sequences, primarily to avoid messing up the layout. If <option>print_topbitchars</option>
31010 is set, code values of 128 and above are also considered to be printing
31011 characters.
31012 </para>
31013 <para>
31014 This option also affects the header syntax checks performed by the
31015 <command>autoreply</command> transport, and whether Exim uses RFC 2047 encoding of
31016 the user&#x2019;s full name when constructing From: and Sender: addresses (as
31017 described in section <xref linkend="SECTconstr"/>). Setting this option can cause
31018 Exim to generate eight bit message headers that do not conform to the
31019 standards.
31020 </para>
31021 <para>
31022 <indexterm role="option">
31023 <primary><option>process_log_path</option></primary>
31024 </indexterm>
31025 </para>
31026 <informaltable frame="all">
31027 <tgroup cols="4" colsep="0" rowsep="0">
31028 <colspec colwidth="8*" align="left"/>
31029 <colspec colwidth="6*" align="center"/>
31030 <colspec colwidth="6*" align="center"/>
31031 <colspec colwidth="6*" align="right"/>
31032 <tbody>
31033 <row>
31034 <entry><option>process_log_path</option></entry>
31035 <entry>Use: <emphasis>main</emphasis></entry>
31036 <entry>Type: <emphasis>string</emphasis></entry>
31037 <entry>Default: <emphasis>unset</emphasis></entry>
31038 </row>
31039 </tbody>
31040 </tgroup>
31041 </informaltable>
31042 <para>
31043 <indexterm role="concept">
31044 <primary>process log path</primary>
31045 </indexterm>
31046 <indexterm role="concept">
31047 <primary>log</primary>
31048 <secondary>process log</secondary>
31049 </indexterm>
31050 <indexterm role="concept">
31051 <primary><emphasis>exiwhat</emphasis></primary>
31052 </indexterm>
31053 This option sets the name of the file to which an Exim process writes its
31054 <quote>process log</quote> when sent a USR1 signal. This is used by the <emphasis>exiwhat</emphasis>
31055 utility script. If this option is unset, the file called <filename>exim-process.info</filename>
31056 in Exim&#x2019;s spool directory is used. The ability to specify the name explicitly
31057 can be useful in environments where two different Exims are running, using
31058 different spool directories.
31059 </para>
31060 <para>
31061 <indexterm role="option">
31062 <primary><option>prod_requires_admin</option></primary>
31063 </indexterm>
31064 </para>
31065 <informaltable frame="all">
31066 <tgroup cols="4" colsep="0" rowsep="0">
31067 <colspec colwidth="8*" align="left"/>
31068 <colspec colwidth="6*" align="center"/>
31069 <colspec colwidth="6*" align="center"/>
31070 <colspec colwidth="6*" align="right"/>
31071 <tbody>
31072 <row>
31073 <entry><option>prod_requires_admin</option></entry>
31074 <entry>Use: <emphasis>main</emphasis></entry>
31075 <entry>Type: <emphasis>boolean</emphasis></entry>
31076 <entry>Default: <emphasis>true</emphasis></entry>
31077 </row>
31078 </tbody>
31079 </tgroup>
31080 </informaltable>
31081 <para>
31082 <indexterm role="concept">
31083 <primary>restricting access to features</primary>
31084 </indexterm>
31085 <indexterm role="option">
31086 <primary><option>-M</option></primary>
31087 </indexterm>
31088 <indexterm role="option">
31089 <primary><option>-R</option></primary>
31090 </indexterm>
31091 <indexterm role="option">
31092 <primary><option>-q</option></primary>
31093 </indexterm>
31094 The <option>-M</option>, <option>-R</option>, and <option>-q</option> command-line options require the caller to be an
31095 admin user unless <option>prod_requires_admin</option> is set false. See also
31096 <option>queue_list_requires_admin</option> and <option>commandline_checks_require_admin</option>.
31097 </para>
31098 <para>
31099 <indexterm role="option">
31100 <primary><option>proxy_protocol_timeout</option></primary>
31101 </indexterm>
31102 </para>
31103 <informaltable frame="all">
31104 <tgroup cols="4" colsep="0" rowsep="0">
31105 <colspec colwidth="8*" align="left"/>
31106 <colspec colwidth="6*" align="center"/>
31107 <colspec colwidth="6*" align="center"/>
31108 <colspec colwidth="6*" align="right"/>
31109 <tbody>
31110 <row>
31111 <entry><option>proxy_protocol_timeout</option></entry>
31112 <entry>Use: <emphasis>main</emphasis></entry>
31113 <entry>Type: <emphasis>time</emphasis></entry>
31114 <entry>Default: <emphasis>3s</emphasis></entry>
31115 </row>
31116 </tbody>
31117 </tgroup>
31118 </informaltable>
31119 <para>
31120 <indexterm role="concept">
31121 <primary>proxy</primary>
31122 <secondary>proxy protocol</secondary>
31123 </indexterm>
31124 This option sets the timeout for proxy protocol negotiation.
31125 For details see section <xref linkend="SECTproxyInbound"/>.
31126 </para>
31127 <para>
31128 <indexterm role="option">
31129 <primary><option>qualify_domain</option></primary>
31130 </indexterm>
31131 </para>
31132 <informaltable frame="all">
31133 <tgroup cols="4" colsep="0" rowsep="0">
31134 <colspec colwidth="8*" align="left"/>
31135 <colspec colwidth="6*" align="center"/>
31136 <colspec colwidth="6*" align="center"/>
31137 <colspec colwidth="6*" align="right"/>
31138 <tbody>
31139 <row>
31140 <entry><option>qualify_domain</option></entry>
31141 <entry>Use: <emphasis>main</emphasis></entry>
31142 <entry>Type: <emphasis>string</emphasis></entry>
31143 <entry>Default: <emphasis>see below</emphasis></entry>
31144 </row>
31145 </tbody>
31146 </tgroup>
31147 </informaltable>
31148 <para>
31149 <indexterm role="concept">
31150 <primary>domain</primary>
31151 <secondary>for qualifying addresses</secondary>
31152 </indexterm>
31153 <indexterm role="concept">
31154 <primary>address</primary>
31155 <secondary>qualification</secondary>
31156 </indexterm>
31157 This option specifies the domain name that is added to any envelope sender
31158 addresses that do not have a domain qualification. It also applies to
31159 recipient addresses if <option>qualify_recipient</option> is not set. Unqualified addresses
31160 are accepted by default only for locally-generated messages. Qualification is
31161 also applied to addresses in header lines such as <emphasis>From:</emphasis> and <emphasis>To:</emphasis> for
31162 locally-generated messages, unless the <option>-bnq</option> command line option is used.
31163 </para>
31164 <para>
31165 Messages from external sources must always contain fully qualified addresses,
31166 unless the sending host matches <option>sender_unqualified_hosts</option> or
31167 <option>recipient_unqualified_hosts</option> (as appropriate), in which case incoming
31168 addresses are qualified with <option>qualify_domain</option> or <option>qualify_recipient</option> as
31169 necessary. Internally, Exim always works with fully qualified envelope
31170 addresses. If <option>qualify_domain</option> is not set, it defaults to the
31171 <option>primary_hostname</option> value.
31172 </para>
31173 <para>
31174 <indexterm role="option">
31175 <primary><option>qualify_recipient</option></primary>
31176 </indexterm>
31177 </para>
31178 <informaltable frame="all">
31179 <tgroup cols="4" colsep="0" rowsep="0">
31180 <colspec colwidth="8*" align="left"/>
31181 <colspec colwidth="6*" align="center"/>
31182 <colspec colwidth="6*" align="center"/>
31183 <colspec colwidth="6*" align="right"/>
31184 <tbody>
31185 <row>
31186 <entry><option>qualify_recipient</option></entry>
31187 <entry>Use: <emphasis>main</emphasis></entry>
31188 <entry>Type: <emphasis>string</emphasis></entry>
31189 <entry>Default: <emphasis>see below</emphasis></entry>
31190 </row>
31191 </tbody>
31192 </tgroup>
31193 </informaltable>
31194 <para>
31195 This option allows you to specify a different domain for qualifying recipient
31196 addresses to the one that is used for senders. See <option>qualify_domain</option> above.
31197 </para>
31198 <para>
31199 <indexterm role="option">
31200 <primary><option>queue_domains</option></primary>
31201 </indexterm>
31202 </para>
31203 <informaltable frame="all">
31204 <tgroup cols="4" colsep="0" rowsep="0">
31205 <colspec colwidth="8*" align="left"/>
31206 <colspec colwidth="6*" align="center"/>
31207 <colspec colwidth="6*" align="center"/>
31208 <colspec colwidth="6*" align="right"/>
31209 <tbody>
31210 <row>
31211 <entry><option>queue_domains</option></entry>
31212 <entry>Use: <emphasis>main</emphasis></entry>
31213 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31214 <entry>Default: <emphasis>unset</emphasis></entry>
31215 </row>
31216 </tbody>
31217 </tgroup>
31218 </informaltable>
31219 <para>
31220 <indexterm role="concept">
31221 <primary>domain</primary>
31222 <secondary>specifying non-immediate delivery</secondary>
31223 </indexterm>
31224 <indexterm role="concept">
31225 <primary>queueing incoming messages</primary>
31226 </indexterm>
31227 <indexterm role="concept">
31228 <primary>message</primary>
31229 <secondary>queueing certain domains</secondary>
31230 </indexterm>
31231 This option lists domains for which immediate delivery is not required.
31232 A delivery process is started whenever a message is received, but only those
31233 domains that do not match are processed. All other deliveries wait until the
31234 next queue run. See also <option>hold_domains</option> and <option>queue_smtp_domains</option>.
31235 </para>
31236 <para>
31237 <indexterm role="option">
31238 <primary><option>queue_fast_ramp</option></primary>
31239 </indexterm>
31240 </para>
31241 <informaltable frame="all">
31242 <tgroup cols="4" colsep="0" rowsep="0">
31243 <colspec colwidth="8*" align="left"/>
31244 <colspec colwidth="6*" align="center"/>
31245 <colspec colwidth="6*" align="center"/>
31246 <colspec colwidth="6*" align="right"/>
31247 <tbody>
31248 <row>
31249 <entry><option>queue_fast_ramp</option></entry>
31250 <entry>Use: <emphasis>main</emphasis></entry>
31251 <entry>Type: <emphasis>boolean</emphasis></entry>
31252 <entry>Default: <emphasis>false</emphasis></entry>
31253 </row>
31254 </tbody>
31255 </tgroup>
31256 </informaltable>
31257 <para>
31258 <indexterm role="concept">
31259 <primary>queue runner</primary>
31260 <secondary>two phase</secondary>
31261 </indexterm>
31262 <indexterm role="concept">
31263 <primary>queue</primary>
31264 <secondary>double scanning</secondary>
31265 </indexterm>
31266 If set to true, two-phase queue runs, initiated using <option>-qq</option> on the
31267 command line, may start parallel delivery processes during their first
31268 phase.  This will be done when a threshold number of messages have been
31269 routed for a single host.
31270 </para>
31271 <para>
31272 <indexterm role="option">
31273 <primary><option>queue_list_requires_admin</option></primary>
31274 </indexterm>
31275 </para>
31276 <informaltable frame="all">
31277 <tgroup cols="4" colsep="0" rowsep="0">
31278 <colspec colwidth="8*" align="left"/>
31279 <colspec colwidth="6*" align="center"/>
31280 <colspec colwidth="6*" align="center"/>
31281 <colspec colwidth="6*" align="right"/>
31282 <tbody>
31283 <row>
31284 <entry><option>queue_list_requires_admin</option></entry>
31285 <entry>Use: <emphasis>main</emphasis></entry>
31286 <entry>Type: <emphasis>boolean</emphasis></entry>
31287 <entry>Default: <emphasis>true</emphasis></entry>
31288 </row>
31289 </tbody>
31290 </tgroup>
31291 </informaltable>
31292 <para>
31293 <indexterm role="concept">
31294 <primary>restricting access to features</primary>
31295 </indexterm>
31296 <indexterm role="option">
31297 <primary><option>-bp</option></primary>
31298 </indexterm>
31299 The <option>-bp</option> command-line option, which lists the messages that are on the
31300 queue, requires the caller to be an admin user unless
31301 <option>queue_list_requires_admin</option> is set false.
31302 See also <option>prod_requires_admin</option> and <option>commandline_checks_require_admin</option>.
31303 </para>
31304 <para>
31305 <indexterm role="option">
31306 <primary><option>queue_only</option></primary>
31307 </indexterm>
31308 </para>
31309 <informaltable frame="all">
31310 <tgroup cols="4" colsep="0" rowsep="0">
31311 <colspec colwidth="8*" align="left"/>
31312 <colspec colwidth="6*" align="center"/>
31313 <colspec colwidth="6*" align="center"/>
31314 <colspec colwidth="6*" align="right"/>
31315 <tbody>
31316 <row>
31317 <entry><option>queue_only</option></entry>
31318 <entry>Use: <emphasis>main</emphasis></entry>
31319 <entry>Type: <emphasis>boolean</emphasis></entry>
31320 <entry>Default: <emphasis>false</emphasis></entry>
31321 </row>
31322 </tbody>
31323 </tgroup>
31324 </informaltable>
31325 <para>
31326 <indexterm role="concept">
31327 <primary>queueing incoming messages</primary>
31328 </indexterm>
31329 <indexterm role="concept">
31330 <primary>message</primary>
31331 <secondary>queueing unconditionally</secondary>
31332 </indexterm>
31333 If <option>queue_only</option> is set, a delivery process is not automatically started
31334 whenever a message is received. Instead, the message waits in the queue for the
31335 next queue run. Even if <option>queue_only</option> is false, incoming messages may not get
31336 delivered immediately when certain conditions (such as heavy load) occur.
31337 </para>
31338 <para>
31339 The <option>-odq</option> command line has the same effect as <option>queue_only</option>. The <option>-odb</option>
31340 and <option>-odi</option> command line options override <option>queue_only</option> unless
31341 <option>queue_only_override</option> is set false. See also <option>queue_only_file</option>,
31342 <option>queue_only_load</option>, and <option>smtp_accept_queue</option>.
31343 </para>
31344 <para>
31345 <indexterm role="option">
31346 <primary><option>queue_only_file</option></primary>
31347 </indexterm>
31348 </para>
31349 <informaltable frame="all">
31350 <tgroup cols="4" colsep="0" rowsep="0">
31351 <colspec colwidth="8*" align="left"/>
31352 <colspec colwidth="6*" align="center"/>
31353 <colspec colwidth="6*" align="center"/>
31354 <colspec colwidth="6*" align="right"/>
31355 <tbody>
31356 <row>
31357 <entry><option>queue_only_file</option></entry>
31358 <entry>Use: <emphasis>main</emphasis></entry>
31359 <entry>Type: <emphasis>string</emphasis></entry>
31360 <entry>Default: <emphasis>unset</emphasis></entry>
31361 </row>
31362 </tbody>
31363 </tgroup>
31364 </informaltable>
31365 <para>
31366 <indexterm role="concept">
31367 <primary>queueing incoming messages</primary>
31368 </indexterm>
31369 <indexterm role="concept">
31370 <primary>message</primary>
31371 <secondary>queueing by file existence</secondary>
31372 </indexterm>
31373 This option can be set to a colon-separated list of absolute path names, each
31374 one optionally preceded by <quote>smtp</quote>. When Exim is receiving a message,
31375 it tests for the existence of each listed path using a call to <function>stat()</function>. For
31376 each path that exists, the corresponding queueing option is set.
31377 For paths with no prefix, <option>queue_only</option> is set; for paths prefixed by
31378 <quote>smtp</quote>, <option>queue_smtp_domains</option> is set to match all domains. So, for example,
31379 </para>
31380 <literallayout class="monospaced">
31381 queue_only_file = smtp/some/file
31382 </literallayout>
31383 <para>
31384 causes Exim to behave as if <option>queue_smtp_domains</option> were set to <quote>*</quote> whenever
31385 <filename>/some/file</filename> exists.
31386 </para>
31387 <para>
31388 <indexterm role="option">
31389 <primary><option>queue_only_load</option></primary>
31390 </indexterm>
31391 </para>
31392 <informaltable frame="all">
31393 <tgroup cols="4" colsep="0" rowsep="0">
31394 <colspec colwidth="8*" align="left"/>
31395 <colspec colwidth="6*" align="center"/>
31396 <colspec colwidth="6*" align="center"/>
31397 <colspec colwidth="6*" align="right"/>
31398 <tbody>
31399 <row>
31400 <entry><option>queue_only_load</option></entry>
31401 <entry>Use: <emphasis>main</emphasis></entry>
31402 <entry>Type: <emphasis>fixed-point</emphasis></entry>
31403 <entry>Default: <emphasis>unset</emphasis></entry>
31404 </row>
31405 </tbody>
31406 </tgroup>
31407 </informaltable>
31408 <para>
31409 <indexterm role="concept">
31410 <primary>load average</primary>
31411 </indexterm>
31412 <indexterm role="concept">
31413 <primary>queueing incoming messages</primary>
31414 </indexterm>
31415 <indexterm role="concept">
31416 <primary>message</primary>
31417 <secondary>queueing by load</secondary>
31418 </indexterm>
31419 If the system load average is higher than this value, incoming messages from
31420 all sources are queued, and no automatic deliveries are started. If this
31421 happens during local or remote SMTP input, all subsequent messages received on
31422 the same SMTP connection are queued by default, whatever happens to the load in
31423 the meantime, but this can be changed by setting <option>queue_only_load_latch</option>
31424 false.
31425 </para>
31426 <para>
31427 Deliveries will subsequently be performed by queue runner processes. This
31428 option has no effect on ancient operating systems on which Exim cannot
31429 determine the load average. See also <option>deliver_queue_load_max</option> and
31430 <option>smtp_load_reserve</option>.
31431 </para>
31432 <para>
31433 <indexterm role="option">
31434 <primary><option>queue_only_load_latch</option></primary>
31435 </indexterm>
31436 </para>
31437 <informaltable frame="all">
31438 <tgroup cols="4" colsep="0" rowsep="0">
31439 <colspec colwidth="8*" align="left"/>
31440 <colspec colwidth="6*" align="center"/>
31441 <colspec colwidth="6*" align="center"/>
31442 <colspec colwidth="6*" align="right"/>
31443 <tbody>
31444 <row>
31445 <entry><option>queue_only_load_latch</option></entry>
31446 <entry>Use: <emphasis>main</emphasis></entry>
31447 <entry>Type: <emphasis>boolean</emphasis></entry>
31448 <entry>Default: <emphasis>true</emphasis></entry>
31449 </row>
31450 </tbody>
31451 </tgroup>
31452 </informaltable>
31453 <para>
31454 <indexterm role="concept">
31455 <primary>load average</primary>
31456 <secondary>re-evaluating per message</secondary>
31457 </indexterm>
31458 When this option is true (the default), once one message has been queued
31459 because the load average is higher than the value set by <option>queue_only_load</option>,
31460 all subsequent messages received on the same SMTP connection are also queued.
31461 This is a deliberate choice; even though the load average may fall below the
31462 threshold, it doesn&#x2019;t seem right to deliver later messages on the same
31463 connection when not delivering earlier ones. However, there are special
31464 circumstances such as very long-lived connections from scanning appliances
31465 where this is not the best strategy. In such cases, <option>queue_only_load_latch</option>
31466 should be set false. This causes the value of the load average to be
31467 re-evaluated for each message.
31468 </para>
31469 <para>
31470 <indexterm role="option">
31471 <primary><option>queue_only_override</option></primary>
31472 </indexterm>
31473 </para>
31474 <informaltable frame="all">
31475 <tgroup cols="4" colsep="0" rowsep="0">
31476 <colspec colwidth="8*" align="left"/>
31477 <colspec colwidth="6*" align="center"/>
31478 <colspec colwidth="6*" align="center"/>
31479 <colspec colwidth="6*" align="right"/>
31480 <tbody>
31481 <row>
31482 <entry><option>queue_only_override</option></entry>
31483 <entry>Use: <emphasis>main</emphasis></entry>
31484 <entry>Type: <emphasis>boolean</emphasis></entry>
31485 <entry>Default: <emphasis>true</emphasis></entry>
31486 </row>
31487 </tbody>
31488 </tgroup>
31489 </informaltable>
31490 <para>
31491 <indexterm role="concept">
31492 <primary>queueing incoming messages</primary>
31493 </indexterm>
31494 When this option is true, the <option>-od</option><emphasis>x</emphasis> command line options override the
31495 setting of <option>queue_only</option> or <option>queue_only_file</option> in the configuration file. If
31496 <option>queue_only_override</option> is set false, the <option>-od</option><emphasis>x</emphasis> options cannot be used
31497 to override; they are accepted, but ignored.
31498 </para>
31499 <para>
31500 <indexterm role="option">
31501 <primary><option>queue_run_in_order</option></primary>
31502 </indexterm>
31503 </para>
31504 <informaltable frame="all">
31505 <tgroup cols="4" colsep="0" rowsep="0">
31506 <colspec colwidth="8*" align="left"/>
31507 <colspec colwidth="6*" align="center"/>
31508 <colspec colwidth="6*" align="center"/>
31509 <colspec colwidth="6*" align="right"/>
31510 <tbody>
31511 <row>
31512 <entry><option>queue_run_in_order</option></entry>
31513 <entry>Use: <emphasis>main</emphasis></entry>
31514 <entry>Type: <emphasis>boolean</emphasis></entry>
31515 <entry>Default: <emphasis>false</emphasis></entry>
31516 </row>
31517 </tbody>
31518 </tgroup>
31519 </informaltable>
31520 <para>
31521 <indexterm role="concept">
31522 <primary>queue runner</primary>
31523 <secondary>processing messages in order</secondary>
31524 </indexterm>
31525 If this option is set, queue runs happen in order of message arrival instead of
31526 in an arbitrary order. For this to happen, a complete list of the entire queue
31527 must be set up before the deliveries start. When the queue is all held in a
31528 single directory (the default), a single list is created for both the ordered
31529 and the non-ordered cases. However, if <option>split_spool_directory</option> is set, a
31530 single list is not created when <option>queue_run_in_order</option> is false. In this case,
31531 the sub-directories are processed one at a time (in a random order), and this
31532 avoids setting up one huge list for the whole queue. Thus, setting
31533 <option>queue_run_in_order</option> with <option>split_spool_directory</option> may degrade performance
31534 when the queue is large, because of the extra work in setting up the single,
31535 large list. In most situations, <option>queue_run_in_order</option> should not be set.
31536 </para>
31537 <para>
31538 <indexterm role="option">
31539 <primary><option>queue_run_max</option></primary>
31540 </indexterm>
31541 </para>
31542 <informaltable frame="all">
31543 <tgroup cols="4" colsep="0" rowsep="0">
31544 <colspec colwidth="8*" align="left"/>
31545 <colspec colwidth="6*" align="center"/>
31546 <colspec colwidth="6*" align="center"/>
31547 <colspec colwidth="6*" align="right"/>
31548 <tbody>
31549 <row>
31550 <entry><option>queue_run_max</option></entry>
31551 <entry>Use: <emphasis>main</emphasis></entry>
31552 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
31553 <entry>Default: <emphasis>5</emphasis></entry>
31554 </row>
31555 </tbody>
31556 </tgroup>
31557 </informaltable>
31558 <para>
31559 <indexterm role="concept">
31560 <primary>queue runner</primary>
31561 <secondary>maximum number of</secondary>
31562 </indexterm>
31563 This controls the maximum number of queue runner processes that an Exim daemon
31564 can run simultaneously. This does not mean that it starts them all at once,
31565 but rather that if the maximum number are still running when the time comes to
31566 start another one, it refrains from starting another one. This can happen with
31567 very large queues and/or very sluggish deliveries. This option does not,
31568 however, interlock with other processes, so additional queue runners can be
31569 started by other means, or by killing and restarting the daemon.
31570 </para>
31571 <para>
31572 Setting this option to zero does not suppress queue runs; rather, it disables
31573 the limit, allowing any number of simultaneous queue runner processes to be
31574 run. If you do not want queue runs to occur, omit the <option>-q</option><emphasis>xx</emphasis> setting on
31575 the daemon&#x2019;s command line.
31576 </para>
31577 <para>
31578 <indexterm role="concept">
31579 <primary>queues</primary>
31580 <secondary>named</secondary>
31581 </indexterm>
31582 <indexterm role="concept">
31583 <primary>named queues</primary>
31584 <secondary>resource limit</secondary>
31585 </indexterm>
31586 To set limits for different named queues use
31587 an expansion depending on the <varname>$queue_name</varname> variable.
31588 </para>
31589 <para>
31590 <indexterm role="option">
31591 <primary><option>queue_smtp_domains</option></primary>
31592 </indexterm>
31593 </para>
31594 <informaltable frame="all">
31595 <tgroup cols="4" colsep="0" rowsep="0">
31596 <colspec colwidth="8*" align="left"/>
31597 <colspec colwidth="6*" align="center"/>
31598 <colspec colwidth="6*" align="center"/>
31599 <colspec colwidth="6*" align="right"/>
31600 <tbody>
31601 <row>
31602 <entry><option>queue_smtp_domains</option></entry>
31603 <entry>Use: <emphasis>main</emphasis></entry>
31604 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31605 <entry>Default: <emphasis>unset</emphasis></entry>
31606 </row>
31607 </tbody>
31608 </tgroup>
31609 </informaltable>
31610 <para>
31611 <indexterm role="concept">
31612 <primary>queueing incoming messages</primary>
31613 </indexterm>
31614 <indexterm role="concept">
31615 <primary>message</primary>
31616 <secondary>queueing remote deliveries</secondary>
31617 </indexterm>
31618 <indexterm role="concept">
31619 <primary>first pass routing</primary>
31620 </indexterm>
31621 When this option is set, a delivery process is started whenever a message is
31622 received, routing is performed, and local deliveries take place.
31623 However, if any SMTP deliveries are required for domains that match
31624 <option>queue_smtp_domains</option>, they are not immediately delivered, but instead the
31625 message waits in the queue for the next queue run. Since routing of the message
31626 has taken place, Exim knows to which remote hosts it must be delivered, and so
31627 when the queue run happens, multiple messages for the same host are delivered
31628 over a single SMTP connection. The <option>-odqs</option> command line option causes all
31629 SMTP deliveries to be queued in this way, and is equivalent to setting
31630 <option>queue_smtp_domains</option> to <quote>*</quote>. See also <option>hold_domains</option> and
31631 <option>queue_domains</option>.
31632 </para>
31633 <para>
31634 <indexterm role="option">
31635 <primary><option>receive_timeout</option></primary>
31636 </indexterm>
31637 </para>
31638 <informaltable frame="all">
31639 <tgroup cols="4" colsep="0" rowsep="0">
31640 <colspec colwidth="8*" align="left"/>
31641 <colspec colwidth="6*" align="center"/>
31642 <colspec colwidth="6*" align="center"/>
31643 <colspec colwidth="6*" align="right"/>
31644 <tbody>
31645 <row>
31646 <entry><option>receive_timeout</option></entry>
31647 <entry>Use: <emphasis>main</emphasis></entry>
31648 <entry>Type: <emphasis>time</emphasis></entry>
31649 <entry>Default: <emphasis>0s</emphasis></entry>
31650 </row>
31651 </tbody>
31652 </tgroup>
31653 </informaltable>
31654 <para>
31655 <indexterm role="concept">
31656 <primary>timeout</primary>
31657 <secondary>for non-SMTP input</secondary>
31658 </indexterm>
31659 This option sets the timeout for accepting a non-SMTP message, that is, the
31660 maximum time that Exim waits when reading a message on the standard input. If
31661 the value is zero, it will wait forever. This setting is overridden by the
31662 <option>-or</option> command line option. The timeout for incoming SMTP messages is
31663 controlled by <option>smtp_receive_timeout</option>.
31664 </para>
31665 <para>
31666 <indexterm role="option">
31667 <primary><option>received_header_text</option></primary>
31668 </indexterm>
31669 </para>
31670 <informaltable frame="all">
31671 <tgroup cols="4" colsep="0" rowsep="0">
31672 <colspec colwidth="8*" align="left"/>
31673 <colspec colwidth="6*" align="center"/>
31674 <colspec colwidth="6*" align="center"/>
31675 <colspec colwidth="6*" align="right"/>
31676 <tbody>
31677 <row>
31678 <entry><option>received_header_text</option></entry>
31679 <entry>Use: <emphasis>main</emphasis></entry>
31680 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
31681 <entry>Default: <emphasis>see below</emphasis></entry>
31682 </row>
31683 </tbody>
31684 </tgroup>
31685 </informaltable>
31686 <para>
31687 <indexterm role="concept">
31688 <primary>customizing</primary>
31689 <secondary><emphasis>Received:</emphasis> header</secondary>
31690 </indexterm>
31691 <indexterm role="concept">
31692 <primary><emphasis>Received:</emphasis> header line</primary>
31693 <secondary>customizing</secondary>
31694 </indexterm>
31695 This string defines the contents of the <emphasis>Received:</emphasis> message header that is
31696 added to each message, except for the timestamp, which is automatically added
31697 on at the end (preceded by a semicolon). The string is expanded each time it is
31698 used. If the expansion yields an empty string, no <emphasis>Received:</emphasis> header line is
31699 added to the message. Otherwise, the string should start with the text
31700 <quote>Received:</quote> and conform to the RFC 2822 specification for <emphasis>Received:</emphasis>
31701 header lines.
31702 The default setting is:
31703 </para>
31704 <literallayout class="monospaced">
31705 received_header_text = Received: \
31706   ${if def:sender_rcvhost {from $sender_rcvhost\n\t}\
31707     {${if def:sender_ident \
31708       {from ${quote_local_part:$sender_ident} }}\
31709         ${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}}}}\
31710   by $primary_hostname \
31711   ${if def:received_protocol {with $received_protocol }}\
31712   ${if def:tls_in_ver        { ($tls_in_ver)}}\
31713   ${if def:tls_in_cipher_std { tls $tls_in_cipher_std\n\t}}\
31714   (Exim $version_number)\n\t\
31715   ${if def:sender_address \
31716   {(envelope-from &lt;$sender_address&gt;)\n\t}}\
31717   id $message_exim_id\
31718   ${if def:received_for {\n\tfor $received_for}}
31719 </literallayout>
31720 <para>
31721 The references to the TLS version and cipher are
31722 omitted when Exim is built without TLS
31723 support. The use of conditional expansions ensures that this works for both
31724 locally generated messages and messages received from remote hosts, giving
31725 header lines such as the following:
31726 </para>
31727 <literallayout class="monospaced">
31728 Received: from scrooge.carol.example ([192.168.12.25] ident=root)
31729 by marley.carol.example with esmtp (Exim 4.00)
31730 (envelope-from &lt;bob@carol.example&gt;)
31731 id 16IOWa-00019l-00
31732 for chas@dickens.example; Tue, 25 Dec 2001 14:43:44 +0000
31733 Received: by scrooge.carol.example with local (Exim 4.00)
31734 id 16IOWW-000083-00; Tue, 25 Dec 2001 14:43:41 +0000
31735 </literallayout>
31736 <para>
31737 Until the body of the message has been received, the timestamp is the time when
31738 the message started to be received. Once the body has arrived, and all policy
31739 checks have taken place, the timestamp is updated to the time at which the
31740 message was accepted.
31741 </para>
31742 <para>
31743 <indexterm role="option">
31744 <primary><option>received_headers_max</option></primary>
31745 </indexterm>
31746 </para>
31747 <informaltable frame="all">
31748 <tgroup cols="4" colsep="0" rowsep="0">
31749 <colspec colwidth="8*" align="left"/>
31750 <colspec colwidth="6*" align="center"/>
31751 <colspec colwidth="6*" align="center"/>
31752 <colspec colwidth="6*" align="right"/>
31753 <tbody>
31754 <row>
31755 <entry><option>received_headers_max</option></entry>
31756 <entry>Use: <emphasis>main</emphasis></entry>
31757 <entry>Type: <emphasis>integer</emphasis></entry>
31758 <entry>Default: <emphasis>30</emphasis></entry>
31759 </row>
31760 </tbody>
31761 </tgroup>
31762 </informaltable>
31763 <para>
31764 <indexterm role="concept">
31765 <primary>loop</primary>
31766 <secondary>prevention</secondary>
31767 </indexterm>
31768 <indexterm role="concept">
31769 <primary>mail loop prevention</primary>
31770 </indexterm>
31771 <indexterm role="concept">
31772 <primary><emphasis>Received:</emphasis> header line</primary>
31773 <secondary>counting</secondary>
31774 </indexterm>
31775 When a message is to be delivered, the number of <emphasis>Received:</emphasis> headers is
31776 counted, and if it is greater than this parameter, a mail loop is assumed to
31777 have occurred, the delivery is abandoned, and an error message is generated.
31778 This applies to both local and remote deliveries.
31779 </para>
31780 <para>
31781 <indexterm role="option">
31782 <primary><option>recipient_unqualified_hosts</option></primary>
31783 </indexterm>
31784 </para>
31785 <informaltable frame="all">
31786 <tgroup cols="4" colsep="0" rowsep="0">
31787 <colspec colwidth="8*" align="left"/>
31788 <colspec colwidth="6*" align="center"/>
31789 <colspec colwidth="6*" align="center"/>
31790 <colspec colwidth="6*" align="right"/>
31791 <tbody>
31792 <row>
31793 <entry><option>recipient_unqualified_hosts</option></entry>
31794 <entry>Use: <emphasis>main</emphasis></entry>
31795 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
31796 <entry>Default: <emphasis>unset</emphasis></entry>
31797 </row>
31798 </tbody>
31799 </tgroup>
31800 </informaltable>
31801 <para>
31802 <indexterm role="concept">
31803 <primary>unqualified addresses</primary>
31804 </indexterm>
31805 <indexterm role="concept">
31806 <primary>host</primary>
31807 <secondary>unqualified addresses from</secondary>
31808 </indexterm>
31809 This option lists those hosts from which Exim is prepared to accept unqualified
31810 recipient addresses in message envelopes. The addresses are made fully
31811 qualified by the addition of the <option>qualify_recipient</option> value. This option also
31812 affects message header lines. Exim does not reject unqualified recipient
31813 addresses in headers, but it qualifies them only if the message came from a
31814 host that matches <option>recipient_unqualified_hosts</option>,
31815 or if the message was submitted locally (not using TCP/IP), and the <option>-bnq</option>
31816 option was not set.
31817 </para>
31818 <para>
31819 <indexterm role="option">
31820 <primary><option>recipients_max</option></primary>
31821 </indexterm>
31822 </para>
31823 <informaltable frame="all">
31824 <tgroup cols="4" colsep="0" rowsep="0">
31825 <colspec colwidth="8*" align="left"/>
31826 <colspec colwidth="6*" align="center"/>
31827 <colspec colwidth="6*" align="center"/>
31828 <colspec colwidth="6*" align="right"/>
31829 <tbody>
31830 <row>
31831 <entry><option>recipients_max</option></entry>
31832 <entry>Use: <emphasis>main</emphasis></entry>
31833 <entry>Type: <emphasis>integer</emphasis></entry>
31834 <entry>Default: <emphasis>50000</emphasis></entry>
31835 </row>
31836 </tbody>
31837 </tgroup>
31838 </informaltable>
31839 <para>
31840 <indexterm role="concept">
31841 <primary>limit</primary>
31842 <secondary>number of recipients</secondary>
31843 </indexterm>
31844 <indexterm role="concept">
31845 <primary>recipient</primary>
31846 <secondary>maximum number</secondary>
31847 </indexterm>
31848 If this option is set greater than zero, it specifies the maximum number of
31849 original recipients for any message. Additional recipients that are generated
31850 by aliasing or forwarding do not count. SMTP messages get a 452 response for
31851 all recipients over the limit; earlier recipients are delivered as normal.
31852 Non-SMTP messages with too many recipients are failed, and no deliveries are
31853 done.
31854 </para>
31855 <para>
31856 <indexterm role="concept">
31857 <primary>RCPT</primary>
31858 <secondary>maximum number of incoming</secondary>
31859 </indexterm>
31860 <emphasis role="bold">Note</emphasis>: The RFCs specify that an SMTP server should accept at least 100
31861 RCPT commands in a single message.
31862 </para>
31863 <para>
31864 <indexterm role="option">
31865 <primary><option>recipients_max_reject</option></primary>
31866 </indexterm>
31867 </para>
31868 <informaltable frame="all">
31869 <tgroup cols="4" colsep="0" rowsep="0">
31870 <colspec colwidth="8*" align="left"/>
31871 <colspec colwidth="6*" align="center"/>
31872 <colspec colwidth="6*" align="center"/>
31873 <colspec colwidth="6*" align="right"/>
31874 <tbody>
31875 <row>
31876 <entry><option>recipients_max_reject</option></entry>
31877 <entry>Use: <emphasis>main</emphasis></entry>
31878 <entry>Type: <emphasis>boolean</emphasis></entry>
31879 <entry>Default: <emphasis>false</emphasis></entry>
31880 </row>
31881 </tbody>
31882 </tgroup>
31883 </informaltable>
31884 <para>
31885 If this option is set true, Exim rejects SMTP messages containing too many
31886 recipients by giving 552 errors to the surplus RCPT commands, and a 554
31887 error to the eventual DATA command. Otherwise (the default) it gives a 452
31888 error to the surplus RCPT commands and accepts the message on behalf of the
31889 initial set of recipients. The remote server should then re-send the message
31890 for the remaining recipients at a later time.
31891 </para>
31892 <para>
31893 <indexterm role="option">
31894 <primary><option>remote_max_parallel</option></primary>
31895 </indexterm>
31896 </para>
31897 <informaltable frame="all">
31898 <tgroup cols="4" colsep="0" rowsep="0">
31899 <colspec colwidth="8*" align="left"/>
31900 <colspec colwidth="6*" align="center"/>
31901 <colspec colwidth="6*" align="center"/>
31902 <colspec colwidth="6*" align="right"/>
31903 <tbody>
31904 <row>
31905 <entry><option>remote_max_parallel</option></entry>
31906 <entry>Use: <emphasis>main</emphasis></entry>
31907 <entry>Type: <emphasis>integer</emphasis></entry>
31908 <entry>Default: <emphasis>2</emphasis></entry>
31909 </row>
31910 </tbody>
31911 </tgroup>
31912 </informaltable>
31913 <para>
31914 <indexterm role="concept">
31915 <primary>delivery</primary>
31916 <secondary>parallelism for remote</secondary>
31917 </indexterm>
31918 This option controls parallel delivery of one message to a number of remote
31919 hosts. If the value is less than 2, parallel delivery is disabled, and Exim
31920 does all the remote deliveries for a message one by one. Otherwise, if a single
31921 message has to be delivered to more than one remote host, or if several copies
31922 have to be sent to the same remote host, up to <option>remote_max_parallel</option>
31923 deliveries are done simultaneously. If more than <option>remote_max_parallel</option>
31924 deliveries are required, the maximum number of processes are started, and as
31925 each one finishes, another is begun. The order of starting processes is the
31926 same as if sequential delivery were being done, and can be controlled by the
31927 <option>remote_sort_domains</option> option. If parallel delivery takes place while running
31928 with debugging turned on, the debugging output from each delivery process is
31929 tagged with its process id.
31930 </para>
31931 <para>
31932 This option controls only the maximum number of parallel deliveries for one
31933 message in one Exim delivery process. Because Exim has no central queue
31934 manager, there is no way of controlling the total number of simultaneous
31935 deliveries if the configuration allows a delivery attempt as soon as a message
31936 is received.
31937 </para>
31938 <para>
31939 See also the <option>max_parallel</option> generic transport option,
31940 and the <option>serialize_hosts</option> smtp transport option.
31941 </para>
31942 <para>
31943 <indexterm role="concept">
31944 <primary>number of deliveries</primary>
31945 </indexterm>
31946 <indexterm role="concept">
31947 <primary>delivery</primary>
31948 <secondary>maximum number of</secondary>
31949 </indexterm>
31950 If you want to control the total number of deliveries on the system, you
31951 need to set the <option>queue_only</option> option. This ensures that all incoming messages
31952 are added to the queue without starting a delivery process. Then set up an Exim
31953 daemon to start queue runner processes at appropriate intervals (probably
31954 fairly often, for example, every minute), and limit the total number of queue
31955 runners by setting the <option>queue_run_max</option> parameter. Because each queue runner
31956 delivers only one message at a time, the maximum number of deliveries that can
31957 then take place at once is <option>queue_run_max</option> multiplied by
31958 <option>remote_max_parallel</option>.
31959 </para>
31960 <para>
31961 If it is purely remote deliveries you want to control, use
31962 <option>queue_smtp_domains</option> instead of <option>queue_only</option>. This has the added benefit of
31963 doing the SMTP routing before queueing, so that several messages for the same
31964 host will eventually get delivered down the same connection.
31965 </para>
31966 <para>
31967 <indexterm role="option">
31968 <primary><option>remote_sort_domains</option></primary>
31969 </indexterm>
31970 </para>
31971 <informaltable frame="all">
31972 <tgroup cols="4" colsep="0" rowsep="0">
31973 <colspec colwidth="8*" align="left"/>
31974 <colspec colwidth="6*" align="center"/>
31975 <colspec colwidth="6*" align="center"/>
31976 <colspec colwidth="6*" align="right"/>
31977 <tbody>
31978 <row>
31979 <entry><option>remote_sort_domains</option></entry>
31980 <entry>Use: <emphasis>main</emphasis></entry>
31981 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
31982 <entry>Default: <emphasis>unset</emphasis></entry>
31983 </row>
31984 </tbody>
31985 </tgroup>
31986 </informaltable>
31987 <para>
31988 <indexterm role="concept">
31989 <primary>sorting remote deliveries</primary>
31990 </indexterm>
31991 <indexterm role="concept">
31992 <primary>delivery</primary>
31993 <secondary>sorting remote</secondary>
31994 </indexterm>
31995 When there are a number of remote deliveries for a message, they are sorted by
31996 domain into the order given by this list. For example,
31997 </para>
31998 <literallayout class="monospaced">
31999 remote_sort_domains = *.cam.ac.uk:*.uk
32000 </literallayout>
32001 <para>
32002 would attempt to deliver to all addresses in the <emphasis>cam.ac.uk</emphasis> domain first,
32003 then to those in the <option>uk</option> domain, then to any others.
32004 </para>
32005 <para>
32006 <indexterm role="option">
32007 <primary><option>retry_data_expire</option></primary>
32008 </indexterm>
32009 </para>
32010 <informaltable frame="all">
32011 <tgroup cols="4" colsep="0" rowsep="0">
32012 <colspec colwidth="8*" align="left"/>
32013 <colspec colwidth="6*" align="center"/>
32014 <colspec colwidth="6*" align="center"/>
32015 <colspec colwidth="6*" align="right"/>
32016 <tbody>
32017 <row>
32018 <entry><option>retry_data_expire</option></entry>
32019 <entry>Use: <emphasis>main</emphasis></entry>
32020 <entry>Type: <emphasis>time</emphasis></entry>
32021 <entry>Default: <emphasis>7d</emphasis></entry>
32022 </row>
32023 </tbody>
32024 </tgroup>
32025 </informaltable>
32026 <para>
32027 <indexterm role="concept">
32028 <primary>hints database</primary>
32029 <secondary>data expiry</secondary>
32030 </indexterm>
32031 This option sets a <quote>use before</quote> time on retry information in Exim&#x2019;s hints
32032 database. Any older retry data is ignored. This means that, for example, once a
32033 host has not been tried for 7 days, Exim behaves as if it has no knowledge of
32034 past failures.
32035 </para>
32036 <para>
32037 <indexterm role="option">
32038 <primary><option>retry_interval_max</option></primary>
32039 </indexterm>
32040 </para>
32041 <informaltable frame="all">
32042 <tgroup cols="4" colsep="0" rowsep="0">
32043 <colspec colwidth="8*" align="left"/>
32044 <colspec colwidth="6*" align="center"/>
32045 <colspec colwidth="6*" align="center"/>
32046 <colspec colwidth="6*" align="right"/>
32047 <tbody>
32048 <row>
32049 <entry><option>retry_interval_max</option></entry>
32050 <entry>Use: <emphasis>main</emphasis></entry>
32051 <entry>Type: <emphasis>time</emphasis></entry>
32052 <entry>Default: <emphasis>24h</emphasis></entry>
32053 </row>
32054 </tbody>
32055 </tgroup>
32056 </informaltable>
32057 <para>
32058 <indexterm role="concept">
32059 <primary>retry</primary>
32060 <secondary>limit on interval</secondary>
32061 </indexterm>
32062 <indexterm role="concept">
32063 <primary>limit</primary>
32064 <secondary>on retry interval</secondary>
32065 </indexterm>
32066 Chapter <xref linkend="CHAPretry"/> describes Exim&#x2019;s mechanisms for controlling the
32067 intervals between delivery attempts for messages that cannot be delivered
32068 straight away. This option sets an overall limit to the length of time between
32069 retries. It cannot be set greater than 24 hours; any attempt to do so forces
32070 the default value.
32071 </para>
32072 <para>
32073 <indexterm role="option">
32074 <primary><option>return_path_remove</option></primary>
32075 </indexterm>
32076 </para>
32077 <informaltable frame="all">
32078 <tgroup cols="4" colsep="0" rowsep="0">
32079 <colspec colwidth="8*" align="left"/>
32080 <colspec colwidth="6*" align="center"/>
32081 <colspec colwidth="6*" align="center"/>
32082 <colspec colwidth="6*" align="right"/>
32083 <tbody>
32084 <row>
32085 <entry><option>return_path_remove</option></entry>
32086 <entry>Use: <emphasis>main</emphasis></entry>
32087 <entry>Type: <emphasis>boolean</emphasis></entry>
32088 <entry>Default: <emphasis>true</emphasis></entry>
32089 </row>
32090 </tbody>
32091 </tgroup>
32092 </informaltable>
32093 <para>
32094 <indexterm role="concept">
32095 <primary><emphasis>Return-path:</emphasis> header line</primary>
32096 <secondary>removing</secondary>
32097 </indexterm>
32098 RFC 2821, section 4.4, states that an SMTP server must insert a
32099 <emphasis>Return-path:</emphasis> header line into a message when it makes a <quote>final delivery</quote>.
32100 The <emphasis>Return-path:</emphasis> header preserves the sender address as received in the
32101 MAIL command. This description implies that this header should not be present
32102 in an incoming message. If <option>return_path_remove</option> is true, any existing
32103 <emphasis>Return-path:</emphasis> headers are removed from messages at the time they are
32104 received. Exim&#x2019;s transports have options for adding <emphasis>Return-path:</emphasis> headers at
32105 the time of delivery. They are normally used only for final local deliveries.
32106 </para>
32107 <para>
32108 <indexterm role="option">
32109 <primary><option>return_size_limit</option></primary>
32110 </indexterm>
32111 </para>
32112 <informaltable frame="all">
32113 <tgroup cols="4" colsep="0" rowsep="0">
32114 <colspec colwidth="8*" align="left"/>
32115 <colspec colwidth="6*" align="center"/>
32116 <colspec colwidth="6*" align="center"/>
32117 <colspec colwidth="6*" align="right"/>
32118 <tbody>
32119 <row>
32120 <entry><option>return_size_limit</option></entry>
32121 <entry>Use: <emphasis>main</emphasis></entry>
32122 <entry>Type: <emphasis>integer</emphasis></entry>
32123 <entry>Default: <emphasis>100K</emphasis></entry>
32124 </row>
32125 </tbody>
32126 </tgroup>
32127 </informaltable>
32128 <para>
32129 This option is an obsolete synonym for <option>bounce_return_size_limit</option>.
32130 </para>
32131 <para>
32132 <indexterm role="option">
32133 <primary><option>rfc1413_hosts</option></primary>
32134 </indexterm>
32135 </para>
32136 <informaltable frame="all">
32137 <tgroup cols="4" colsep="0" rowsep="0">
32138 <colspec colwidth="8*" align="left"/>
32139 <colspec colwidth="6*" align="center"/>
32140 <colspec colwidth="6*" align="center"/>
32141 <colspec colwidth="6*" align="right"/>
32142 <tbody>
32143 <row>
32144 <entry><option>rfc1413_hosts</option></entry>
32145 <entry>Use: <emphasis>main</emphasis></entry>
32146 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32147 <entry>Default: <emphasis>@[]</emphasis></entry>
32148 </row>
32149 </tbody>
32150 </tgroup>
32151 </informaltable>
32152 <para>
32153 <indexterm role="concept">
32154 <primary>RFC 1413</primary>
32155 </indexterm>
32156 <indexterm role="concept">
32157 <primary>host</primary>
32158 <secondary>for RFC 1413 calls</secondary>
32159 </indexterm>
32160 RFC 1413 identification calls are made to any client host which matches
32161 an item in the list.
32162 The default value specifies just this host, being any local interface
32163 for the system.
32164 </para>
32165 <para>
32166 <indexterm role="option">
32167 <primary><option>rfc1413_query_timeout</option></primary>
32168 </indexterm>
32169 </para>
32170 <informaltable frame="all">
32171 <tgroup cols="4" colsep="0" rowsep="0">
32172 <colspec colwidth="8*" align="left"/>
32173 <colspec colwidth="6*" align="center"/>
32174 <colspec colwidth="6*" align="center"/>
32175 <colspec colwidth="6*" align="right"/>
32176 <tbody>
32177 <row>
32178 <entry><option>rfc1413_query_timeout</option></entry>
32179 <entry>Use: <emphasis>main</emphasis></entry>
32180 <entry>Type: <emphasis>time</emphasis></entry>
32181 <entry>Default: <emphasis>0s</emphasis></entry>
32182 </row>
32183 </tbody>
32184 </tgroup>
32185 </informaltable>
32186 <para>
32187 <indexterm role="concept">
32188 <primary>RFC 1413</primary>
32189 <secondary>query timeout</secondary>
32190 </indexterm>
32191 <indexterm role="concept">
32192 <primary>timeout</primary>
32193 <secondary>for RFC 1413 call</secondary>
32194 </indexterm>
32195 This sets the timeout on RFC 1413 identification calls. If it is set to zero,
32196 no RFC 1413 calls are ever made.
32197 </para>
32198 <para>
32199 <indexterm role="option">
32200 <primary><option>sender_unqualified_hosts</option></primary>
32201 </indexterm>
32202 </para>
32203 <informaltable frame="all">
32204 <tgroup cols="4" colsep="0" rowsep="0">
32205 <colspec colwidth="8*" align="left"/>
32206 <colspec colwidth="6*" align="center"/>
32207 <colspec colwidth="6*" align="center"/>
32208 <colspec colwidth="6*" align="right"/>
32209 <tbody>
32210 <row>
32211 <entry><option>sender_unqualified_hosts</option></entry>
32212 <entry>Use: <emphasis>main</emphasis></entry>
32213 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32214 <entry>Default: <emphasis>unset</emphasis></entry>
32215 </row>
32216 </tbody>
32217 </tgroup>
32218 </informaltable>
32219 <para>
32220 <indexterm role="concept">
32221 <primary>unqualified addresses</primary>
32222 </indexterm>
32223 <indexterm role="concept">
32224 <primary>host</primary>
32225 <secondary>unqualified addresses from</secondary>
32226 </indexterm>
32227 This option lists those hosts from which Exim is prepared to accept unqualified
32228 sender addresses. The addresses are made fully qualified by the addition of
32229 <option>qualify_domain</option>. This option also affects message header lines. Exim does
32230 not reject unqualified addresses in headers that contain sender addresses, but
32231 it qualifies them only if the message came from a host that matches
32232 <option>sender_unqualified_hosts</option>, or if the message was submitted locally (not
32233 using TCP/IP), and the <option>-bnq</option> option was not set.
32234 </para>
32235 <para>
32236 <indexterm role="option">
32237 <primary><option>slow_lookup_log</option></primary>
32238 </indexterm>
32239 </para>
32240 <informaltable frame="all">
32241 <tgroup cols="4" colsep="0" rowsep="0">
32242 <colspec colwidth="8*" align="left"/>
32243 <colspec colwidth="6*" align="center"/>
32244 <colspec colwidth="6*" align="center"/>
32245 <colspec colwidth="6*" align="right"/>
32246 <tbody>
32247 <row>
32248 <entry><option>slow_lookup_log</option></entry>
32249 <entry>Use: <emphasis>main</emphasis></entry>
32250 <entry>Type: <emphasis>integer</emphasis></entry>
32251 <entry>Default: <emphasis>0</emphasis></entry>
32252 </row>
32253 </tbody>
32254 </tgroup>
32255 </informaltable>
32256 <para>
32257 <indexterm role="concept">
32258 <primary>logging</primary>
32259 <secondary>slow lookups</secondary>
32260 </indexterm>
32261 <indexterm role="concept">
32262 <primary>dns</primary>
32263 <secondary>logging slow lookups</secondary>
32264 </indexterm>
32265 This option controls logging of slow lookups.
32266 If the value is nonzero it is taken as a number of milliseconds
32267 and lookups taking longer than this are logged.
32268 Currently this applies only to DNS lookups.
32269 </para>
32270 <para>
32271 <indexterm role="option">
32272 <primary><option>smtp_accept_keepalive</option></primary>
32273 </indexterm>
32274 </para>
32275 <informaltable frame="all">
32276 <tgroup cols="4" colsep="0" rowsep="0">
32277 <colspec colwidth="8*" align="left"/>
32278 <colspec colwidth="6*" align="center"/>
32279 <colspec colwidth="6*" align="center"/>
32280 <colspec colwidth="6*" align="right"/>
32281 <tbody>
32282 <row>
32283 <entry><option>smtp_accept_keepalive</option></entry>
32284 <entry>Use: <emphasis>main</emphasis></entry>
32285 <entry>Type: <emphasis>boolean</emphasis></entry>
32286 <entry>Default: <emphasis>true</emphasis></entry>
32287 </row>
32288 </tbody>
32289 </tgroup>
32290 </informaltable>
32291 <para>
32292 <indexterm role="concept">
32293 <primary>keepalive</primary>
32294 <secondary>on incoming connection</secondary>
32295 </indexterm>
32296 This option controls the setting of the SO_KEEPALIVE option on incoming
32297 TCP/IP socket connections. When set, it causes the kernel to probe idle
32298 connections periodically, by sending packets with <quote>old</quote> sequence numbers. The
32299 other end of the connection should send an acknowledgment if the connection is
32300 still okay or a reset if the connection has been aborted. The reason for doing
32301 this is that it has the beneficial effect of freeing up certain types of
32302 connection that can get stuck when the remote host is disconnected without
32303 tidying up the TCP/IP call properly. The keepalive mechanism takes several
32304 hours to detect unreachable hosts.
32305 </para>
32306 <para>
32307 <indexterm role="option">
32308 <primary><option>smtp_accept_max</option></primary>
32309 </indexterm>
32310 </para>
32311 <informaltable frame="all">
32312 <tgroup cols="4" colsep="0" rowsep="0">
32313 <colspec colwidth="8*" align="left"/>
32314 <colspec colwidth="6*" align="center"/>
32315 <colspec colwidth="6*" align="center"/>
32316 <colspec colwidth="6*" align="right"/>
32317 <tbody>
32318 <row>
32319 <entry><option>smtp_accept_max</option></entry>
32320 <entry>Use: <emphasis>main</emphasis></entry>
32321 <entry>Type: <emphasis>integer</emphasis></entry>
32322 <entry>Default: <emphasis>20</emphasis></entry>
32323 </row>
32324 </tbody>
32325 </tgroup>
32326 </informaltable>
32327 <para>
32328 <indexterm role="concept">
32329 <primary>limit</primary>
32330 <secondary>incoming SMTP connections</secondary>
32331 </indexterm>
32332 <indexterm role="concept">
32333 <primary>SMTP</primary>
32334 <secondary>incoming connection count</secondary>
32335 </indexterm>
32336 <indexterm role="concept">
32337 <primary>inetd</primary>
32338 </indexterm>
32339 This option specifies the maximum number of simultaneous incoming SMTP calls
32340 that Exim will accept. It applies only to the listening daemon; there is no
32341 control (in Exim) when incoming SMTP is being handled by <emphasis>inetd</emphasis>. If the
32342 value is set to zero, no limit is applied. However, it is required to be
32343 non-zero if either <option>smtp_accept_max_per_host</option> or <option>smtp_accept_queue</option> is
32344 set. See also <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option>.
32345 </para>
32346 <para>
32347 A new SMTP connection is immediately rejected if the <option>smtp_accept_max</option> limit
32348 has been reached. If not, Exim first checks <option>smtp_accept_max_per_host</option>. If
32349 that limit has not been reached for the client host, <option>smtp_accept_reserve</option>
32350 and <option>smtp_load_reserve</option> are then checked before accepting the connection.
32351 </para>
32352 <para>
32353 <indexterm role="option">
32354 <primary><option>smtp_accept_max_nonmail</option></primary>
32355 </indexterm>
32356 </para>
32357 <informaltable frame="all">
32358 <tgroup cols="4" colsep="0" rowsep="0">
32359 <colspec colwidth="8*" align="left"/>
32360 <colspec colwidth="6*" align="center"/>
32361 <colspec colwidth="6*" align="center"/>
32362 <colspec colwidth="6*" align="right"/>
32363 <tbody>
32364 <row>
32365 <entry><option>smtp_accept_max_nonmail</option></entry>
32366 <entry>Use: <emphasis>main</emphasis></entry>
32367 <entry>Type: <emphasis>integer</emphasis></entry>
32368 <entry>Default: <emphasis>10</emphasis></entry>
32369 </row>
32370 </tbody>
32371 </tgroup>
32372 </informaltable>
32373 <para>
32374 <indexterm role="concept">
32375 <primary>limit</primary>
32376 <secondary>non-mail SMTP commands</secondary>
32377 </indexterm>
32378 <indexterm role="concept">
32379 <primary>SMTP</primary>
32380 <secondary>limiting non-mail commands</secondary>
32381 </indexterm>
32382 Exim counts the number of <quote>non-mail</quote> commands in an SMTP session, and drops
32383 the connection if there are too many. This option defines <quote>too many</quote>. The
32384 check catches some denial-of-service attacks, repeated failing AUTHs, or a mad
32385 client looping sending EHLO, for example. The check is applied only if the
32386 client host matches <option>smtp_accept_max_nonmail_hosts</option>.
32387 </para>
32388 <para>
32389 When a new message is expected, one occurrence of RSET is not counted. This
32390 allows a client to send one RSET between messages (this is not necessary,
32391 but some clients do it). Exim also allows one uncounted occurrence of HELO
32392 or EHLO, and one occurrence of STARTTLS between messages. After
32393 starting up a TLS session, another EHLO is expected, and so it too is not
32394 counted. The first occurrence of AUTH in a connection, or immediately
32395 following STARTTLS is not counted. Otherwise, all commands other than
32396 MAIL, RCPT, DATA, and QUIT are counted.
32397 </para>
32398 <para>
32399 <indexterm role="option">
32400 <primary><option>smtp_accept_max_nonmail_hosts</option></primary>
32401 </indexterm>
32402 </para>
32403 <informaltable frame="all">
32404 <tgroup cols="4" colsep="0" rowsep="0">
32405 <colspec colwidth="8*" align="left"/>
32406 <colspec colwidth="6*" align="center"/>
32407 <colspec colwidth="6*" align="center"/>
32408 <colspec colwidth="6*" align="right"/>
32409 <tbody>
32410 <row>
32411 <entry><option>smtp_accept_max_nonmail_hosts</option></entry>
32412 <entry>Use: <emphasis>main</emphasis></entry>
32413 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
32414 <entry>Default: <emphasis>*</emphasis></entry>
32415 </row>
32416 </tbody>
32417 </tgroup>
32418 </informaltable>
32419 <para>
32420 You can control which hosts are subject to the <option>smtp_accept_max_nonmail</option>
32421 check by setting this option. The default value makes it apply to all hosts. By
32422 changing the value, you can exclude any badly-behaved hosts that you have to
32423 live with.
32424 </para>
32425 <para>
32426 <indexterm role="option">
32427 <primary><option>smtp_accept_max_per_connection</option></primary>
32428 </indexterm>
32429 </para>
32430 <informaltable frame="all">
32431 <tgroup cols="4" colsep="0" rowsep="0">
32432 <colspec colwidth="8*" align="left"/>
32433 <colspec colwidth="6*" align="center"/>
32434 <colspec colwidth="6*" align="center"/>
32435 <colspec colwidth="6*" align="right"/>
32436 <tbody>
32437 <row>
32438 <entry><option>smtp_accept_max_per_connection</option></entry>
32439 <entry>Use: <emphasis>main</emphasis></entry>
32440 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
32441 <entry>Default: <emphasis>1000</emphasis></entry>
32442 </row>
32443 </tbody>
32444 </tgroup>
32445 </informaltable>
32446 <para>
32447 <indexterm role="concept">
32448 <primary>SMTP</primary>
32449 <secondary>limiting incoming message count</secondary>
32450 </indexterm>
32451 <indexterm role="concept">
32452 <primary>limit</primary>
32453 <secondary>messages per SMTP connection</secondary>
32454 </indexterm>
32455 The value of this option limits the number of MAIL commands that Exim is
32456 prepared to accept over a single SMTP connection, whether or not each command
32457 results in the transfer of a message. After the limit is reached, a 421
32458 response is given to subsequent MAIL commands. This limit is a safety
32459 precaution against a client that goes mad (incidents of this type have been
32460 seen).
32461 The option is expanded after the HELO or EHLO is received
32462 and may depend on values available at that time.
32463 An empty or zero value after expansion removes the limit.
32464 </para>
32465 <para>
32466 <indexterm role="option">
32467 <primary><option>smtp_accept_max_per_host</option></primary>
32468 </indexterm>
32469 </para>
32470 <informaltable frame="all">
32471 <tgroup cols="4" colsep="0" rowsep="0">
32472 <colspec colwidth="8*" align="left"/>
32473 <colspec colwidth="6*" align="center"/>
32474 <colspec colwidth="6*" align="center"/>
32475 <colspec colwidth="6*" align="right"/>
32476 <tbody>
32477 <row>
32478 <entry><option>smtp_accept_max_per_host</option></entry>
32479 <entry>Use: <emphasis>main</emphasis></entry>
32480 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32481 <entry>Default: <emphasis>unset</emphasis></entry>
32482 </row>
32483 </tbody>
32484 </tgroup>
32485 </informaltable>
32486 <para>
32487 <indexterm role="concept">
32488 <primary>limit</primary>
32489 <secondary>SMTP connections from one host</secondary>
32490 </indexterm>
32491 <indexterm role="concept">
32492 <primary>host</primary>
32493 <secondary>limiting SMTP connections from</secondary>
32494 </indexterm>
32495 This option restricts the number of simultaneous IP connections from a single
32496 host (strictly, from a single IP address) to the Exim daemon. The option is
32497 expanded, to enable different limits to be applied to different hosts by
32498 reference to <varname>$sender_host_address</varname>. Once the limit is reached, additional
32499 connection attempts from the same host are rejected with error code 421. This
32500 is entirely independent of <option>smtp_accept_reserve</option>. The option&#x2019;s default value
32501 of zero imposes no limit. If this option is set greater than zero, it is
32502 required that <option>smtp_accept_max</option> be non-zero.
32503 </para>
32504 <para>
32505 <emphasis role="bold">Warning</emphasis>: When setting this option you should not use any expansion
32506 constructions that take an appreciable amount of time. The expansion and test
32507 happen in the main daemon loop, in order to reject additional connections
32508 without forking additional processes (otherwise a denial-of-service attack
32509 could cause a vast number or processes to be created). While the daemon is
32510 doing this processing, it cannot accept any other incoming connections.
32511 </para>
32512 <para>
32513 <indexterm role="option">
32514 <primary><option>smtp_accept_queue</option></primary>
32515 </indexterm>
32516 </para>
32517 <informaltable frame="all">
32518 <tgroup cols="4" colsep="0" rowsep="0">
32519 <colspec colwidth="8*" align="left"/>
32520 <colspec colwidth="6*" align="center"/>
32521 <colspec colwidth="6*" align="center"/>
32522 <colspec colwidth="6*" align="right"/>
32523 <tbody>
32524 <row>
32525 <entry><option>smtp_accept_queue</option></entry>
32526 <entry>Use: <emphasis>main</emphasis></entry>
32527 <entry>Type: <emphasis>integer</emphasis></entry>
32528 <entry>Default: <emphasis>0</emphasis></entry>
32529 </row>
32530 </tbody>
32531 </tgroup>
32532 </informaltable>
32533 <para>
32534 <indexterm role="concept">
32535 <primary>SMTP</primary>
32536 <secondary>incoming connection count</secondary>
32537 </indexterm>
32538 <indexterm role="concept">
32539 <primary>queueing incoming messages</primary>
32540 </indexterm>
32541 <indexterm role="concept">
32542 <primary>message</primary>
32543 <secondary>queueing by SMTP connection count</secondary>
32544 </indexterm>
32545 If the number of simultaneous incoming SMTP connections being handled via the
32546 listening daemon exceeds this value, messages received by SMTP are just placed
32547 in the queue; no delivery processes are started automatically. The count is
32548 fixed at the start of an SMTP connection. It cannot be updated in the
32549 subprocess that receives messages, and so the queueing or not queueing applies
32550 to all messages received in the same connection.
32551 </para>
32552 <para>
32553 A value of zero implies no limit, and clearly any non-zero value is useful only
32554 if it is less than the <option>smtp_accept_max</option> value (unless that is zero). See
32555 also <option>queue_only</option>, <option>queue_only_load</option>, <option>queue_smtp_domains</option>, and the
32556 various <option>-od</option><emphasis>x</emphasis> command line options.
32557 </para>
32558 <para>
32559 <indexterm role="option">
32560 <primary><option>smtp_accept_queue_per_connection</option></primary>
32561 </indexterm>
32562 </para>
32563 <informaltable frame="all">
32564 <tgroup cols="4" colsep="0" rowsep="0">
32565 <colspec colwidth="8*" align="left"/>
32566 <colspec colwidth="6*" align="center"/>
32567 <colspec colwidth="6*" align="center"/>
32568 <colspec colwidth="6*" align="right"/>
32569 <tbody>
32570 <row>
32571 <entry><option>smtp_accept_queue_per_connection</option></entry>
32572 <entry>Use: <emphasis>main</emphasis></entry>
32573 <entry>Type: <emphasis>integer</emphasis></entry>
32574 <entry>Default: <emphasis>10</emphasis></entry>
32575 </row>
32576 </tbody>
32577 </tgroup>
32578 </informaltable>
32579 <para>
32580 <indexterm role="concept">
32581 <primary>queueing incoming messages</primary>
32582 </indexterm>
32583 <indexterm role="concept">
32584 <primary>message</primary>
32585 <secondary>queueing by message count</secondary>
32586 </indexterm>
32587 This option limits the number of delivery processes that Exim starts
32588 automatically when receiving messages via SMTP, whether via the daemon or by
32589 the use of <option>-bs</option> or <option>-bS</option>. If the value of the option is greater than zero,
32590 and the number of messages received in a single SMTP session exceeds this
32591 number, subsequent messages are placed in the queue, but no delivery processes
32592 are started. This helps to limit the number of Exim processes when a server
32593 restarts after downtime and there is a lot of mail waiting for it on other
32594 systems. On large systems, the default should probably be increased, and on
32595 dial-in client systems it should probably be set to zero (that is, disabled).
32596 </para>
32597 <para>
32598 <indexterm role="option">
32599 <primary><option>smtp_accept_reserve</option></primary>
32600 </indexterm>
32601 </para>
32602 <informaltable frame="all">
32603 <tgroup cols="4" colsep="0" rowsep="0">
32604 <colspec colwidth="8*" align="left"/>
32605 <colspec colwidth="6*" align="center"/>
32606 <colspec colwidth="6*" align="center"/>
32607 <colspec colwidth="6*" align="right"/>
32608 <tbody>
32609 <row>
32610 <entry><option>smtp_accept_reserve</option></entry>
32611 <entry>Use: <emphasis>main</emphasis></entry>
32612 <entry>Type: <emphasis>integer</emphasis></entry>
32613 <entry>Default: <emphasis>0</emphasis></entry>
32614 </row>
32615 </tbody>
32616 </tgroup>
32617 </informaltable>
32618 <para>
32619 <indexterm role="concept">
32620 <primary>SMTP</primary>
32621 <secondary>incoming call count</secondary>
32622 </indexterm>
32623 <indexterm role="concept">
32624 <primary>host</primary>
32625 <secondary>reserved</secondary>
32626 </indexterm>
32627 When <option>smtp_accept_max</option> is set greater than zero, this option specifies a
32628 number of SMTP connections that are reserved for connections from the hosts
32629 that are specified in <option>smtp_reserve_hosts</option>. The value set in
32630 <option>smtp_accept_max</option> includes this reserve pool. The specified hosts are not
32631 restricted to this number of connections; the option specifies a minimum number
32632 of connection slots for them, not a maximum. It is a guarantee that this group
32633 of hosts can always get at least <option>smtp_accept_reserve</option> connections. However,
32634 the limit specified by <option>smtp_accept_max_per_host</option> is still applied to each
32635 individual host.
32636 </para>
32637 <para>
32638 For example, if <option>smtp_accept_max</option> is set to 50 and <option>smtp_accept_reserve</option> is
32639 set to 5, once there are 45 active connections (from any hosts), new
32640 connections are accepted only from hosts listed in <option>smtp_reserve_hosts</option>,
32641 provided the other criteria for acceptance are met.
32642 </para>
32643 <para>
32644 <indexterm role="option">
32645 <primary><option>smtp_active_hostname</option></primary>
32646 </indexterm>
32647 </para>
32648 <informaltable frame="all">
32649 <tgroup cols="4" colsep="0" rowsep="0">
32650 <colspec colwidth="8*" align="left"/>
32651 <colspec colwidth="6*" align="center"/>
32652 <colspec colwidth="6*" align="center"/>
32653 <colspec colwidth="6*" align="right"/>
32654 <tbody>
32655 <row>
32656 <entry><option>smtp_active_hostname</option></entry>
32657 <entry>Use: <emphasis>main</emphasis></entry>
32658 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32659 <entry>Default: <emphasis>unset</emphasis></entry>
32660 </row>
32661 </tbody>
32662 </tgroup>
32663 </informaltable>
32664 <para>
32665 <indexterm role="concept">
32666 <primary>host</primary>
32667 <secondary>name in SMTP responses</secondary>
32668 </indexterm>
32669 <indexterm role="concept">
32670 <primary>SMTP</primary>
32671 <secondary>host name in responses</secondary>
32672 </indexterm>
32673 <indexterm role="variable">
32674 <primary><varname>$primary_hostname</varname></primary>
32675 </indexterm>
32676 This option is provided for multi-homed servers that want to masquerade as
32677 several different hosts. At the start of an incoming SMTP connection, its value
32678 is expanded and used instead of the value of <varname>$primary_hostname</varname> in SMTP
32679 responses. For example, it is used as domain name in the response to an
32680 incoming HELO or EHLO command.
32681 </para>
32682 <para>
32683 <indexterm role="variable">
32684 <primary><varname>$smtp_active_hostname</varname></primary>
32685 </indexterm>
32686 The active hostname is placed in the <varname>$smtp_active_hostname</varname> variable, which
32687 is saved with any messages that are received. It is therefore available for use
32688 in routers and transports when the message is later delivered.
32689 </para>
32690 <para>
32691 If this option is unset, or if its expansion is forced to fail, or if the
32692 expansion results in an empty string, the value of <varname>$primary_hostname</varname> is
32693 used. Other expansion failures cause a message to be written to the main and
32694 panic logs, and the SMTP command receives a temporary error. Typically, the
32695 value of <option>smtp_active_hostname</option> depends on the incoming interface address.
32696 For example:
32697 </para>
32698 <literallayout class="monospaced">
32699 smtp_active_hostname = ${if eq{$received_ip_address}{10.0.0.1}\
32700   {cox.mydomain}{box.mydomain}}
32701 </literallayout>
32702 <para>
32703 Although <varname>$smtp_active_hostname</varname> is primarily concerned with incoming
32704 messages, it is also used as the default for HELO commands in callout
32705 verification if there is no remote transport from which to obtain a
32706 <option>helo_data</option> value.
32707 </para>
32708 <para>
32709 <indexterm role="option">
32710 <primary><option>smtp_backlog_monitor</option></primary>
32711 </indexterm>
32712 </para>
32713 <informaltable frame="all">
32714 <tgroup cols="4" colsep="0" rowsep="0">
32715 <colspec colwidth="8*" align="left"/>
32716 <colspec colwidth="6*" align="center"/>
32717 <colspec colwidth="6*" align="center"/>
32718 <colspec colwidth="6*" align="right"/>
32719 <tbody>
32720 <row>
32721 <entry><option>smtp_backlog_monitor</option></entry>
32722 <entry>Use: <emphasis>main</emphasis></entry>
32723 <entry>Type: <emphasis>integer</emphasis></entry>
32724 <entry>Default: <emphasis>0</emphasis></entry>
32725 </row>
32726 </tbody>
32727 </tgroup>
32728 </informaltable>
32729 <para>
32730 <indexterm role="concept">
32731 <primary>connection backlog</primary>
32732 <secondary>monitoring</secondary>
32733 </indexterm>
32734 If this option is set to greater than zero, and the backlog of available
32735 TCP connections on a socket listening for SMTP is larger than it, a line
32736 is logged giving the value and the socket address and port.
32737 The value is retrived jsut before an accept call.
32738 This facility is only available on Linux.
32739 </para>
32740 <para>
32741 <indexterm role="option">
32742 <primary><option>smtp_banner</option></primary>
32743 </indexterm>
32744 </para>
32745 <informaltable frame="all">
32746 <tgroup cols="4" colsep="0" rowsep="0">
32747 <colspec colwidth="8*" align="left"/>
32748 <colspec colwidth="6*" align="center"/>
32749 <colspec colwidth="6*" align="center"/>
32750 <colspec colwidth="6*" align="right"/>
32751 <tbody>
32752 <row>
32753 <entry><option>smtp_banner</option></entry>
32754 <entry>Use: <emphasis>main</emphasis></entry>
32755 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32756 <entry>Default: <emphasis>see below</emphasis></entry>
32757 </row>
32758 </tbody>
32759 </tgroup>
32760 </informaltable>
32761 <para>
32762 <indexterm role="concept">
32763 <primary>SMTP</primary>
32764 <secondary>welcome banner</secondary>
32765 </indexterm>
32766 <indexterm role="concept">
32767 <primary>banner for SMTP</primary>
32768 </indexterm>
32769 <indexterm role="concept">
32770 <primary>welcome banner for SMTP</primary>
32771 </indexterm>
32772 <indexterm role="concept">
32773 <primary>customizing</primary>
32774 <secondary>SMTP banner</secondary>
32775 </indexterm>
32776 This string, which is expanded every time it is used, is output as the initial
32777 positive response to an SMTP connection. The default setting is:
32778 </para>
32779 <literallayout class="monospaced">
32780 smtp_banner = $smtp_active_hostname ESMTP Exim \
32781   $version_number $tod_full
32782 </literallayout>
32783 <para>
32784 Failure to expand the string causes a panic error. If you want to create a
32785 multiline response to the initial SMTP connection, use <quote>\n</quote> in the string at
32786 appropriate points, but not at the end. Note that the 220 code is not included
32787 in this string. Exim adds it automatically (several times in the case of a
32788 multiline response).
32789 </para>
32790 <para>
32791 <indexterm role="option">
32792 <primary><option>smtp_check_spool_space</option></primary>
32793 </indexterm>
32794 </para>
32795 <informaltable frame="all">
32796 <tgroup cols="4" colsep="0" rowsep="0">
32797 <colspec colwidth="8*" align="left"/>
32798 <colspec colwidth="6*" align="center"/>
32799 <colspec colwidth="6*" align="center"/>
32800 <colspec colwidth="6*" align="right"/>
32801 <tbody>
32802 <row>
32803 <entry><option>smtp_check_spool_space</option></entry>
32804 <entry>Use: <emphasis>main</emphasis></entry>
32805 <entry>Type: <emphasis>boolean</emphasis></entry>
32806 <entry>Default: <emphasis>true</emphasis></entry>
32807 </row>
32808 </tbody>
32809 </tgroup>
32810 </informaltable>
32811 <para>
32812 <indexterm role="concept">
32813 <primary>checking disk space</primary>
32814 </indexterm>
32815 <indexterm role="concept">
32816 <primary>disk space, checking</primary>
32817 </indexterm>
32818 <indexterm role="concept">
32819 <primary>spool directory</primary>
32820 <secondary>checking space</secondary>
32821 </indexterm>
32822 When this option is set, if an incoming SMTP session encounters the SIZE
32823 option on a MAIL command, it checks that there is enough space in the
32824 spool directory&#x2019;s partition to accept a message of that size, while still
32825 leaving free the amount specified by <option>check_spool_space</option> (even if that value
32826 is zero). If there isn&#x2019;t enough space, a temporary error code is returned.
32827 </para>
32828 <para>
32829 <indexterm role="option">
32830 <primary><option>smtp_connect_backlog</option></primary>
32831 </indexterm>
32832 </para>
32833 <informaltable frame="all">
32834 <tgroup cols="4" colsep="0" rowsep="0">
32835 <colspec colwidth="8*" align="left"/>
32836 <colspec colwidth="6*" align="center"/>
32837 <colspec colwidth="6*" align="center"/>
32838 <colspec colwidth="6*" align="right"/>
32839 <tbody>
32840 <row>
32841 <entry><option>smtp_connect_backlog</option></entry>
32842 <entry>Use: <emphasis>main</emphasis></entry>
32843 <entry>Type: <emphasis>integer</emphasis></entry>
32844 <entry>Default: <emphasis>20</emphasis></entry>
32845 </row>
32846 </tbody>
32847 </tgroup>
32848 </informaltable>
32849 <para>
32850 <indexterm role="concept">
32851 <primary>connection backlog</primary>
32852 <secondary>set maximum</secondary>
32853 </indexterm>
32854 <indexterm role="concept">
32855 <primary>SMTP</primary>
32856 <secondary>connection backlog</secondary>
32857 </indexterm>
32858 <indexterm role="concept">
32859 <primary>backlog of connections</primary>
32860 </indexterm>
32861 This option specifies a maximum number of waiting SMTP connections. Exim passes
32862 this value to the TCP/IP system when it sets up its listener. Once this number
32863 of connections are waiting for the daemon&#x2019;s attention, subsequent connection
32864 attempts are refused at the TCP/IP level. At least, that is what the manuals
32865 say; in some circumstances such connection attempts have been observed to time
32866 out instead. For large systems it is probably a good idea to increase the
32867 value (to 50, say). It also gives some protection against denial-of-service
32868 attacks by SYN flooding.
32869 </para>
32870 <para>
32871 <indexterm role="option">
32872 <primary><option>smtp_enforce_sync</option></primary>
32873 </indexterm>
32874 </para>
32875 <informaltable frame="all">
32876 <tgroup cols="4" colsep="0" rowsep="0">
32877 <colspec colwidth="8*" align="left"/>
32878 <colspec colwidth="6*" align="center"/>
32879 <colspec colwidth="6*" align="center"/>
32880 <colspec colwidth="6*" align="right"/>
32881 <tbody>
32882 <row>
32883 <entry><option>smtp_enforce_sync</option></entry>
32884 <entry>Use: <emphasis>main</emphasis></entry>
32885 <entry>Type: <emphasis>boolean</emphasis></entry>
32886 <entry>Default: <emphasis>true</emphasis></entry>
32887 </row>
32888 </tbody>
32889 </tgroup>
32890 </informaltable>
32891 <para>
32892 <indexterm role="concept">
32893 <primary>SMTP</primary>
32894 <secondary>synchronization checking</secondary>
32895 </indexterm>
32896 <indexterm role="concept">
32897 <primary>synchronization checking in SMTP</primary>
32898 </indexterm>
32899 The SMTP protocol specification requires the client to wait for a response from
32900 the server at certain points in the dialogue. Without PIPELINING these
32901 synchronization points are after every command; with PIPELINING they are
32902 fewer, but they still exist.
32903 </para>
32904 <para>
32905 Some spamming sites send out a complete set of SMTP commands without waiting
32906 for any response. Exim protects against this by rejecting a message if the
32907 client has sent further input when it should not have. The error response <quote>554
32908 SMTP synchronization error</quote> is sent, and the connection is dropped. Testing
32909 for this error cannot be perfect because of transmission delays (unexpected
32910 input may be on its way but not yet received when Exim checks). However, it
32911 does detect many instances.
32912 </para>
32913 <para>
32914 The check can be globally disabled by setting <option>smtp_enforce_sync</option> false.
32915 If you want to disable the check selectively (for example, only for certain
32916 hosts), you can do so by an appropriate use of a <option>control</option> modifier in an ACL
32917 (see section <xref linkend="SECTcontrols"/>). See also <option>pipelining_advertise_hosts</option>.
32918 </para>
32919 <para>
32920 <indexterm role="option">
32921 <primary><option>smtp_etrn_command</option></primary>
32922 </indexterm>
32923 </para>
32924 <informaltable frame="all">
32925 <tgroup cols="4" colsep="0" rowsep="0">
32926 <colspec colwidth="8*" align="left"/>
32927 <colspec colwidth="6*" align="center"/>
32928 <colspec colwidth="6*" align="center"/>
32929 <colspec colwidth="6*" align="right"/>
32930 <tbody>
32931 <row>
32932 <entry><option>smtp_etrn_command</option></entry>
32933 <entry>Use: <emphasis>main</emphasis></entry>
32934 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
32935 <entry>Default: <emphasis>unset</emphasis></entry>
32936 </row>
32937 </tbody>
32938 </tgroup>
32939 </informaltable>
32940 <para>
32941 <indexterm role="concept">
32942 <primary>ETRN</primary>
32943 <secondary>command to be run</secondary>
32944 </indexterm>
32945 <indexterm role="concept">
32946 <primary>ESMTP extensions</primary>
32947 <secondary>ETRN</secondary>
32948 </indexterm>
32949 <indexterm role="variable">
32950 <primary><varname>$domain</varname></primary>
32951 </indexterm>
32952 If this option is set, the given command is run whenever an SMTP ETRN
32953 command is received from a host that is permitted to issue such commands (see
32954 chapter <xref linkend="CHAPACL"/>). The string is split up into separate arguments which
32955 are independently expanded. The expansion variable <varname>$domain</varname> is set to the
32956 argument of the ETRN command, and no syntax checking is done on it. For
32957 example:
32958 </para>
32959 <literallayout class="monospaced">
32960 smtp_etrn_command = /etc/etrn_command $domain \
32961                     $sender_host_address
32962 </literallayout>
32963 <para>
32964 If the option is not set, the argument for the ETRN command must
32965 be a <emphasis>#</emphasis> followed by an address string.
32966 In this case an <emphasis>exim -R &lt;string&gt;</emphasis> command is used;
32967 if the ETRN ACL has set up a named-queue then <emphasis>-MCG &lt;queue&gt;</emphasis> is appended.
32968 </para>
32969 <para>
32970 A new process is created to run the command, but Exim does not wait for it to
32971 complete. Consequently, its status cannot be checked. If the command cannot be
32972 run, a line is written to the panic log, but the ETRN caller still receives
32973 a 250 success response. Exim is normally running under its own uid when
32974 receiving SMTP, so it is not possible for it to change the uid before running
32975 the command.
32976 </para>
32977 <para>
32978 <indexterm role="option">
32979 <primary><option>smtp_etrn_serialize</option></primary>
32980 </indexterm>
32981 </para>
32982 <informaltable frame="all">
32983 <tgroup cols="4" colsep="0" rowsep="0">
32984 <colspec colwidth="8*" align="left"/>
32985 <colspec colwidth="6*" align="center"/>
32986 <colspec colwidth="6*" align="center"/>
32987 <colspec colwidth="6*" align="right"/>
32988 <tbody>
32989 <row>
32990 <entry><option>smtp_etrn_serialize</option></entry>
32991 <entry>Use: <emphasis>main</emphasis></entry>
32992 <entry>Type: <emphasis>boolean</emphasis></entry>
32993 <entry>Default: <emphasis>true</emphasis></entry>
32994 </row>
32995 </tbody>
32996 </tgroup>
32997 </informaltable>
32998 <para>
32999 <indexterm role="concept">
33000 <primary>ETRN</primary>
33001 <secondary>serializing</secondary>
33002 </indexterm>
33003 When this option is set, it prevents the simultaneous execution of more than
33004 one identical command as a result of ETRN in an SMTP connection. See
33005 section <xref linkend="SECTETRN"/> for details.
33006 </para>
33007 <para>
33008 <indexterm role="option">
33009 <primary><option>smtp_load_reserve</option></primary>
33010 </indexterm>
33011 </para>
33012 <informaltable frame="all">
33013 <tgroup cols="4" colsep="0" rowsep="0">
33014 <colspec colwidth="8*" align="left"/>
33015 <colspec colwidth="6*" align="center"/>
33016 <colspec colwidth="6*" align="center"/>
33017 <colspec colwidth="6*" align="right"/>
33018 <tbody>
33019 <row>
33020 <entry><option>smtp_load_reserve</option></entry>
33021 <entry>Use: <emphasis>main</emphasis></entry>
33022 <entry>Type: <emphasis>fixed-point</emphasis></entry>
33023 <entry>Default: <emphasis>unset</emphasis></entry>
33024 </row>
33025 </tbody>
33026 </tgroup>
33027 </informaltable>
33028 <para>
33029 <indexterm role="concept">
33030 <primary>load average</primary>
33031 </indexterm>
33032 If the system load average ever gets higher than this, incoming SMTP calls are
33033 accepted only from those hosts that match an entry in <option>smtp_reserve_hosts</option>.
33034 If <option>smtp_reserve_hosts</option> is not set, no incoming SMTP calls are accepted when
33035 the load is over the limit. The option has no effect on ancient operating
33036 systems on which Exim cannot determine the load average. See also
33037 <option>deliver_queue_load_max</option> and <option>queue_only_load</option>.
33038 </para>
33039 <para>
33040 <indexterm role="option">
33041 <primary><option>smtp_max_synprot_errors</option></primary>
33042 </indexterm>
33043 </para>
33044 <informaltable frame="all">
33045 <tgroup cols="4" colsep="0" rowsep="0">
33046 <colspec colwidth="8*" align="left"/>
33047 <colspec colwidth="6*" align="center"/>
33048 <colspec colwidth="6*" align="center"/>
33049 <colspec colwidth="6*" align="right"/>
33050 <tbody>
33051 <row>
33052 <entry><option>smtp_max_synprot_errors</option></entry>
33053 <entry>Use: <emphasis>main</emphasis></entry>
33054 <entry>Type: <emphasis>integer</emphasis></entry>
33055 <entry>Default: <emphasis>3</emphasis></entry>
33056 </row>
33057 </tbody>
33058 </tgroup>
33059 </informaltable>
33060 <para>
33061 <indexterm role="concept">
33062 <primary>SMTP</primary>
33063 <secondary>limiting syntax and protocol errors</secondary>
33064 </indexterm>
33065 <indexterm role="concept">
33066 <primary>limit</primary>
33067 <secondary>SMTP syntax and protocol errors</secondary>
33068 </indexterm>
33069 Exim rejects SMTP commands that contain syntax or protocol errors. In
33070 particular, a syntactically invalid email address, as in this command:
33071 </para>
33072 <literallayout class="monospaced">
33073 RCPT TO:&lt;abc xyz@a.b.c&gt;
33074 </literallayout>
33075 <para>
33076 causes immediate rejection of the command, before any other tests are done.
33077 (The ACL cannot be run if there is no valid address to set up for it.) An
33078 example of a protocol error is receiving RCPT before MAIL. If there are
33079 too many syntax or protocol errors in one SMTP session, the connection is
33080 dropped. The limit is set by this option.
33081 </para>
33082 <para>
33083 <indexterm role="concept">
33084 <primary>PIPELINING</primary>
33085 <secondary>expected errors</secondary>
33086 </indexterm>
33087 When the PIPELINING extension to SMTP is in use, some protocol errors are
33088 <quote>expected</quote>, for instance, a RCPT command after a rejected MAIL command.
33089 Exim assumes that PIPELINING will be used if it advertises it (see
33090 <option>pipelining_advertise_hosts</option>), and in this situation, <quote>expected</quote> errors do
33091 not count towards the limit.
33092 </para>
33093 <para>
33094 <indexterm role="option">
33095 <primary><option>smtp_max_unknown_commands</option></primary>
33096 </indexterm>
33097 </para>
33098 <informaltable frame="all">
33099 <tgroup cols="4" colsep="0" rowsep="0">
33100 <colspec colwidth="8*" align="left"/>
33101 <colspec colwidth="6*" align="center"/>
33102 <colspec colwidth="6*" align="center"/>
33103 <colspec colwidth="6*" align="right"/>
33104 <tbody>
33105 <row>
33106 <entry><option>smtp_max_unknown_commands</option></entry>
33107 <entry>Use: <emphasis>main</emphasis></entry>
33108 <entry>Type: <emphasis>integer</emphasis></entry>
33109 <entry>Default: <emphasis>3</emphasis></entry>
33110 </row>
33111 </tbody>
33112 </tgroup>
33113 </informaltable>
33114 <para>
33115 <indexterm role="concept">
33116 <primary>SMTP</primary>
33117 <secondary>limiting unknown commands</secondary>
33118 </indexterm>
33119 <indexterm role="concept">
33120 <primary>limit</primary>
33121 <secondary>unknown SMTP commands</secondary>
33122 </indexterm>
33123 If there are too many unrecognized commands in an incoming SMTP session, an
33124 Exim server drops the connection. This is a defence against some kinds of abuse
33125 that subvert web
33126 clients
33127 into making connections to SMTP ports; in these circumstances, a number of
33128 non-SMTP command lines are sent first.
33129 </para>
33130 <para>
33131 <indexterm role="option">
33132 <primary><option>smtp_ratelimit_hosts</option></primary>
33133 </indexterm>
33134 </para>
33135 <informaltable frame="all">
33136 <tgroup cols="4" colsep="0" rowsep="0">
33137 <colspec colwidth="8*" align="left"/>
33138 <colspec colwidth="6*" align="center"/>
33139 <colspec colwidth="6*" align="center"/>
33140 <colspec colwidth="6*" align="right"/>
33141 <tbody>
33142 <row>
33143 <entry><option>smtp_ratelimit_hosts</option></entry>
33144 <entry>Use: <emphasis>main</emphasis></entry>
33145 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33146 <entry>Default: <emphasis>unset</emphasis></entry>
33147 </row>
33148 </tbody>
33149 </tgroup>
33150 </informaltable>
33151 <para>
33152 <indexterm role="concept">
33153 <primary>SMTP</primary>
33154 <secondary>rate limiting</secondary>
33155 </indexterm>
33156 <indexterm role="concept">
33157 <primary>limit</primary>
33158 <secondary>rate of message arrival</secondary>
33159 </indexterm>
33160 <indexterm role="concept">
33161 <primary>RCPT</primary>
33162 <secondary>rate limiting</secondary>
33163 </indexterm>
33164 Some sites find it helpful to be able to limit the rate at which certain hosts
33165 can send them messages, and the rate at which an individual message can specify
33166 recipients.
33167 </para>
33168 <para>
33169 Exim has two rate-limiting facilities. This section describes the older
33170 facility, which can limit rates within a single connection. The newer
33171 <option>ratelimit</option> ACL condition can limit rates across all connections. See section
33172 <xref linkend="SECTratelimiting"/> for details of the newer facility.
33173 </para>
33174 <para>
33175 When a host matches <option>smtp_ratelimit_hosts</option>, the values of
33176 <option>smtp_ratelimit_mail</option> and <option>smtp_ratelimit_rcpt</option> are used to control the
33177 rate of acceptance of MAIL and RCPT commands in a single SMTP session,
33178 respectively. Each option, if set, must contain a set of four comma-separated
33179 values:
33180 </para>
33181 <itemizedlist>
33182 <listitem>
33183 <para>
33184 A threshold, before which there is no rate limiting.
33185 </para>
33186 </listitem>
33187 <listitem>
33188 <para>
33189 An initial time delay. Unlike other times in Exim, numbers with decimal
33190 fractional parts are allowed here.
33191 </para>
33192 </listitem>
33193 <listitem>
33194 <para>
33195 A factor by which to increase the delay each time.
33196 </para>
33197 </listitem>
33198 <listitem>
33199 <para>
33200 A maximum value for the delay. This should normally be less than 5 minutes,
33201 because after that time, the client is liable to timeout the SMTP command.
33202 </para>
33203 </listitem>
33204 </itemizedlist>
33205 <para>
33206 For example, these settings have been used successfully at the site which
33207 first suggested this feature, for controlling mail from their customers:
33208 </para>
33209 <literallayout class="monospaced">
33210 smtp_ratelimit_mail = 2,0.5s,1.05,4m
33211 smtp_ratelimit_rcpt = 4,0.25s,1.015,4m
33212 </literallayout>
33213 <para>
33214 The first setting specifies delays that are applied to MAIL commands after
33215 two have been received over a single connection. The initial delay is 0.5
33216 seconds, increasing by a factor of 1.05 each time. The second setting applies
33217 delays to RCPT commands when more than four occur in a single message.
33218 </para>
33219 <para>
33220 <indexterm role="option">
33221 <primary><option>smtp_ratelimit_mail</option></primary>
33222 </indexterm>
33223 </para>
33224 <informaltable frame="all">
33225 <tgroup cols="4" colsep="0" rowsep="0">
33226 <colspec colwidth="8*" align="left"/>
33227 <colspec colwidth="6*" align="center"/>
33228 <colspec colwidth="6*" align="center"/>
33229 <colspec colwidth="6*" align="right"/>
33230 <tbody>
33231 <row>
33232 <entry><option>smtp_ratelimit_mail</option></entry>
33233 <entry>Use: <emphasis>main</emphasis></entry>
33234 <entry>Type: <emphasis>string</emphasis></entry>
33235 <entry>Default: <emphasis>unset</emphasis></entry>
33236 </row>
33237 </tbody>
33238 </tgroup>
33239 </informaltable>
33240 <para>
33241 See <option>smtp_ratelimit_hosts</option> above.
33242 </para>
33243 <para>
33244 <indexterm role="option">
33245 <primary><option>smtp_ratelimit_rcpt</option></primary>
33246 </indexterm>
33247 </para>
33248 <informaltable frame="all">
33249 <tgroup cols="4" colsep="0" rowsep="0">
33250 <colspec colwidth="8*" align="left"/>
33251 <colspec colwidth="6*" align="center"/>
33252 <colspec colwidth="6*" align="center"/>
33253 <colspec colwidth="6*" align="right"/>
33254 <tbody>
33255 <row>
33256 <entry><option>smtp_ratelimit_rcpt</option></entry>
33257 <entry>Use: <emphasis>main</emphasis></entry>
33258 <entry>Type: <emphasis>string</emphasis></entry>
33259 <entry>Default: <emphasis>unset</emphasis></entry>
33260 </row>
33261 </tbody>
33262 </tgroup>
33263 </informaltable>
33264 <para>
33265 See <option>smtp_ratelimit_hosts</option> above.
33266 </para>
33267 <para>
33268 <indexterm role="option">
33269 <primary><option>smtp_receive_timeout</option></primary>
33270 </indexterm>
33271 </para>
33272 <informaltable frame="all">
33273 <tgroup cols="4" colsep="0" rowsep="0">
33274 <colspec colwidth="8*" align="left"/>
33275 <colspec colwidth="6*" align="center"/>
33276 <colspec colwidth="6*" align="center"/>
33277 <colspec colwidth="6*" align="right"/>
33278 <tbody>
33279 <row>
33280 <entry><option>smtp_receive_timeout</option></entry>
33281 <entry>Use: <emphasis>main</emphasis></entry>
33282 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
33283 <entry>Default: <emphasis>5m</emphasis></entry>
33284 </row>
33285 </tbody>
33286 </tgroup>
33287 </informaltable>
33288 <para>
33289 <indexterm role="concept">
33290 <primary>timeout</primary>
33291 <secondary>for SMTP input</secondary>
33292 </indexterm>
33293 <indexterm role="concept">
33294 <primary>SMTP</primary>
33295 <secondary>input timeout</secondary>
33296 </indexterm>
33297 This sets a timeout value for SMTP reception. It applies to all forms of SMTP
33298 input, including batch SMTP. If a line of input (either an SMTP command or a
33299 data line) is not received within this time, the SMTP connection is dropped and
33300 the message is abandoned.
33301 A line is written to the log containing one of the following messages:
33302 </para>
33303 <literallayout class="monospaced">
33304 SMTP command timeout on connection from...
33305 SMTP data timeout on connection from...
33306 </literallayout>
33307 <para>
33308 The former means that Exim was expecting to read an SMTP command; the latter
33309 means that it was in the DATA phase, reading the contents of a message.
33310 </para>
33311 <para>
33312 If the first character of the option is a <quote>$</quote> the option is
33313 expanded before use and may depend on
33314 <varname>$sender_host_name</varname>, <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>.
33315 </para>
33316 <para>
33317 <indexterm role="option">
33318 <primary><option>-os</option></primary>
33319 </indexterm>
33320 The value set by this option can be overridden by the
33321 <option>-os</option> command-line option. A setting of zero time disables the timeout, but
33322 this should never be used for SMTP over TCP/IP. (It can be useful in some cases
33323 of local input using <option>-bs</option> or <option>-bS</option>.) For non-SMTP input, the reception
33324 timeout is controlled by <option>receive_timeout</option> and <option>-or</option>.
33325 </para>
33326 <para>
33327 <indexterm role="option">
33328 <primary><option>smtp_reserve_hosts</option></primary>
33329 </indexterm>
33330 </para>
33331 <informaltable frame="all">
33332 <tgroup cols="4" colsep="0" rowsep="0">
33333 <colspec colwidth="8*" align="left"/>
33334 <colspec colwidth="6*" align="center"/>
33335 <colspec colwidth="6*" align="center"/>
33336 <colspec colwidth="6*" align="right"/>
33337 <tbody>
33338 <row>
33339 <entry><option>smtp_reserve_hosts</option></entry>
33340 <entry>Use: <emphasis>main</emphasis></entry>
33341 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33342 <entry>Default: <emphasis>unset</emphasis></entry>
33343 </row>
33344 </tbody>
33345 </tgroup>
33346 </informaltable>
33347 <para>
33348 This option defines hosts for which SMTP connections are reserved; see
33349 <option>smtp_accept_reserve</option> and <option>smtp_load_reserve</option> above.
33350 </para>
33351 <para>
33352 <indexterm role="option">
33353 <primary><option>smtp_return_error_details</option></primary>
33354 </indexterm>
33355 </para>
33356 <informaltable frame="all">
33357 <tgroup cols="4" colsep="0" rowsep="0">
33358 <colspec colwidth="8*" align="left"/>
33359 <colspec colwidth="6*" align="center"/>
33360 <colspec colwidth="6*" align="center"/>
33361 <colspec colwidth="6*" align="right"/>
33362 <tbody>
33363 <row>
33364 <entry><option>smtp_return_error_details</option></entry>
33365 <entry>Use: <emphasis>main</emphasis></entry>
33366 <entry>Type: <emphasis>boolean</emphasis></entry>
33367 <entry>Default: <emphasis>false</emphasis></entry>
33368 </row>
33369 </tbody>
33370 </tgroup>
33371 </informaltable>
33372 <para>
33373 <indexterm role="concept">
33374 <primary>SMTP</primary>
33375 <secondary>details policy failures</secondary>
33376 </indexterm>
33377 <indexterm role="concept">
33378 <primary>policy control</primary>
33379 <secondary>rejection, returning details</secondary>
33380 </indexterm>
33381 In the default state, Exim uses bland messages such as
33382 <quote>Administrative prohibition</quote> when it rejects SMTP commands for policy
33383 reasons. Many sysadmins like this because it gives away little information
33384 to spammers. However, some other sysadmins who are applying strict checking
33385 policies want to give out much fuller information about failures. Setting
33386 <option>smtp_return_error_details</option> true causes Exim to be more forthcoming. For
33387 example, instead of <quote>Administrative prohibition</quote>, it might give:
33388 </para>
33389 <literallayout class="monospaced">
33390 550-Rejected after DATA: '&gt;' missing at end of address:
33391 550 failing address in "From" header is: &lt;user@dom.ain
33392 </literallayout>
33393 <para>
33394 <indexterm role="option">
33395 <primary><option>smtputf8_advertise_hosts</option></primary>
33396 </indexterm>
33397 </para>
33398 <informaltable frame="all">
33399 <tgroup cols="4" colsep="0" rowsep="0">
33400 <colspec colwidth="8*" align="left"/>
33401 <colspec colwidth="6*" align="center"/>
33402 <colspec colwidth="6*" align="center"/>
33403 <colspec colwidth="6*" align="right"/>
33404 <tbody>
33405 <row>
33406 <entry><option>smtputf8_advertise_hosts</option></entry>
33407 <entry>Use: <emphasis>main</emphasis></entry>
33408 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
33409 <entry>Default: <emphasis>*</emphasis></entry>
33410 </row>
33411 </tbody>
33412 </tgroup>
33413 </informaltable>
33414 <para>
33415 <indexterm role="concept">
33416 <primary>SMTPUTF8</primary>
33417 <secondary>ESMTP extension, advertising</secondary>
33418 </indexterm>
33419 <indexterm role="concept">
33420 <primary>ESMTP extensions</primary>
33421 <secondary>SMTPUTF8</secondary>
33422 </indexterm>
33423 When Exim is built with support for internationalised mail names,
33424 the availability thereof is advertised in
33425 response to EHLO only to those client hosts that match this option. See
33426 chapter <xref linkend="CHAPi18n"/> for details of Exim&#x2019;s support for internationalisation.
33427 </para>
33428 <para>
33429 <indexterm role="option">
33430 <primary><option>spamd_address</option></primary>
33431 </indexterm>
33432 </para>
33433 <informaltable frame="all">
33434 <tgroup cols="4" colsep="0" rowsep="0">
33435 <colspec colwidth="8*" align="left"/>
33436 <colspec colwidth="6*" align="center"/>
33437 <colspec colwidth="6*" align="center"/>
33438 <colspec colwidth="6*" align="right"/>
33439 <tbody>
33440 <row>
33441 <entry><option>spamd_address</option></entry>
33442 <entry>Use: <emphasis>main</emphasis></entry>
33443 <entry>Type: <emphasis>string</emphasis></entry>
33444 <entry>Default: <emphasis>127.0.0.1 783</emphasis></entry>
33445 </row>
33446 </tbody>
33447 </tgroup>
33448 </informaltable>
33449 <para>
33450 This option is available when Exim is compiled with the content-scanning
33451 extension. It specifies how Exim connects to SpamAssassin&#x2019;s <option>spamd</option> daemon.
33452 See section <xref linkend="SECTscanspamass"/> for more details.
33453 </para>
33454 <para>
33455 <indexterm role="option">
33456 <primary><option>spf_guess</option></primary>
33457 </indexterm>
33458 </para>
33459 <informaltable frame="all">
33460 <tgroup cols="4" colsep="0" rowsep="0">
33461 <colspec colwidth="8*" align="left"/>
33462 <colspec colwidth="6*" align="center"/>
33463 <colspec colwidth="6*" align="center"/>
33464 <colspec colwidth="6*" align="right"/>
33465 <tbody>
33466 <row>
33467 <entry><option>spf_guess</option></entry>
33468 <entry>Use: <emphasis>main</emphasis></entry>
33469 <entry>Type: <emphasis>string</emphasis></entry>
33470 <entry>Default: <emphasis>v=spf1 a/24 mx/24 ptr ?all</emphasis></entry>
33471 </row>
33472 </tbody>
33473 </tgroup>
33474 </informaltable>
33475 <para>
33476 This option is available when Exim is compiled with SPF support.
33477 See section <xref linkend="SECSPF"/> for more details.
33478 </para>
33479 <para>
33480 <indexterm role="option">
33481 <primary><option>spf_smtp_comment_template</option></primary>
33482 </indexterm>
33483 </para>
33484 <informaltable frame="all">
33485 <tgroup cols="4" colsep="0" rowsep="0">
33486 <colspec colwidth="8*" align="left"/>
33487 <colspec colwidth="6*" align="center"/>
33488 <colspec colwidth="6*" align="center"/>
33489 <colspec colwidth="6*" align="right"/>
33490 <tbody>
33491 <row>
33492 <entry><option>spf_smtp_comment_template</option></entry>
33493 <entry>Use: <emphasis>main</emphasis></entry>
33494 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33495 <entry>Default: <emphasis>Please%_see%_http://www.open-spf.org/Why</emphasis></entry>
33496 </row>
33497 </tbody>
33498 </tgroup>
33499 </informaltable>
33500 <para>
33501 This option is available when Exim is compiled with SPF support.  It
33502 allows the customisation of the SMTP comment that the SPF library
33503 generates.  You are strongly encouraged to link to your own explanative
33504 site. The template must not contain spaces. If you need spaces in the
33505 output, use the proper placeholder. If libspf2 can not parse the
33506 template, it uses a built-in default broken link. The following placeholders
33507 (along with Exim variables (but see below)) are allowed in the template:
33508 </para>
33509 <itemizedlist>
33510 <listitem>
33511 <para>
33512 <emphasis role="bold">%_</emphasis>: A space.
33513 </para>
33514 </listitem>
33515 <listitem>
33516 <para>
33517 <emphasis role="bold">%{L}</emphasis>: Envelope sender&#x2019;s local part.
33518 </para>
33519 </listitem>
33520 <listitem>
33521 <para>
33522 <emphasis role="bold">%{S}</emphasis>: Envelope sender.
33523 </para>
33524 </listitem>
33525 <listitem>
33526 <para>
33527 <emphasis role="bold">%{O}</emphasis>: Envelope sender&#x2019;s domain.
33528 </para>
33529 </listitem>
33530 <listitem>
33531 <para>
33532 <emphasis role="bold">%{D}</emphasis>: Current(?) domain.
33533 </para>
33534 </listitem>
33535 <listitem>
33536 <para>
33537 <emphasis role="bold">%{I}</emphasis>: SMTP client Ip.
33538 </para>
33539 </listitem>
33540 <listitem>
33541 <para>
33542 <emphasis role="bold">%{C}</emphasis>: SMTP client pretty IP.
33543 </para>
33544 </listitem>
33545 <listitem>
33546 <para>
33547 <emphasis role="bold">%{T}</emphasis>: Epoch time (UTC).
33548 </para>
33549 </listitem>
33550 <listitem>
33551 <para>
33552 <emphasis role="bold">%{P}</emphasis>: SMTP client domain name.
33553 </para>
33554 </listitem>
33555 <listitem>
33556 <para>
33557 <emphasis role="bold">%{V}</emphasis>: IP version.
33558 </para>
33559 </listitem>
33560 <listitem>
33561 <para>
33562 <emphasis role="bold">%{H}</emphasis>: EHLO/HELO domain.
33563 </para>
33564 </listitem>
33565 <listitem>
33566 <para>
33567 <emphasis role="bold">%{R}</emphasis>: Receiving domain.
33568 </para>
33569 </listitem>
33570 </itemizedlist>
33571 <para>
33572 The capitalized placeholders do proper URL encoding, if you use them
33573 lowercased, no encoding takes place.  This list was compiled from the
33574 libspf2 sources.
33575 </para>
33576 <para>
33577 A note on using Exim variables: As
33578 currently the SPF library is initialized before the SMTP EHLO phase,
33579 the variables useful for expansion are quite limited.
33580 </para>
33581 <para>
33582 <indexterm role="option">
33583 <primary><option>split_spool_directory</option></primary>
33584 </indexterm>
33585 </para>
33586 <informaltable frame="all">
33587 <tgroup cols="4" colsep="0" rowsep="0">
33588 <colspec colwidth="8*" align="left"/>
33589 <colspec colwidth="6*" align="center"/>
33590 <colspec colwidth="6*" align="center"/>
33591 <colspec colwidth="6*" align="right"/>
33592 <tbody>
33593 <row>
33594 <entry><option>split_spool_directory</option></entry>
33595 <entry>Use: <emphasis>main</emphasis></entry>
33596 <entry>Type: <emphasis>boolean</emphasis></entry>
33597 <entry>Default: <emphasis>false</emphasis></entry>
33598 </row>
33599 </tbody>
33600 </tgroup>
33601 </informaltable>
33602 <para>
33603 <indexterm role="concept">
33604 <primary>multiple spool directories</primary>
33605 </indexterm>
33606 <indexterm role="concept">
33607 <primary>spool directory</primary>
33608 <secondary>split</secondary>
33609 </indexterm>
33610 <indexterm role="concept">
33611 <primary>directories, multiple</primary>
33612 </indexterm>
33613 If this option is set, it causes Exim to split its input directory into 62
33614 subdirectories, each with a single alphanumeric character as its name. The
33615 sixth character of the message id is used to allocate messages to
33616 subdirectories; this is the least significant base-62 digit of the time of
33617 arrival of the message.
33618 </para>
33619 <para>
33620 Splitting up the spool in this way may provide better performance on systems
33621 where there are long mail queues, by reducing the number of files in any one
33622 directory. The msglog directory is also split up in a similar way to the input
33623 directory; however, if <option>preserve_message_logs</option> is set, all old msglog files
33624 are still placed in the single directory <filename>msglog.OLD</filename>.
33625 </para>
33626 <para>
33627 It is not necessary to take any special action for existing messages when
33628 changing <option>split_spool_directory</option>. Exim notices messages that are in the
33629 <quote>wrong</quote> place, and continues to process them. If the option is turned off
33630 after a period of being on, the subdirectories will eventually empty and be
33631 automatically deleted.
33632 </para>
33633 <para>
33634 When <option>split_spool_directory</option> is set, the behaviour of queue runner processes
33635 changes. Instead of creating a list of all messages in the queue, and then
33636 trying to deliver each one, in turn, it constructs a list of those in one
33637 sub-directory and tries to deliver them, before moving on to the next
33638 sub-directory. The sub-directories are processed in a random order. This
33639 spreads out the scanning of the input directories, and uses less memory. It is
33640 particularly beneficial when there are lots of messages in the queue. However,
33641 if <option>queue_run_in_order</option> is set, none of this new processing happens. The
33642 entire queue has to be scanned and sorted before any deliveries can start.
33643 </para>
33644 <para>
33645 <indexterm role="option">
33646 <primary><option>spool_directory</option></primary>
33647 </indexterm>
33648 </para>
33649 <informaltable frame="all">
33650 <tgroup cols="4" colsep="0" rowsep="0">
33651 <colspec colwidth="8*" align="left"/>
33652 <colspec colwidth="6*" align="center"/>
33653 <colspec colwidth="6*" align="center"/>
33654 <colspec colwidth="6*" align="right"/>
33655 <tbody>
33656 <row>
33657 <entry><option>spool_directory</option></entry>
33658 <entry>Use: <emphasis>main</emphasis></entry>
33659 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
33660 <entry>Default: <emphasis>set at compile time</emphasis></entry>
33661 </row>
33662 </tbody>
33663 </tgroup>
33664 </informaltable>
33665 <para>
33666 <indexterm role="concept">
33667 <primary>spool directory</primary>
33668 <secondary>path to</secondary>
33669 </indexterm>
33670 This defines the directory in which Exim keeps its spool, that is, the messages
33671 it is waiting to deliver. The default value is taken from the compile-time
33672 configuration setting, if there is one. If not, this option must be set. The
33673 string is expanded, so it can contain, for example, a reference to
33674 <varname>$primary_hostname</varname>.
33675 </para>
33676 <para>
33677 If the spool directory name is fixed on your installation, it is recommended
33678 that you set it at build time rather than from this option, particularly if the
33679 log files are being written to the spool directory (see <option>log_file_path</option>).
33680 Otherwise log files cannot be used for errors that are detected early on, such
33681 as failures in the configuration file.
33682 </para>
33683 <para>
33684 By using this option to override the compiled-in path, it is possible to run
33685 tests of Exim without using the standard spool.
33686 </para>
33687 <para>
33688 <indexterm role="option">
33689 <primary><option>spool_wireformat</option></primary>
33690 </indexterm>
33691 </para>
33692 <informaltable frame="all">
33693 <tgroup cols="4" colsep="0" rowsep="0">
33694 <colspec colwidth="8*" align="left"/>
33695 <colspec colwidth="6*" align="center"/>
33696 <colspec colwidth="6*" align="center"/>
33697 <colspec colwidth="6*" align="right"/>
33698 <tbody>
33699 <row>
33700 <entry><option>spool_wireformat</option></entry>
33701 <entry>Use: <emphasis>main</emphasis></entry>
33702 <entry>Type: <emphasis>boolean</emphasis></entry>
33703 <entry>Default: <emphasis>false</emphasis></entry>
33704 </row>
33705 </tbody>
33706 </tgroup>
33707 </informaltable>
33708 <para>
33709 <indexterm role="concept">
33710 <primary>spool directory</primary>
33711 <secondary>file formats</secondary>
33712 </indexterm>
33713 If this option is set, Exim may for some messages use an alternative format
33714 for data-files in the spool which matches the wire format.
33715 Doing this permits more efficient message reception and transmission.
33716 Currently it is only done for messages received using the ESMTP CHUNKING
33717 option.
33718 </para>
33719 <para>
33720 The following variables will not have useful values:
33721 </para>
33722 <literallayout class="monospaced">
33723 $max_received_linelength
33724 $body_linecount
33725 $body_zerocount
33726 </literallayout>
33727 <para>
33728 Users of the local_scan() API (see <xref linkend="CHAPlocalscan"/>),
33729 and any external programs which are passed a reference to a message data file
33730 (except via the <quote>regex</quote>, <quote>malware</quote> or <quote>spam</quote>) ACL conditions)
33731 will need to be aware of the different formats potentially available.
33732 </para>
33733 <para>
33734 Using any of the ACL conditions noted will negate the reception benefit
33735 (as a Unix-mbox-format file is constructed for them).
33736 The transmission benefit is maintained.
33737 </para>
33738 <para>
33739 <indexterm role="option">
33740 <primary><option>sqlite_lock_timeout</option></primary>
33741 </indexterm>
33742 </para>
33743 <informaltable frame="all">
33744 <tgroup cols="4" colsep="0" rowsep="0">
33745 <colspec colwidth="8*" align="left"/>
33746 <colspec colwidth="6*" align="center"/>
33747 <colspec colwidth="6*" align="center"/>
33748 <colspec colwidth="6*" align="right"/>
33749 <tbody>
33750 <row>
33751 <entry><option>sqlite_lock_timeout</option></entry>
33752 <entry>Use: <emphasis>main</emphasis></entry>
33753 <entry>Type: <emphasis>time</emphasis></entry>
33754 <entry>Default: <emphasis>5s</emphasis></entry>
33755 </row>
33756 </tbody>
33757 </tgroup>
33758 </informaltable>
33759 <para>
33760 <indexterm role="concept">
33761 <primary>sqlite lookup type</primary>
33762 <secondary>lock timeout</secondary>
33763 </indexterm>
33764 This option controls the timeout that the <command>sqlite</command> lookup uses when trying to
33765 access an SQLite database. See section <xref linkend="SECTsqlite"/> for more details.
33766 </para>
33767 <para>
33768 <indexterm role="option">
33769 <primary><option>strict_acl_vars</option></primary>
33770 </indexterm>
33771 </para>
33772 <informaltable frame="all">
33773 <tgroup cols="4" colsep="0" rowsep="0">
33774 <colspec colwidth="8*" align="left"/>
33775 <colspec colwidth="6*" align="center"/>
33776 <colspec colwidth="6*" align="center"/>
33777 <colspec colwidth="6*" align="right"/>
33778 <tbody>
33779 <row>
33780 <entry><option>strict_acl_vars</option></entry>
33781 <entry>Use: <emphasis>main</emphasis></entry>
33782 <entry>Type: <emphasis>boolean</emphasis></entry>
33783 <entry>Default: <emphasis>false</emphasis></entry>
33784 </row>
33785 </tbody>
33786 </tgroup>
33787 </informaltable>
33788 <para>
33789 <indexterm role="concept">
33790 <primary>access control lists (ACLs)</primary>
33791 <secondary>variables, handling unset</secondary>
33792 </indexterm>
33793 This option controls what happens if a syntactically valid but undefined ACL
33794 variable is referenced. If it is false (the default), an empty string
33795 is substituted; if it is true, an error is generated. See section
33796 <xref linkend="SECTaclvariables"/> for details of ACL variables.
33797 </para>
33798 <para>
33799 <indexterm role="option">
33800 <primary><option>strip_excess_angle_brackets</option></primary>
33801 </indexterm>
33802 </para>
33803 <informaltable frame="all">
33804 <tgroup cols="4" colsep="0" rowsep="0">
33805 <colspec colwidth="8*" align="left"/>
33806 <colspec colwidth="6*" align="center"/>
33807 <colspec colwidth="6*" align="center"/>
33808 <colspec colwidth="6*" align="right"/>
33809 <tbody>
33810 <row>
33811 <entry><option>strip_excess_angle_brackets</option></entry>
33812 <entry>Use: <emphasis>main</emphasis></entry>
33813 <entry>Type: <emphasis>boolean</emphasis></entry>
33814 <entry>Default: <emphasis>false</emphasis></entry>
33815 </row>
33816 </tbody>
33817 </tgroup>
33818 </informaltable>
33819 <para>
33820 <indexterm role="concept">
33821 <primary>angle brackets, excess</primary>
33822 </indexterm>
33823 If this option is set, redundant pairs of angle brackets round <quote>route-addr</quote>
33824 items in addresses are stripped. For example, <emphasis>&lt;&lt;xxx@a.b.c.d&gt;&gt;</emphasis> is
33825 treated as <emphasis>&lt;xxx@a.b.c.d&gt;</emphasis>. If this is in the envelope and the message is
33826 passed on to another MTA, the excess angle brackets are not passed on. If this
33827 option is not set, multiple pairs of angle brackets cause a syntax error.
33828 </para>
33829 <para>
33830 <indexterm role="option">
33831 <primary><option>strip_trailing_dot</option></primary>
33832 </indexterm>
33833 </para>
33834 <informaltable frame="all">
33835 <tgroup cols="4" colsep="0" rowsep="0">
33836 <colspec colwidth="8*" align="left"/>
33837 <colspec colwidth="6*" align="center"/>
33838 <colspec colwidth="6*" align="center"/>
33839 <colspec colwidth="6*" align="right"/>
33840 <tbody>
33841 <row>
33842 <entry><option>strip_trailing_dot</option></entry>
33843 <entry>Use: <emphasis>main</emphasis></entry>
33844 <entry>Type: <emphasis>boolean</emphasis></entry>
33845 <entry>Default: <emphasis>false</emphasis></entry>
33846 </row>
33847 </tbody>
33848 </tgroup>
33849 </informaltable>
33850 <para>
33851 <indexterm role="concept">
33852 <primary>trailing dot on domain</primary>
33853 </indexterm>
33854 <indexterm role="concept">
33855 <primary>dot</primary>
33856 <secondary>trailing on domain</secondary>
33857 </indexterm>
33858 If this option is set, a trailing dot at the end of a domain in an address is
33859 ignored. If this is in the envelope and the message is passed on to another
33860 MTA, the dot is not passed on. If this option is not set, a dot at the end of a
33861 domain causes a syntax error.
33862 However, addresses in header lines are checked only when an ACL requests header
33863 syntax checking.
33864 </para>
33865 <para>
33866 <indexterm role="option">
33867 <primary><option>syslog_duplication</option></primary>
33868 </indexterm>
33869 </para>
33870 <informaltable frame="all">
33871 <tgroup cols="4" colsep="0" rowsep="0">
33872 <colspec colwidth="8*" align="left"/>
33873 <colspec colwidth="6*" align="center"/>
33874 <colspec colwidth="6*" align="center"/>
33875 <colspec colwidth="6*" align="right"/>
33876 <tbody>
33877 <row>
33878 <entry><option>syslog_duplication</option></entry>
33879 <entry>Use: <emphasis>main</emphasis></entry>
33880 <entry>Type: <emphasis>boolean</emphasis></entry>
33881 <entry>Default: <emphasis>true</emphasis></entry>
33882 </row>
33883 </tbody>
33884 </tgroup>
33885 </informaltable>
33886 <para>
33887 <indexterm role="concept">
33888 <primary>syslog</primary>
33889 <secondary>duplicate log lines; suppressing</secondary>
33890 </indexterm>
33891 When Exim is logging to syslog, it writes the log lines for its three
33892 separate logs at different syslog priorities so that they can in principle
33893 be separated on the logging hosts. Some installations do not require this
33894 separation, and in those cases, the duplication of certain log lines is a
33895 nuisance. If <option>syslog_duplication</option> is set false, only one copy of any
33896 particular log line is written to syslog. For lines that normally go to
33897 both the main log and the reject log, the reject log version (possibly
33898 containing message header lines) is written, at LOG_NOTICE priority.
33899 Lines that normally go to both the main and the panic log are written at
33900 the LOG_ALERT priority.
33901 </para>
33902 <para>
33903 <indexterm role="option">
33904 <primary><option>syslog_facility</option></primary>
33905 </indexterm>
33906 </para>
33907 <informaltable frame="all">
33908 <tgroup cols="4" colsep="0" rowsep="0">
33909 <colspec colwidth="8*" align="left"/>
33910 <colspec colwidth="6*" align="center"/>
33911 <colspec colwidth="6*" align="center"/>
33912 <colspec colwidth="6*" align="right"/>
33913 <tbody>
33914 <row>
33915 <entry><option>syslog_facility</option></entry>
33916 <entry>Use: <emphasis>main</emphasis></entry>
33917 <entry>Type: <emphasis>string</emphasis></entry>
33918 <entry>Default: <emphasis>unset</emphasis></entry>
33919 </row>
33920 </tbody>
33921 </tgroup>
33922 </informaltable>
33923 <para>
33924 <indexterm role="concept">
33925 <primary>syslog</primary>
33926 <secondary>facility; setting</secondary>
33927 </indexterm>
33928 This option sets the syslog <quote>facility</quote> name, used when Exim is logging to
33929 syslog. The value must be one of the strings <quote>mail</quote>, <quote>user</quote>, <quote>news</quote>,
33930 <quote>uucp</quote>, <quote>daemon</quote>, or <quote>local<emphasis>x</emphasis></quote> where <emphasis>x</emphasis> is a digit between 0 and 7.
33931 If this option is unset, <quote>mail</quote> is used. See chapter <xref linkend="CHAPlog"/> for
33932 details of Exim&#x2019;s logging.
33933 </para>
33934 <para>
33935 <indexterm role="option">
33936 <primary><option>syslog_pid</option></primary>
33937 </indexterm>
33938 </para>
33939 <informaltable frame="all">
33940 <tgroup cols="4" colsep="0" rowsep="0">
33941 <colspec colwidth="8*" align="left"/>
33942 <colspec colwidth="6*" align="center"/>
33943 <colspec colwidth="6*" align="center"/>
33944 <colspec colwidth="6*" align="right"/>
33945 <tbody>
33946 <row>
33947 <entry><option>syslog_pid</option></entry>
33948 <entry>Use: <emphasis>main</emphasis></entry>
33949 <entry>Type: <emphasis>boolean</emphasis></entry>
33950 <entry>Default: <emphasis>true</emphasis></entry>
33951 </row>
33952 </tbody>
33953 </tgroup>
33954 </informaltable>
33955 <para>
33956 <indexterm role="concept">
33957 <primary>syslog</primary>
33958 <secondary>pid</secondary>
33959 </indexterm>
33960 If <option>syslog_pid</option> is set false, the PID on Exim&#x2019;s log lines are
33961 omitted when these lines are sent to syslog. (Syslog normally prefixes
33962 the log lines with the PID of the logging process automatically.) You need
33963 to enable the <literal>+pid</literal> log selector item, if you want Exim to write it&#x2019;s PID
33964 into the logs.) See chapter <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
33965 </para>
33966 <para>
33967 <indexterm role="option">
33968 <primary><option>syslog_processname</option></primary>
33969 </indexterm>
33970 </para>
33971 <informaltable frame="all">
33972 <tgroup cols="4" colsep="0" rowsep="0">
33973 <colspec colwidth="8*" align="left"/>
33974 <colspec colwidth="6*" align="center"/>
33975 <colspec colwidth="6*" align="center"/>
33976 <colspec colwidth="6*" align="right"/>
33977 <tbody>
33978 <row>
33979 <entry><option>syslog_processname</option></entry>
33980 <entry>Use: <emphasis>main</emphasis></entry>
33981 <entry>Type: <emphasis>string</emphasis></entry>
33982 <entry>Default: <emphasis><literal>exim</literal></emphasis></entry>
33983 </row>
33984 </tbody>
33985 </tgroup>
33986 </informaltable>
33987 <para>
33988 <indexterm role="concept">
33989 <primary>syslog</primary>
33990 <secondary>process name; setting</secondary>
33991 </indexterm>
33992 This option sets the syslog <quote>ident</quote> name, used when Exim is logging to
33993 syslog. The value must be no longer than 32 characters. See chapter
33994 <xref linkend="CHAPlog"/> for details of Exim&#x2019;s logging.
33995 </para>
33996 <para>
33997 <indexterm role="option">
33998 <primary><option>syslog_timestamp</option></primary>
33999 </indexterm>
34000 </para>
34001 <informaltable frame="all">
34002 <tgroup cols="4" colsep="0" rowsep="0">
34003 <colspec colwidth="8*" align="left"/>
34004 <colspec colwidth="6*" align="center"/>
34005 <colspec colwidth="6*" align="center"/>
34006 <colspec colwidth="6*" align="right"/>
34007 <tbody>
34008 <row>
34009 <entry><option>syslog_timestamp</option></entry>
34010 <entry>Use: <emphasis>main</emphasis></entry>
34011 <entry>Type: <emphasis>boolean</emphasis></entry>
34012 <entry>Default: <emphasis>true</emphasis></entry>
34013 </row>
34014 </tbody>
34015 </tgroup>
34016 </informaltable>
34017 <para>
34018 <indexterm role="concept">
34019 <primary>syslog</primary>
34020 <secondary>timestamps</secondary>
34021 </indexterm>
34022 <indexterm role="concept">
34023 <primary>timestamps</primary>
34024 <secondary>syslog</secondary>
34025 </indexterm>
34026 If <option>syslog_timestamp</option> is set false, the timestamps on Exim&#x2019;s log lines are
34027 omitted when these lines are sent to syslog. See chapter <xref linkend="CHAPlog"/> for
34028 details of Exim&#x2019;s logging.
34029 </para>
34030 <para>
34031 <indexterm role="option">
34032 <primary><option>system_filter</option></primary>
34033 </indexterm>
34034 </para>
34035 <informaltable frame="all">
34036 <tgroup cols="4" colsep="0" rowsep="0">
34037 <colspec colwidth="8*" align="left"/>
34038 <colspec colwidth="6*" align="center"/>
34039 <colspec colwidth="6*" align="center"/>
34040 <colspec colwidth="6*" align="right"/>
34041 <tbody>
34042 <row>
34043 <entry><option>system_filter</option></entry>
34044 <entry>Use: <emphasis>main</emphasis></entry>
34045 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34046 <entry>Default: <emphasis>unset</emphasis></entry>
34047 </row>
34048 </tbody>
34049 </tgroup>
34050 </informaltable>
34051 <para>
34052 <indexterm role="concept">
34053 <primary>filter</primary>
34054 <secondary>system filter</secondary>
34055 </indexterm>
34056 <indexterm role="concept">
34057 <primary>system filter</primary>
34058 <secondary>specifying</secondary>
34059 </indexterm>
34060 <indexterm role="concept">
34061 <primary>Sieve filter</primary>
34062 <secondary>not available for system filter</secondary>
34063 </indexterm>
34064 This option specifies an Exim filter file that is applied to all messages at
34065 the start of each delivery attempt, before any routing is done. System filters
34066 must be Exim filters; they cannot be Sieve filters. If the system filter
34067 generates any deliveries to files or pipes, or any new mail messages, the
34068 appropriate <option>system_filter_..._transport</option> option(s) must be set, to define
34069 which transports are to be used. Details of this facility are given in chapter
34070 <xref linkend="CHAPsystemfilter"/>.
34071 A forced expansion failure results in no filter operation.
34072 </para>
34073 <para>
34074 <indexterm role="option">
34075 <primary><option>system_filter_directory_transport</option></primary>
34076 </indexterm>
34077 </para>
34078 <informaltable frame="all">
34079 <tgroup cols="4" colsep="0" rowsep="0">
34080 <colspec colwidth="8*" align="left"/>
34081 <colspec colwidth="6*" align="center"/>
34082 <colspec colwidth="6*" align="center"/>
34083 <colspec colwidth="6*" align="right"/>
34084 <tbody>
34085 <row>
34086 <entry><option>system_filter_directory_transport</option></entry>
34087 <entry>Use: <emphasis>main</emphasis></entry>
34088 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34089 <entry>Default: <emphasis>unset</emphasis></entry>
34090 </row>
34091 </tbody>
34092 </tgroup>
34093 </informaltable>
34094 <para>
34095 <indexterm role="variable">
34096 <primary><varname>$address_file</varname></primary>
34097 </indexterm>
34098 This sets the name of the transport driver that is to be used when the
34099 <option>save</option> command in a system message filter specifies a path ending in <quote>/</quote>,
34100 implying delivery of each message into a separate file in some directory.
34101 During the delivery, the variable <varname>$address_file</varname> contains the path name.
34102 </para>
34103 <para>
34104 <indexterm role="option">
34105 <primary><option>system_filter_file_transport</option></primary>
34106 </indexterm>
34107 </para>
34108 <informaltable frame="all">
34109 <tgroup cols="4" colsep="0" rowsep="0">
34110 <colspec colwidth="8*" align="left"/>
34111 <colspec colwidth="6*" align="center"/>
34112 <colspec colwidth="6*" align="center"/>
34113 <colspec colwidth="6*" align="right"/>
34114 <tbody>
34115 <row>
34116 <entry><option>system_filter_file_transport</option></entry>
34117 <entry>Use: <emphasis>main</emphasis></entry>
34118 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34119 <entry>Default: <emphasis>unset</emphasis></entry>
34120 </row>
34121 </tbody>
34122 </tgroup>
34123 </informaltable>
34124 <para>
34125 <indexterm role="concept">
34126 <primary>file</primary>
34127 <secondary>transport for system filter</secondary>
34128 </indexterm>
34129 This sets the name of the transport driver that is to be used when the <option>save</option>
34130 command in a system message filter specifies a path not ending in <quote>/</quote>. During
34131 the delivery, the variable <varname>$address_file</varname> contains the path name.
34132 </para>
34133 <para>
34134 <indexterm role="option">
34135 <primary><option>system_filter_group</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>system_filter_group</option></entry>
34147 <entry>Use: <emphasis>main</emphasis></entry>
34148 <entry>Type: <emphasis>string</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>gid (group id)</primary>
34157 <secondary>system filter</secondary>
34158 </indexterm>
34159 This option is used only when <option>system_filter_user</option> is also set. It sets the
34160 gid under which the system filter is run, overriding any gid that is associated
34161 with the user. The value may be numerical or symbolic.
34162 </para>
34163 <para>
34164 <indexterm role="option">
34165 <primary><option>system_filter_pipe_transport</option></primary>
34166 </indexterm>
34167 </para>
34168 <informaltable frame="all">
34169 <tgroup cols="4" colsep="0" rowsep="0">
34170 <colspec colwidth="8*" align="left"/>
34171 <colspec colwidth="6*" align="center"/>
34172 <colspec colwidth="6*" align="center"/>
34173 <colspec colwidth="6*" align="right"/>
34174 <tbody>
34175 <row>
34176 <entry><option>system_filter_pipe_transport</option></entry>
34177 <entry>Use: <emphasis>main</emphasis></entry>
34178 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34179 <entry>Default: <emphasis>unset</emphasis></entry>
34180 </row>
34181 </tbody>
34182 </tgroup>
34183 </informaltable>
34184 <para>
34185 <indexterm role="concept">
34186 <primary><command>pipe</command> transport</primary>
34187 <secondary>for system filter</secondary>
34188 </indexterm>
34189 <indexterm role="variable">
34190 <primary><varname>$address_pipe</varname></primary>
34191 </indexterm>
34192 This specifies the transport driver that is to be used when a <option>pipe</option> command
34193 is used in a system filter. During the delivery, the variable <varname>$address_pipe</varname>
34194 contains the pipe command.
34195 </para>
34196 <para>
34197 <indexterm role="option">
34198 <primary><option>system_filter_reply_transport</option></primary>
34199 </indexterm>
34200 </para>
34201 <informaltable frame="all">
34202 <tgroup cols="4" colsep="0" rowsep="0">
34203 <colspec colwidth="8*" align="left"/>
34204 <colspec colwidth="6*" align="center"/>
34205 <colspec colwidth="6*" align="center"/>
34206 <colspec colwidth="6*" align="right"/>
34207 <tbody>
34208 <row>
34209 <entry><option>system_filter_reply_transport</option></entry>
34210 <entry>Use: <emphasis>main</emphasis></entry>
34211 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34212 <entry>Default: <emphasis>unset</emphasis></entry>
34213 </row>
34214 </tbody>
34215 </tgroup>
34216 </informaltable>
34217 <para>
34218 <indexterm role="concept">
34219 <primary><command>autoreply</command> transport</primary>
34220 <secondary>for system filter</secondary>
34221 </indexterm>
34222 This specifies the transport driver that is to be used when a <option>mail</option> command
34223 is used in a system filter.
34224 </para>
34225 <para>
34226 <indexterm role="option">
34227 <primary><option>system_filter_user</option></primary>
34228 </indexterm>
34229 </para>
34230 <informaltable frame="all">
34231 <tgroup cols="4" colsep="0" rowsep="0">
34232 <colspec colwidth="8*" align="left"/>
34233 <colspec colwidth="6*" align="center"/>
34234 <colspec colwidth="6*" align="center"/>
34235 <colspec colwidth="6*" align="right"/>
34236 <tbody>
34237 <row>
34238 <entry><option>system_filter_user</option></entry>
34239 <entry>Use: <emphasis>main</emphasis></entry>
34240 <entry>Type: <emphasis>string</emphasis></entry>
34241 <entry>Default: <emphasis>unset</emphasis></entry>
34242 </row>
34243 </tbody>
34244 </tgroup>
34245 </informaltable>
34246 <para>
34247 <indexterm role="concept">
34248 <primary>uid (user id)</primary>
34249 <secondary>system filter</secondary>
34250 </indexterm>
34251 If this option is set to root, the system filter is run in the main Exim
34252 delivery process, as root.  Otherwise, the system filter runs in a separate
34253 process, as the given user, defaulting to the Exim run-time user.
34254 Unless the string consists entirely of digits, it
34255 is looked up in the password data. Failure to find the named user causes a
34256 configuration error. The gid is either taken from the password data, or
34257 specified by <option>system_filter_group</option>. When the uid is specified numerically,
34258 <option>system_filter_group</option> is required to be set.
34259 </para>
34260 <para>
34261 If the system filter generates any pipe, file, or reply deliveries, the uid
34262 under which the filter is run is used when transporting them, unless a
34263 transport option overrides.
34264 </para>
34265 <para>
34266 <indexterm role="option">
34267 <primary><option>tcp_nodelay</option></primary>
34268 </indexterm>
34269 </para>
34270 <informaltable frame="all">
34271 <tgroup cols="4" colsep="0" rowsep="0">
34272 <colspec colwidth="8*" align="left"/>
34273 <colspec colwidth="6*" align="center"/>
34274 <colspec colwidth="6*" align="center"/>
34275 <colspec colwidth="6*" align="right"/>
34276 <tbody>
34277 <row>
34278 <entry><option>tcp_nodelay</option></entry>
34279 <entry>Use: <emphasis>main</emphasis></entry>
34280 <entry>Type: <emphasis>boolean</emphasis></entry>
34281 <entry>Default: <emphasis>true</emphasis></entry>
34282 </row>
34283 </tbody>
34284 </tgroup>
34285 </informaltable>
34286 <para>
34287 <indexterm role="concept">
34288 <primary>daemon</primary>
34289 <secondary>TCP_NODELAY on sockets</secondary>
34290 </indexterm>
34291 <indexterm role="concept">
34292 <primary>Nagle algorithm</primary>
34293 </indexterm>
34294 <indexterm role="concept">
34295 <primary>TCP_NODELAY on listening sockets</primary>
34296 </indexterm>
34297 If this option is set false, it stops the Exim daemon setting the
34298 TCP_NODELAY option on its listening sockets. Setting TCP_NODELAY
34299 turns off the <quote>Nagle algorithm</quote>, which is a way of improving network
34300 performance in interactive (character-by-character) situations. Turning it off
34301 should improve Exim&#x2019;s performance a bit, so that is what happens by default.
34302 However, it appears that some broken clients cannot cope, and time out. Hence
34303 this option. It affects only those sockets that are set up for listening by the
34304 daemon. Sockets created by the smtp transport for delivering mail always set
34305 TCP_NODELAY.
34306 </para>
34307 <para>
34308 <indexterm role="option">
34309 <primary><option>timeout_frozen_after</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>timeout_frozen_after</option></entry>
34321 <entry>Use: <emphasis>main</emphasis></entry>
34322 <entry>Type: <emphasis>time</emphasis></entry>
34323 <entry>Default: <emphasis>0s</emphasis></entry>
34324 </row>
34325 </tbody>
34326 </tgroup>
34327 </informaltable>
34328 <para>
34329 <indexterm role="concept">
34330 <primary>frozen messages</primary>
34331 <secondary>timing out</secondary>
34332 </indexterm>
34333 <indexterm role="concept">
34334 <primary>timeout</primary>
34335 <secondary>frozen messages</secondary>
34336 </indexterm>
34337 If <option>timeout_frozen_after</option> is set to a time greater than zero, a frozen
34338 message of any kind that has been in the queue for longer than the given time
34339 is automatically cancelled at the next queue run. If the frozen message is a
34340 bounce message, it is just discarded; otherwise, a bounce is sent to the
34341 sender, in a similar manner to cancellation by the <option>-Mg</option> command line option.
34342 If you want to timeout frozen bounce messages earlier than other kinds of
34343 frozen message, see <option>ignore_bounce_errors_after</option>.
34344 </para>
34345 <para>
34346 <emphasis role="bold">Note:</emphasis> the default value of zero means no timeouts; with this setting,
34347 frozen messages remain in the queue forever (except for any frozen bounce
34348 messages that are released by <option>ignore_bounce_errors_after</option>).
34349 </para>
34350 <para>
34351 <indexterm role="option">
34352 <primary><option>timezone</option></primary>
34353 </indexterm>
34354 </para>
34355 <informaltable frame="all">
34356 <tgroup cols="4" colsep="0" rowsep="0">
34357 <colspec colwidth="8*" align="left"/>
34358 <colspec colwidth="6*" align="center"/>
34359 <colspec colwidth="6*" align="center"/>
34360 <colspec colwidth="6*" align="right"/>
34361 <tbody>
34362 <row>
34363 <entry><option>timezone</option></entry>
34364 <entry>Use: <emphasis>main</emphasis></entry>
34365 <entry>Type: <emphasis>string</emphasis></entry>
34366 <entry>Default: <emphasis>unset</emphasis></entry>
34367 </row>
34368 </tbody>
34369 </tgroup>
34370 </informaltable>
34371 <para>
34372 <indexterm role="concept">
34373 <primary>timezone, setting</primary>
34374 </indexterm>
34375 <indexterm role="concept">
34376 <primary>environment</primary>
34377 <secondary>values from</secondary>
34378 </indexterm>
34379 The value of <option>timezone</option> is used to set the environment variable TZ while
34380 running Exim (if it is different on entry). This ensures that all timestamps
34381 created by Exim are in the required timezone. If you want all your timestamps
34382 to be in UTC (aka GMT) you should set
34383 </para>
34384 <literallayout class="monospaced">
34385 timezone = UTC
34386 </literallayout>
34387 <para>
34388 The default value is taken from TIMEZONE_DEFAULT in <filename>Local/Makefile</filename>,
34389 or, if that is not set, from the value of the TZ environment variable when Exim
34390 is built. If <option>timezone</option> is set to the empty string, either at build or run
34391 time, any existing TZ variable is removed from the environment when Exim
34392 runs. This is appropriate behaviour for obtaining wall-clock time on some, but
34393 unfortunately not all, operating systems.
34394 </para>
34395 <para>
34396 <indexterm role="option">
34397 <primary><option>tls_advertise_hosts</option></primary>
34398 </indexterm>
34399 </para>
34400 <informaltable frame="all">
34401 <tgroup cols="4" colsep="0" rowsep="0">
34402 <colspec colwidth="8*" align="left"/>
34403 <colspec colwidth="6*" align="center"/>
34404 <colspec colwidth="6*" align="center"/>
34405 <colspec colwidth="6*" align="right"/>
34406 <tbody>
34407 <row>
34408 <entry><option>tls_advertise_hosts</option></entry>
34409 <entry>Use: <emphasis>main</emphasis></entry>
34410 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
34411 <entry>Default: <emphasis>*</emphasis></entry>
34412 </row>
34413 </tbody>
34414 </tgroup>
34415 </informaltable>
34416 <para>
34417 <indexterm role="concept">
34418 <primary>TLS</primary>
34419 <secondary>advertising</secondary>
34420 </indexterm>
34421 <indexterm role="concept">
34422 <primary>encryption</primary>
34423 <secondary>on SMTP connection</secondary>
34424 </indexterm>
34425 <indexterm role="concept">
34426 <primary>SMTP</primary>
34427 <secondary>encrypted connection</secondary>
34428 </indexterm>
34429 <indexterm role="concept">
34430 <primary>ESMTP extensions</primary>
34431 <secondary>STARTTLS</secondary>
34432 </indexterm>
34433 When Exim is built with support for TLS encrypted connections, the availability
34434 of the STARTTLS command to set up an encrypted session is advertised in
34435 response to EHLO only to those client hosts that match this option. See
34436 chapter <xref linkend="CHAPTLS"/> for details of Exim&#x2019;s support for TLS.
34437 Note that the default value requires that a certificate be supplied
34438 using the <option>tls_certificate</option> option.  If TLS support for incoming connections
34439 is not required the <option>tls_advertise_hosts</option> option should be set empty.
34440 </para>
34441 <para>
34442 <indexterm role="option">
34443 <primary><option>tls_alpn</option></primary>
34444 </indexterm>
34445 </para>
34446 <informaltable frame="all">
34447 <tgroup cols="4" colsep="0" rowsep="0">
34448 <colspec colwidth="8*" align="left"/>
34449 <colspec colwidth="6*" align="center"/>
34450 <colspec colwidth="6*" align="center"/>
34451 <colspec colwidth="6*" align="right"/>
34452 <tbody>
34453 <row>
34454 <entry><option>tls_alpn</option></entry>
34455 <entry>Use: <emphasis>main</emphasis></entry>
34456 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34457 <entry>Default: <emphasis>smtp : esmtp</emphasis></entry>
34458 </row>
34459 </tbody>
34460 </tgroup>
34461 </informaltable>
34462 <para>
34463 <indexterm role="concept">
34464 <primary>TLS</primary>
34465 <secondary>Application Layer Protocol Names</secondary>
34466 </indexterm>
34467 <indexterm role="concept">
34468 <primary>TLS</primary>
34469 <secondary>ALPN</secondary>
34470 </indexterm>
34471 <indexterm role="concept">
34472 <primary>ALPN</primary>
34473 <secondary>set acceptable names for server</secondary>
34474 </indexterm>
34475 If this option is set,
34476 the TLS library supports ALPN,
34477 and the client offers either more than
34478 ALPN name or a name which does not match the list,
34479 the TLS connection is declined.
34480 </para>
34481 <para>
34482 <indexterm role="option">
34483 <primary><option>tls_certificate</option></primary>
34484 </indexterm>
34485 </para>
34486 <informaltable frame="all">
34487 <tgroup cols="4" colsep="0" rowsep="0">
34488 <colspec colwidth="8*" align="left"/>
34489 <colspec colwidth="6*" align="center"/>
34490 <colspec colwidth="6*" align="center"/>
34491 <colspec colwidth="6*" align="right"/>
34492 <tbody>
34493 <row>
34494 <entry><option>tls_certificate</option></entry>
34495 <entry>Use: <emphasis>main</emphasis></entry>
34496 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34497 <entry>Default: <emphasis>unset</emphasis></entry>
34498 </row>
34499 </tbody>
34500 </tgroup>
34501 </informaltable>
34502 <para>
34503 <indexterm role="concept">
34504 <primary>TLS</primary>
34505 <secondary>server certificate; location of</secondary>
34506 </indexterm>
34507 <indexterm role="concept">
34508 <primary>certificate</primary>
34509 <secondary>server, location of</secondary>
34510 </indexterm>
34511 The value of this option is expanded, and must then be a list of absolute paths to
34512 files which contain the server&#x2019;s certificates (in PEM format).
34513 Commonly only one file is needed.
34514 The server&#x2019;s private key is also
34515 assumed to be in this file if <option>tls_privatekey</option> is unset. See chapter
34516 <xref linkend="CHAPTLS"/> for further details.
34517 </para>
34518 <para>
34519 <emphasis role="bold">Note</emphasis>: The certificates defined by this option are used only when Exim is
34520 receiving incoming messages as a server. If you want to supply certificates for
34521 use when sending messages as a client, you must set the <option>tls_certificate</option>
34522 option in the relevant <command>smtp</command> transport.
34523 </para>
34524 <para>
34525 <emphasis role="bold">Note</emphasis>: If you use filenames based on IP addresses, change the list
34526 separator in the usual way (<xref linkend="SECTlistsepchange"/>) to avoid confusion under IPv6.
34527 </para>
34528 <para>
34529 <emphasis role="bold">Note</emphasis>: Under versions of OpenSSL preceding 1.1.1,
34530 when a list of more than one
34531 file is used, the <varname>$tls_in_ourcert</varname> variable is unreliable.
34532 The macro "_TLS_BAD_MULTICERT_IN_OURCERT" will be defined for those versions.
34533 </para>
34534 <para>
34535 <indexterm role="concept">
34536 <primary>SNI</primary>
34537 <secondary>selecting server certificate based on</secondary>
34538 </indexterm>
34539 If the option contains <varname>$tls_out_sni</varname> and Exim is built against OpenSSL, then
34540 if the OpenSSL build supports TLS extensions and the TLS client sends the
34541 Server Name Indication extension, then this option and others documented in
34542 <xref linkend="SECTtlssni"/> will be re-expanded.
34543 </para>
34544 <para>
34545 If this option is unset or empty a self-signed certificate will be
34546 used.
34547 Under Linux this is generated at daemon startup; on other platforms it will be
34548 generated fresh for every connection.
34549 </para>
34550 <para>
34551 <indexterm role="option">
34552 <primary><option>tls_crl</option></primary>
34553 </indexterm>
34554 </para>
34555 <informaltable frame="all">
34556 <tgroup cols="4" colsep="0" rowsep="0">
34557 <colspec colwidth="8*" align="left"/>
34558 <colspec colwidth="6*" align="center"/>
34559 <colspec colwidth="6*" align="center"/>
34560 <colspec colwidth="6*" align="right"/>
34561 <tbody>
34562 <row>
34563 <entry><option>tls_crl</option></entry>
34564 <entry>Use: <emphasis>main</emphasis></entry>
34565 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34566 <entry>Default: <emphasis>unset</emphasis></entry>
34567 </row>
34568 </tbody>
34569 </tgroup>
34570 </informaltable>
34571 <para>
34572 <indexterm role="concept">
34573 <primary>TLS</primary>
34574 <secondary>server certificate revocation list</secondary>
34575 </indexterm>
34576 <indexterm role="concept">
34577 <primary>certificate</primary>
34578 <secondary>revocation list for server</secondary>
34579 </indexterm>
34580 This option specifies a certificate revocation list. The expanded value must
34581 be the name of a file that contains CRLs in PEM format.
34582 </para>
34583 <para>
34584 Under OpenSSL the option can specify a directory with CRL files.
34585 </para>
34586 <para>
34587 <emphasis role="bold">Note:</emphasis> Under OpenSSL the option must, if given, supply a CRL
34588 for each signing element of the certificate chain (i.e. all but the leaf).
34589 For the file variant this can be multiple PEM blocks in the one file.
34590 </para>
34591 <para>
34592 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
34593 </para>
34594 <para>
34595 <indexterm role="option">
34596 <primary><option>tls_dh_max_bits</option></primary>
34597 </indexterm>
34598 </para>
34599 <informaltable frame="all">
34600 <tgroup cols="4" colsep="0" rowsep="0">
34601 <colspec colwidth="8*" align="left"/>
34602 <colspec colwidth="6*" align="center"/>
34603 <colspec colwidth="6*" align="center"/>
34604 <colspec colwidth="6*" align="right"/>
34605 <tbody>
34606 <row>
34607 <entry><option>tls_dh_max_bits</option></entry>
34608 <entry>Use: <emphasis>main</emphasis></entry>
34609 <entry>Type: <emphasis>integer</emphasis></entry>
34610 <entry>Default: <emphasis>2236</emphasis></entry>
34611 </row>
34612 </tbody>
34613 </tgroup>
34614 </informaltable>
34615 <para>
34616 <indexterm role="concept">
34617 <primary>TLS</primary>
34618 <secondary>D-H bit count</secondary>
34619 </indexterm>
34620 The number of bits used for Diffie-Hellman key-exchange may be suggested by
34621 the chosen TLS library.  That value might prove to be too high for
34622 interoperability.  This option provides a maximum clamp on the value
34623 suggested, trading off security for interoperability.
34624 </para>
34625 <para>
34626 The value must be at least 1024.
34627 </para>
34628 <para>
34629 The value 2236 was chosen because, at time of adding the option, it was the
34630 hard-coded maximum value supported by the NSS cryptographic library, as used
34631 by Thunderbird, while GnuTLS was suggesting 2432 bits as normal.
34632 </para>
34633 <para>
34634 If you prefer more security and are willing to break some clients, raise this
34635 number.
34636 </para>
34637 <para>
34638 Note that the value passed to GnuTLS for *generating* a new prime may be a
34639 little less than this figure, because GnuTLS is inexact and may produce a
34640 larger prime than requested.
34641 </para>
34642 <para>
34643 <indexterm role="option">
34644 <primary><option>tls_dhparam</option></primary>
34645 </indexterm>
34646 </para>
34647 <informaltable frame="all">
34648 <tgroup cols="4" colsep="0" rowsep="0">
34649 <colspec colwidth="8*" align="left"/>
34650 <colspec colwidth="6*" align="center"/>
34651 <colspec colwidth="6*" align="center"/>
34652 <colspec colwidth="6*" align="right"/>
34653 <tbody>
34654 <row>
34655 <entry><option>tls_dhparam</option></entry>
34656 <entry>Use: <emphasis>main</emphasis></entry>
34657 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34658 <entry>Default: <emphasis>unset</emphasis></entry>
34659 </row>
34660 </tbody>
34661 </tgroup>
34662 </informaltable>
34663 <para>
34664 <indexterm role="concept">
34665 <primary>TLS</primary>
34666 <secondary>D-H parameters for server</secondary>
34667 </indexterm>
34668 The value of this option is expanded and indicates the source of DH parameters
34669 to be used by Exim.
34670 </para>
34671 <para>
34672 <emphasis role="bold">Note: The Exim Maintainers strongly recommend using a filename with site-generated
34673 local DH parameters</emphasis>, which has been supported across all versions of Exim.  The
34674 other specific constants available are a fallback so that even when
34675 "unconfigured", Exim can offer Perfect Forward Secrecy in older ciphersuites in TLS.
34676 </para>
34677 <para>
34678 If <option>tls_dhparam</option> is a filename starting with a <literal>/</literal>,
34679 then it names a file from which DH
34680 parameters should be loaded.  If the file exists, it should hold a PEM-encoded
34681 PKCS#3 representation of the DH prime.  If the file does not exist, for
34682 OpenSSL it is an error.  For GnuTLS, Exim will attempt to create the file and
34683 fill it with a generated DH prime.  For OpenSSL, if the DH bit-count from
34684 loading the file is greater than <option>tls_dh_max_bits</option> then it will be ignored,
34685 and treated as though the <option>tls_dhparam</option> were set to "none".
34686 </para>
34687 <para>
34688 If this option expands to the string "none", then no DH parameters will be
34689 loaded by Exim.
34690 </para>
34691 <para>
34692 If this option expands to the string "historic" and Exim is using GnuTLS, then
34693 Exim will attempt to load a file from inside the spool directory.  If the file
34694 does not exist, Exim will attempt to create it.
34695 See section <xref linkend="SECTgnutlsparam"/> for further details.
34696 </para>
34697 <para>
34698 If Exim is using OpenSSL and this option is empty or unset, then Exim will load
34699 a default DH prime; the default is Exim-specific but lacks verifiable provenance.
34700 </para>
34701 <para>
34702 In older versions of Exim the default was the 2048 bit prime described in section
34703 2.2 of RFC 5114, "2048-bit MODP Group with 224-bit Prime Order Subgroup", which
34704 in IKE is assigned number 23.
34705 </para>
34706 <para>
34707 Otherwise, the option must expand to the name used by Exim for any of a number
34708 of DH primes specified in RFC 2409, RFC 3526, RFC 5114, RFC 7919, or from other
34709 sources.  As names, Exim uses a standard specified name, else "ike" followed by
34710 the number used by IKE, or "default" which corresponds to
34711 <literal>exim.dev.20160529.3</literal>.
34712 </para>
34713 <para>
34714 The available standard primes are:
34715 <literal>ffdhe2048</literal>, <literal>ffdhe3072</literal>, <literal>ffdhe4096</literal>, <literal>ffdhe6144</literal>, <literal>ffdhe8192</literal>,
34716 <literal>ike1</literal>, <literal>ike2</literal>, <literal>ike5</literal>,
34717 <literal>ike14</literal>, <literal>ike15</literal>, <literal>ike16</literal>, <literal>ike17</literal>, <literal>ike18</literal>,
34718 <literal>ike22</literal>, <literal>ike23</literal> and <literal>ike24</literal>.
34719 </para>
34720 <para>
34721 The available additional primes are:
34722 <literal>exim.dev.20160529.1</literal>, <literal>exim.dev.20160529.2</literal> and <literal>exim.dev.20160529.3</literal>.
34723 </para>
34724 <para>
34725 Some of these will be too small to be accepted by clients.
34726 Some may be too large to be accepted by clients.
34727 The open cryptographic community has suspicions about the integrity of some
34728 of the later IKE values, which led into RFC7919 providing new fixed constants
34729 (the "ffdhe" identifiers).
34730 </para>
34731 <para>
34732 At this point, all of the "ike" values should be considered obsolete;
34733 they are still in Exim to avoid breaking unusual configurations, but are
34734 candidates for removal the next time we have backwards-incompatible changes.
34735 </para>
34736 <para revisionflag="changed">
34737 Two of them in particular (<literal>ike1</literal> and <literal>ike22</literal>) are called out by RFC 8247
34738 as MUST NOT use for IPSEC, and two more (<literal>ike23</literal> and <literal>ike24</literal>) as
34739 SHOULD NOT.
34740 Because of this, Exim regards them as deprecated; if either of the first pair
34741 are used, warnings will be logged in the paniclog, and if any are used then
34742 warnings will be logged in the mainlog.
34743 All four will be removed in a future Exim release.
34744 </para>
34745 <para>
34746 The TLS protocol does not negotiate an acceptable size for this; clients tend
34747 to hard-drop connections if what is offered by the server is unacceptable,
34748 whether too large or too small, and there&#x2019;s no provision for the client to
34749 tell the server what these constraints are.  Thus, as a server operator, you
34750 need to make an educated guess as to what is most likely to work for your
34751 userbase.
34752 </para>
34753 <para>
34754 Some known size constraints suggest that a bit-size in the range 2048 to 2236
34755 is most likely to maximise interoperability.  The upper bound comes from
34756 applications using the Mozilla Network Security Services (NSS) library, which
34757 used to set its <literal>DH_MAX_P_BITS</literal> upper-bound to 2236.  This affects many
34758 mail user agents (MUAs). The lower bound comes from Debian installs of Exim4
34759 prior to the 4.80 release, as Debian used to patch Exim to raise the minimum
34760 acceptable bound from 1024 to 2048.
34761 </para>
34762 <para>
34763 <indexterm role="option">
34764 <primary><option>tls_eccurve</option></primary>
34765 </indexterm>
34766 </para>
34767 <informaltable frame="all">
34768 <tgroup cols="4" colsep="0" rowsep="0">
34769 <colspec colwidth="8*" align="left"/>
34770 <colspec colwidth="6*" align="center"/>
34771 <colspec colwidth="6*" align="center"/>
34772 <colspec colwidth="6*" align="right"/>
34773 <tbody>
34774 <row>
34775 <entry><option>tls_eccurve</option></entry>
34776 <entry>Use: <emphasis>main</emphasis></entry>
34777 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34778 <entry>Default: <emphasis><literal>auto</literal></emphasis></entry>
34779 </row>
34780 </tbody>
34781 </tgroup>
34782 </informaltable>
34783 <para>
34784 <indexterm role="concept">
34785 <primary>TLS</primary>
34786 <secondary>EC cryptography</secondary>
34787 </indexterm>
34788 This option selects a EC curve for use by Exim when used with OpenSSL.
34789 It has no effect when Exim is used with GnuTLS.
34790 </para>
34791 <para>
34792 After expansion it must contain a valid EC curve parameter, such as
34793 <literal>prime256v1</literal>, <literal>secp384r1</literal>, or <literal>P-512</literal>. Consult your OpenSSL manual
34794 for valid selections.
34795 </para>
34796 <para>
34797 For OpenSSL versions before (and not including) 1.0.2, the string
34798 <literal>auto</literal> selects <literal>prime256v1</literal>. For more recent OpenSSL versions
34799 <literal>auto</literal> tells the library to choose.
34800 </para>
34801 <para>
34802 If the option expands to an empty string, no EC curves will be enabled.
34803 </para>
34804 <para>
34805 <indexterm role="option">
34806 <primary><option>tls_ocsp_file</option></primary>
34807 </indexterm>
34808 </para>
34809 <informaltable frame="all">
34810 <tgroup cols="4" colsep="0" rowsep="0">
34811 <colspec colwidth="8*" align="left"/>
34812 <colspec colwidth="6*" align="center"/>
34813 <colspec colwidth="6*" align="center"/>
34814 <colspec colwidth="6*" align="right"/>
34815 <tbody>
34816 <row>
34817 <entry><option>tls_ocsp_file</option></entry>
34818 <entry>Use: <emphasis>main</emphasis></entry>
34819 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34820 <entry>Default: <emphasis>unset</emphasis></entry>
34821 </row>
34822 </tbody>
34823 </tgroup>
34824 </informaltable>
34825 <para>
34826 <indexterm role="concept">
34827 <primary>TLS</primary>
34828 <secondary>certificate status</secondary>
34829 </indexterm>
34830 <indexterm role="concept">
34831 <primary>TLS</primary>
34832 <secondary>OCSP proof file</secondary>
34833 </indexterm>
34834 This option
34835 must if set expand to the absolute path to a file which contains a current
34836 status proof for the server&#x2019;s certificate, as obtained from the
34837 Certificate Authority.
34838 </para>
34839 <para>
34840 Usable for GnuTLS 3.4.4 or 3.3.17 or OpenSSL 1.1.0 (or later).
34841 The macro "_HAVE_TLS_OCSP" will be defined for those versions.
34842 </para>
34843 <para>
34844 For OpenSSL 1.1.0 or later, and
34845 for GnuTLS 3.5.6 or later the expanded value of this option can be a list
34846 of files, to match a list given for the <option>tls_certificate</option> option.
34847 The ordering of the two lists must match.
34848 The macro "_HAVE_TLS_OCSP_LIST" will be defined for those versions.
34849 </para>
34850 <para>
34851 The file(s) should be in DER format,
34852 except for GnuTLS 3.6.3 or later
34853 or for OpenSSL,
34854 when an optional filetype prefix can be used.
34855 The prefix must be one of "DER" or "PEM", followed by
34856 a single space.  If one is used it sets the format for subsequent
34857 files in the list; the initial format is DER.
34858 If multiple proofs are wanted, for multiple chain elements
34859 (this only works under TLS1.3)
34860 they must be coded as a combined OCSP response.
34861 </para>
34862 <para>
34863 Although GnuTLS will accept PEM files with multiple separate
34864 PEM blobs (ie. separate OCSP responses), it sends them in the
34865 TLS Certificate record interleaved with the certificates of the chain;
34866 although a GnuTLS client is happy with that, an OpenSSL client is not.
34867 </para>
34868 <para>
34869 <indexterm role="option">
34870 <primary><option>tls_on_connect_ports</option></primary>
34871 </indexterm>
34872 </para>
34873 <informaltable frame="all">
34874 <tgroup cols="4" colsep="0" rowsep="0">
34875 <colspec colwidth="8*" align="left"/>
34876 <colspec colwidth="6*" align="center"/>
34877 <colspec colwidth="6*" align="center"/>
34878 <colspec colwidth="6*" align="right"/>
34879 <tbody>
34880 <row>
34881 <entry><option>tls_on_connect_ports</option></entry>
34882 <entry>Use: <emphasis>main</emphasis></entry>
34883 <entry>Type: <emphasis>string list</emphasis></entry>
34884 <entry>Default: <emphasis>unset</emphasis></entry>
34885 </row>
34886 </tbody>
34887 </tgroup>
34888 </informaltable>
34889 <para>
34890 <indexterm role="concept">
34891 <primary>SSMTP</primary>
34892 </indexterm>
34893 <indexterm role="concept">
34894 <primary>SMTPS</primary>
34895 </indexterm>
34896 This option specifies a list of incoming SSMTP (aka SMTPS) ports that should
34897 operate the SSMTP (SMTPS) protocol, where a TLS session is immediately
34898 set up without waiting for the client to issue a STARTTLS command. For
34899 further details, see section <xref linkend="SECTsupobssmt"/>.
34900 </para>
34901 <para>
34902 <indexterm role="option">
34903 <primary><option>tls_privatekey</option></primary>
34904 </indexterm>
34905 </para>
34906 <informaltable frame="all">
34907 <tgroup cols="4" colsep="0" rowsep="0">
34908 <colspec colwidth="8*" align="left"/>
34909 <colspec colwidth="6*" align="center"/>
34910 <colspec colwidth="6*" align="center"/>
34911 <colspec colwidth="6*" align="right"/>
34912 <tbody>
34913 <row>
34914 <entry><option>tls_privatekey</option></entry>
34915 <entry>Use: <emphasis>main</emphasis></entry>
34916 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
34917 <entry>Default: <emphasis>unset</emphasis></entry>
34918 </row>
34919 </tbody>
34920 </tgroup>
34921 </informaltable>
34922 <para>
34923 <indexterm role="concept">
34924 <primary>TLS</primary>
34925 <secondary>server private key; location of</secondary>
34926 </indexterm>
34927 The value of this option is expanded, and must then be a list of absolute paths to
34928 files which contains the server&#x2019;s private keys.
34929 If this option is unset, or if
34930 the expansion is forced to fail, or the result is an empty string, the private
34931 key is assumed to be in the same file as the server&#x2019;s certificates. See chapter
34932 <xref linkend="CHAPTLS"/> for further details.
34933 </para>
34934 <para>
34935 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
34936 </para>
34937 <para>
34938 <indexterm role="option">
34939 <primary><option>tls_remember_esmtp</option></primary>
34940 </indexterm>
34941 </para>
34942 <informaltable frame="all">
34943 <tgroup cols="4" colsep="0" rowsep="0">
34944 <colspec colwidth="8*" align="left"/>
34945 <colspec colwidth="6*" align="center"/>
34946 <colspec colwidth="6*" align="center"/>
34947 <colspec colwidth="6*" align="right"/>
34948 <tbody>
34949 <row>
34950 <entry><option>tls_remember_esmtp</option></entry>
34951 <entry>Use: <emphasis>main</emphasis></entry>
34952 <entry>Type: <emphasis>boolean</emphasis></entry>
34953 <entry>Default: <emphasis>false</emphasis></entry>
34954 </row>
34955 </tbody>
34956 </tgroup>
34957 </informaltable>
34958 <para>
34959 <indexterm role="concept">
34960 <primary>TLS</primary>
34961 <secondary>esmtp state; remembering</secondary>
34962 </indexterm>
34963 <indexterm role="concept">
34964 <primary>TLS</primary>
34965 <secondary>broken clients</secondary>
34966 </indexterm>
34967 If this option is set true, Exim violates the RFCs by remembering that it is in
34968 <quote>esmtp</quote> state after successfully negotiating a TLS session. This provides
34969 support for broken clients that fail to send a new EHLO after starting a
34970 TLS session.
34971 </para>
34972 <para>
34973 <indexterm role="option">
34974 <primary><option>tls_require_ciphers</option></primary>
34975 </indexterm>
34976 </para>
34977 <informaltable frame="all">
34978 <tgroup cols="4" colsep="0" rowsep="0">
34979 <colspec colwidth="8*" align="left"/>
34980 <colspec colwidth="6*" align="center"/>
34981 <colspec colwidth="6*" align="center"/>
34982 <colspec colwidth="6*" align="right"/>
34983 <tbody>
34984 <row>
34985 <entry><option>tls_require_ciphers</option></entry>
34986 <entry>Use: <emphasis>main</emphasis></entry>
34987 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
34988 <entry>Default: <emphasis>unset</emphasis></entry>
34989 </row>
34990 </tbody>
34991 </tgroup>
34992 </informaltable>
34993 <para>
34994 <indexterm role="concept">
34995 <primary>TLS</primary>
34996 <secondary>requiring specific ciphers</secondary>
34997 </indexterm>
34998 <indexterm role="concept">
34999 <primary>cipher</primary>
35000 <secondary>requiring specific</secondary>
35001 </indexterm>
35002 This option controls which ciphers can be used for incoming TLS connections.
35003 The <command>smtp</command> transport has an option of the same name for controlling outgoing
35004 connections. This option is expanded for each connection, so can be varied for
35005 different clients if required. The value of this option must be a list of
35006 permitted cipher suites. The OpenSSL and GnuTLS libraries handle cipher control
35007 in somewhat different ways. If GnuTLS is being used, the client controls the
35008 preference order of the available ciphers. Details are given in sections
35009 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
35010 </para>
35011 <para>
35012 <indexterm role="option">
35013 <primary><option>tls_resumption_hosts</option></primary>
35014 </indexterm>
35015 </para>
35016 <informaltable frame="all">
35017 <tgroup cols="4" colsep="0" rowsep="0">
35018 <colspec colwidth="8*" align="left"/>
35019 <colspec colwidth="6*" align="center"/>
35020 <colspec colwidth="6*" align="center"/>
35021 <colspec colwidth="6*" align="right"/>
35022 <tbody>
35023 <row>
35024 <entry><option>tls_resumption_hosts</option></entry>
35025 <entry>Use: <emphasis>main</emphasis></entry>
35026 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
35027 <entry>Default: <emphasis>unset</emphasis></entry>
35028 </row>
35029 </tbody>
35030 </tgroup>
35031 </informaltable>
35032 <para>
35033 <indexterm role="concept">
35034 <primary>TLS</primary>
35035 <secondary>resumption</secondary>
35036 </indexterm>
35037 This option controls which connections to offer the TLS resumption feature.
35038 See <xref linkend="SECTresumption"/> for details.
35039 </para>
35040 <para>
35041 <indexterm role="option">
35042 <primary><option>tls_try_verify_hosts</option></primary>
35043 </indexterm>
35044 </para>
35045 <informaltable frame="all">
35046 <tgroup cols="4" colsep="0" rowsep="0">
35047 <colspec colwidth="8*" align="left"/>
35048 <colspec colwidth="6*" align="center"/>
35049 <colspec colwidth="6*" align="center"/>
35050 <colspec colwidth="6*" align="right"/>
35051 <tbody>
35052 <row>
35053 <entry><option>tls_try_verify_hosts</option></entry>
35054 <entry>Use: <emphasis>main</emphasis></entry>
35055 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
35056 <entry>Default: <emphasis>unset</emphasis></entry>
35057 </row>
35058 </tbody>
35059 </tgroup>
35060 </informaltable>
35061 <para>
35062 <indexterm role="concept">
35063 <primary>TLS</primary>
35064 <secondary>client certificate verification</secondary>
35065 </indexterm>
35066 <indexterm role="concept">
35067 <primary>certificate</primary>
35068 <secondary>verification of client</secondary>
35069 </indexterm>
35070 See <option>tls_verify_hosts</option> below.
35071 </para>
35072 <para>
35073 <indexterm role="option">
35074 <primary><option>tls_verify_certificates</option></primary>
35075 </indexterm>
35076 </para>
35077 <informaltable frame="all">
35078 <tgroup cols="4" colsep="0" rowsep="0">
35079 <colspec colwidth="8*" align="left"/>
35080 <colspec colwidth="6*" align="center"/>
35081 <colspec colwidth="6*" align="center"/>
35082 <colspec colwidth="6*" align="right"/>
35083 <tbody>
35084 <row>
35085 <entry><option>tls_verify_certificates</option></entry>
35086 <entry>Use: <emphasis>main</emphasis></entry>
35087 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35088 <entry>Default: <emphasis>system</emphasis></entry>
35089 </row>
35090 </tbody>
35091 </tgroup>
35092 </informaltable>
35093 <para>
35094 <indexterm role="concept">
35095 <primary>TLS</primary>
35096 <secondary>client certificate verification</secondary>
35097 </indexterm>
35098 <indexterm role="concept">
35099 <primary>certificate</primary>
35100 <secondary>verification of client</secondary>
35101 </indexterm>
35102 The value of this option is expanded, and must then be either the
35103 word "system"
35104 or the absolute path to
35105 a file or directory containing permitted certificates for clients that
35106 match <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option>.
35107 </para>
35108 <para>
35109 The "system" value for the option will use a
35110 system default location compiled into the SSL library.
35111 This is not available for GnuTLS versions preceding 3.0.20,
35112 and will be taken as empty; an explicit location
35113 must be specified.
35114 </para>
35115 <para>
35116 The use of a directory for the option value is not available for GnuTLS versions
35117 preceding 3.3.6 and a single file must be used.
35118 </para>
35119 <para>
35120 With OpenSSL the certificates specified
35121 explicitly
35122 either by file or directory
35123 are added to those given by the system default location.
35124 </para>
35125 <para>
35126 These certificates should be for the certificate authorities trusted, rather
35127 than the public cert of individual clients.  With both OpenSSL and GnuTLS, if
35128 the value is a file then the certificates are sent by Exim as a server to
35129 connecting clients, defining the list of accepted certificate authorities.
35130 Thus the values defined should be considered public data.  To avoid this,
35131 use the explicit directory version. (If your peer is Exim up to 4.85,
35132 using GnuTLS, you may need to send the CAs (thus using the file
35133 variant). Otherwise the peer doesn&#x2019;t send its certificate.)
35134 </para>
35135 <para>
35136 See <xref linkend="SECTtlssni"/> for discussion of when this option might be re-expanded.
35137 </para>
35138 <para>
35139 A forced expansion failure or setting to an empty string is equivalent to
35140 being unset.
35141 </para>
35142 <para>
35143 <indexterm role="option">
35144 <primary><option>tls_verify_hosts</option></primary>
35145 </indexterm>
35146 </para>
35147 <informaltable frame="all">
35148 <tgroup cols="4" colsep="0" rowsep="0">
35149 <colspec colwidth="8*" align="left"/>
35150 <colspec colwidth="6*" align="center"/>
35151 <colspec colwidth="6*" align="center"/>
35152 <colspec colwidth="6*" align="right"/>
35153 <tbody>
35154 <row>
35155 <entry><option>tls_verify_hosts</option></entry>
35156 <entry>Use: <emphasis>main</emphasis></entry>
35157 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
35158 <entry>Default: <emphasis>unset</emphasis></entry>
35159 </row>
35160 </tbody>
35161 </tgroup>
35162 </informaltable>
35163 <para>
35164 <indexterm role="concept">
35165 <primary>TLS</primary>
35166 <secondary>client certificate verification</secondary>
35167 </indexterm>
35168 <indexterm role="concept">
35169 <primary>certificate</primary>
35170 <secondary>verification of client</secondary>
35171 </indexterm>
35172 This option, along with <option>tls_try_verify_hosts</option>, controls the checking of
35173 certificates from clients. The expected certificates are defined by
35174 <option>tls_verify_certificates</option>, which must be set. A configuration error occurs if
35175 either <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> is set and
35176 <option>tls_verify_certificates</option> is not set.
35177 </para>
35178 <para>
35179 Any client that matches <option>tls_verify_hosts</option> is constrained by
35180 <option>tls_verify_certificates</option>. When the client initiates a TLS session, it must
35181 present one of the listed certificates. If it does not, the connection is
35182 aborted.
35183 <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
35184 the host to use TLS. It can still send SMTP commands through unencrypted
35185 connections. Forcing a client to use TLS has to be done separately using an
35186 ACL to reject inappropriate commands when the connection is not encrypted.
35187 </para>
35188 <para>
35189 A weaker form of checking is provided by <option>tls_try_verify_hosts</option>. If a client
35190 matches this option (but not <option>tls_verify_hosts</option>), Exim requests a
35191 certificate and checks it against <option>tls_verify_certificates</option>, but does not
35192 abort the connection if there is no certificate or if it does not match. This
35193 state can be detected in an ACL, which makes it possible to implement policies
35194 such as <quote>accept for relay only if a verified certificate has been received,
35195 but accept for local delivery if encrypted, even without a verified
35196 certificate</quote>.
35197 </para>
35198 <para>
35199 Client hosts that match neither of these lists are not asked to present
35200 certificates.
35201 </para>
35202 <para>
35203 <indexterm role="option">
35204 <primary><option>trusted_groups</option></primary>
35205 </indexterm>
35206 </para>
35207 <informaltable frame="all">
35208 <tgroup cols="4" colsep="0" rowsep="0">
35209 <colspec colwidth="8*" align="left"/>
35210 <colspec colwidth="6*" align="center"/>
35211 <colspec colwidth="6*" align="center"/>
35212 <colspec colwidth="6*" align="right"/>
35213 <tbody>
35214 <row>
35215 <entry><option>trusted_groups</option></entry>
35216 <entry>Use: <emphasis>main</emphasis></entry>
35217 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
35218 <entry>Default: <emphasis>unset</emphasis></entry>
35219 </row>
35220 </tbody>
35221 </tgroup>
35222 </informaltable>
35223 <para>
35224 <indexterm role="concept">
35225 <primary>trusted groups</primary>
35226 </indexterm>
35227 <indexterm role="concept">
35228 <primary>groups</primary>
35229 <secondary>trusted</secondary>
35230 </indexterm>
35231 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
35232 option is set, any process that is running in one of the listed groups, or
35233 which has one of them as a supplementary group, is trusted. The groups can be
35234 specified numerically or by name. See section <xref linkend="SECTtrustedadmin"/> for
35235 details of what trusted callers are permitted to do. If neither
35236 <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the Exim user
35237 are trusted.
35238 </para>
35239 <para>
35240 <indexterm role="option">
35241 <primary><option>trusted_users</option></primary>
35242 </indexterm>
35243 </para>
35244 <informaltable frame="all">
35245 <tgroup cols="4" colsep="0" rowsep="0">
35246 <colspec colwidth="8*" align="left"/>
35247 <colspec colwidth="6*" align="center"/>
35248 <colspec colwidth="6*" align="center"/>
35249 <colspec colwidth="6*" align="right"/>
35250 <tbody>
35251 <row>
35252 <entry><option>trusted_users</option></entry>
35253 <entry>Use: <emphasis>main</emphasis></entry>
35254 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
35255 <entry>Default: <emphasis>unset</emphasis></entry>
35256 </row>
35257 </tbody>
35258 </tgroup>
35259 </informaltable>
35260 <para>
35261 <indexterm role="concept">
35262 <primary>trusted users</primary>
35263 </indexterm>
35264 <indexterm role="concept">
35265 <primary>user</primary>
35266 <secondary>trusted</secondary>
35267 </indexterm>
35268 This option is expanded just once, at the start of Exim&#x2019;s processing. If this
35269 option is set, any process that is running as one of the listed users is
35270 trusted. The users can be specified numerically or by name. See section
35271 <xref linkend="SECTtrustedadmin"/> for details of what trusted callers are permitted to do.
35272 If neither <option>trusted_groups</option> nor <option>trusted_users</option> is set, only root and the
35273 Exim user are trusted.
35274 </para>
35275 <para>
35276 <indexterm role="option">
35277 <primary><option>unknown_login</option></primary>
35278 </indexterm>
35279 </para>
35280 <informaltable frame="all">
35281 <tgroup cols="4" colsep="0" rowsep="0">
35282 <colspec colwidth="8*" align="left"/>
35283 <colspec colwidth="6*" align="center"/>
35284 <colspec colwidth="6*" align="center"/>
35285 <colspec colwidth="6*" align="right"/>
35286 <tbody>
35287 <row>
35288 <entry><option>unknown_login</option></entry>
35289 <entry>Use: <emphasis>main</emphasis></entry>
35290 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35291 <entry>Default: <emphasis>unset</emphasis></entry>
35292 </row>
35293 </tbody>
35294 </tgroup>
35295 </informaltable>
35296 <para>
35297 <indexterm role="concept">
35298 <primary>uid (user id)</primary>
35299 <secondary>unknown caller</secondary>
35300 </indexterm>
35301 <indexterm role="variable">
35302 <primary><varname>$caller_uid</varname></primary>
35303 </indexterm>
35304 This is a specialized feature for use in unusual configurations. By default, if
35305 the uid of the caller of Exim cannot be looked up using <function>getpwuid()</function>, Exim
35306 gives up. The <option>unknown_login</option> option can be used to set a login name to be
35307 used in this circumstance. It is expanded, so values like <option>user$caller_uid</option>
35308 can be set. When <option>unknown_login</option> is used, the value of <option>unknown_username</option>
35309 is used for the user&#x2019;s real name (gecos field), unless this has been set by the
35310 <option>-F</option> option.
35311 </para>
35312 <para>
35313 <indexterm role="option">
35314 <primary><option>unknown_username</option></primary>
35315 </indexterm>
35316 </para>
35317 <informaltable frame="all">
35318 <tgroup cols="4" colsep="0" rowsep="0">
35319 <colspec colwidth="8*" align="left"/>
35320 <colspec colwidth="6*" align="center"/>
35321 <colspec colwidth="6*" align="center"/>
35322 <colspec colwidth="6*" align="right"/>
35323 <tbody>
35324 <row>
35325 <entry><option>unknown_username</option></entry>
35326 <entry>Use: <emphasis>main</emphasis></entry>
35327 <entry>Type: <emphasis>string</emphasis></entry>
35328 <entry>Default: <emphasis>unset</emphasis></entry>
35329 </row>
35330 </tbody>
35331 </tgroup>
35332 </informaltable>
35333 <para>
35334 See <option>unknown_login</option>.
35335 </para>
35336 <para>
35337 <indexterm role="option">
35338 <primary><option>untrusted_set_sender</option></primary>
35339 </indexterm>
35340 </para>
35341 <informaltable frame="all">
35342 <tgroup cols="4" colsep="0" rowsep="0">
35343 <colspec colwidth="8*" align="left"/>
35344 <colspec colwidth="6*" align="center"/>
35345 <colspec colwidth="6*" align="center"/>
35346 <colspec colwidth="6*" align="right"/>
35347 <tbody>
35348 <row>
35349 <entry><option>untrusted_set_sender</option></entry>
35350 <entry>Use: <emphasis>main</emphasis></entry>
35351 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
35352 <entry>Default: <emphasis>unset</emphasis></entry>
35353 </row>
35354 </tbody>
35355 </tgroup>
35356 </informaltable>
35357 <para>
35358 <indexterm role="concept">
35359 <primary>trusted users</primary>
35360 </indexterm>
35361 <indexterm role="concept">
35362 <primary>sender</primary>
35363 <secondary>setting by untrusted user</secondary>
35364 </indexterm>
35365 <indexterm role="concept">
35366 <primary>untrusted user setting sender</primary>
35367 </indexterm>
35368 <indexterm role="concept">
35369 <primary>user</primary>
35370 <secondary>untrusted setting sender</secondary>
35371 </indexterm>
35372 <indexterm role="concept">
35373 <primary>envelope from</primary>
35374 </indexterm>
35375 <indexterm role="concept">
35376 <primary>envelope sender</primary>
35377 </indexterm>
35378 When an untrusted user submits a message to Exim using the standard input, Exim
35379 normally creates an envelope sender address from the user&#x2019;s login and the
35380 default qualification domain. Data from the <option>-f</option> option (for setting envelope
35381 senders on non-SMTP messages) or the SMTP MAIL command (if <option>-bs</option> or <option>-bS</option>
35382 is used) is ignored.
35383 </para>
35384 <para>
35385 However, untrusted users are permitted to set an empty envelope sender address,
35386 to declare that a message should never generate any bounces. For example:
35387 </para>
35388 <literallayout class="monospaced">
35389 exim -f '&lt;&gt;' user@domain.example
35390 </literallayout>
35391 <para>
35392 <indexterm role="variable">
35393 <primary><varname>$sender_ident</varname></primary>
35394 </indexterm>
35395 The <option>untrusted_set_sender</option> option allows you to permit untrusted users to set
35396 other envelope sender addresses in a controlled way. When it is set, untrusted
35397 users are allowed to set envelope sender addresses that match any of the
35398 patterns in the list. Like all address lists, the string is expanded. The
35399 identity of the user is in <varname>$sender_ident</varname>, so you can, for example, restrict
35400 users to setting senders that start with their login ids
35401 followed by a hyphen
35402 by a setting like this:
35403 </para>
35404 <literallayout class="monospaced">
35405 untrusted_set_sender = ^$sender_ident-
35406 </literallayout>
35407 <para>
35408 If you want to allow untrusted users to set envelope sender addresses without
35409 restriction, you can use
35410 </para>
35411 <literallayout class="monospaced">
35412 untrusted_set_sender = *
35413 </literallayout>
35414 <para>
35415 The <option>untrusted_set_sender</option> option applies to all forms of local input, but
35416 only to the setting of the envelope sender. It does not permit untrusted users
35417 to use the other options which trusted user can use to override message
35418 parameters. Furthermore, it does not stop Exim from removing an existing
35419 <emphasis>Sender:</emphasis> header in the message, or from adding a <emphasis>Sender:</emphasis> header if
35420 necessary. See <option>local_sender_retain</option> and <option>local_from_check</option> for ways of
35421 overriding these actions. The handling of the <emphasis>Sender:</emphasis> header is also
35422 described in section <xref linkend="SECTthesenhea"/>.
35423 </para>
35424 <para>
35425 The log line for a message&#x2019;s arrival shows the envelope sender following
35426 <quote>&lt;=</quote>. For local messages, the user&#x2019;s login always follows, after <quote>U=</quote>. In
35427 <option>-bp</option> displays, and in the Exim monitor, if an untrusted user sets an
35428 envelope sender address, the user&#x2019;s login is shown in parentheses after the
35429 sender address.
35430 </para>
35431 <para>
35432 <indexterm role="option">
35433 <primary><option>uucp_from_pattern</option></primary>
35434 </indexterm>
35435 </para>
35436 <informaltable frame="all">
35437 <tgroup cols="4" colsep="0" rowsep="0">
35438 <colspec colwidth="8*" align="left"/>
35439 <colspec colwidth="6*" align="center"/>
35440 <colspec colwidth="6*" align="center"/>
35441 <colspec colwidth="6*" align="right"/>
35442 <tbody>
35443 <row>
35444 <entry><option>uucp_from_pattern</option></entry>
35445 <entry>Use: <emphasis>main</emphasis></entry>
35446 <entry>Type: <emphasis>string</emphasis></entry>
35447 <entry>Default: <emphasis>see below</emphasis></entry>
35448 </row>
35449 </tbody>
35450 </tgroup>
35451 </informaltable>
35452 <para>
35453 <indexterm role="concept">
35454 <primary><quote>From</quote> line</primary>
35455 </indexterm>
35456 <indexterm role="concept">
35457 <primary>UUCP</primary>
35458 <secondary><quote>From</quote> line</secondary>
35459 </indexterm>
35460 Some applications that pass messages to an MTA via a command line interface use
35461 an initial line starting with <quote>From&nbsp;</quote> to pass the envelope sender. In
35462 particular, this is used by UUCP software. Exim recognizes such a line by means
35463 of a regular expression that is set in <option>uucp_from_pattern</option>. When the pattern
35464 matches, the sender address is constructed by expanding the contents of
35465 <option>uucp_from_sender</option>, provided that the caller of Exim is a trusted user. The
35466 default pattern recognizes lines in the following two forms:
35467 </para>
35468 <literallayout class="monospaced">
35469 From ph10 Fri Jan  5 12:35 GMT 1996
35470 From ph10 Fri, 7 Jan 97 14:00:00 GMT
35471 </literallayout>
35472 <para>
35473 The pattern can be seen by running
35474 </para>
35475 <literallayout class="monospaced">
35476 exim -bP uucp_from_pattern
35477 </literallayout>
35478 <para>
35479 It checks only up to the hours and minutes, and allows for a 2-digit or 4-digit
35480 year in the second case. The first word after <quote>From&nbsp;</quote> is matched in the
35481 regular expression by a parenthesized subpattern. The default value for
35482 <option>uucp_from_sender</option> is <quote>$1</quote>, which therefore just uses this first word
35483 (<quote>ph10</quote> in the example above) as the message&#x2019;s sender. See also
35484 <option>ignore_fromline_hosts</option>.
35485 </para>
35486 <para>
35487 <indexterm role="option">
35488 <primary><option>uucp_from_sender</option></primary>
35489 </indexterm>
35490 </para>
35491 <informaltable frame="all">
35492 <tgroup cols="4" colsep="0" rowsep="0">
35493 <colspec colwidth="8*" align="left"/>
35494 <colspec colwidth="6*" align="center"/>
35495 <colspec colwidth="6*" align="center"/>
35496 <colspec colwidth="6*" align="right"/>
35497 <tbody>
35498 <row>
35499 <entry><option>uucp_from_sender</option></entry>
35500 <entry>Use: <emphasis>main</emphasis></entry>
35501 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35502 <entry>Default: <emphasis><literal>$1</literal></emphasis></entry>
35503 </row>
35504 </tbody>
35505 </tgroup>
35506 </informaltable>
35507 <para>
35508 See <option>uucp_from_pattern</option> above.
35509 </para>
35510 <para>
35511 <indexterm role="option">
35512 <primary><option>warn_message_file</option></primary>
35513 </indexterm>
35514 </para>
35515 <informaltable frame="all">
35516 <tgroup cols="4" colsep="0" rowsep="0">
35517 <colspec colwidth="8*" align="left"/>
35518 <colspec colwidth="6*" align="center"/>
35519 <colspec colwidth="6*" align="center"/>
35520 <colspec colwidth="6*" align="right"/>
35521 <tbody>
35522 <row>
35523 <entry><option>warn_message_file</option></entry>
35524 <entry>Use: <emphasis>main</emphasis></entry>
35525 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35526 <entry>Default: <emphasis>unset</emphasis></entry>
35527 </row>
35528 </tbody>
35529 </tgroup>
35530 </informaltable>
35531 <para>
35532 <indexterm role="concept">
35533 <primary>warning of delay</primary>
35534 <secondary>customizing the message</secondary>
35535 </indexterm>
35536 <indexterm role="concept">
35537 <primary>customizing</primary>
35538 <secondary>warning message</secondary>
35539 </indexterm>
35540 This option defines a template file containing paragraphs of text to be used
35541 for constructing the warning message which is sent by Exim when a message has
35542 been in the queue for a specified amount of time, as specified by
35543 <option>delay_warning</option>. Details of the file&#x2019;s contents are given in chapter
35544 <xref linkend="CHAPemsgcust"/>.
35545 <indexterm role="concept">
35546 <primary>warn_message_file</primary>
35547 <secondary>tainted data</secondary>
35548 </indexterm>
35549 The option is expanded to give the file path, which must be
35550 absolute and untainted.
35551 See also <option>bounce_message_file</option>.
35552 </para>
35553 <para>
35554 <indexterm role="option">
35555 <primary><option>write_rejectlog</option></primary>
35556 </indexterm>
35557 </para>
35558 <informaltable frame="all">
35559 <tgroup cols="4" colsep="0" rowsep="0">
35560 <colspec colwidth="8*" align="left"/>
35561 <colspec colwidth="6*" align="center"/>
35562 <colspec colwidth="6*" align="center"/>
35563 <colspec colwidth="6*" align="right"/>
35564 <tbody>
35565 <row>
35566 <entry><option>write_rejectlog</option></entry>
35567 <entry>Use: <emphasis>main</emphasis></entry>
35568 <entry>Type: <emphasis>boolean</emphasis></entry>
35569 <entry>Default: <emphasis>true</emphasis></entry>
35570 </row>
35571 </tbody>
35572 </tgroup>
35573 </informaltable>
35574 <para>
35575 <indexterm role="concept">
35576 <primary>reject log</primary>
35577 <secondary>disabling</secondary>
35578 </indexterm>
35579 If this option is set false, Exim no longer writes anything to the reject log.
35580 See chapter <xref linkend="CHAPlog"/> for details of what Exim writes to its logs.
35581 <indexterm role="concept" startref="IIDconfima" class="endofrange"/>
35582 <indexterm role="concept" startref="IIDmaiconf" class="endofrange"/>
35583 </para>
35584 </section>
35585 </chapter>
35586
35587 <chapter id="CHAProutergeneric">
35588 <title>Generic options for routers</title>
35589 <para>
35590 <indexterm role="concept" id="IIDgenoprou1" class="startofrange">
35591 <primary>options</primary>
35592 <secondary>generic; for routers</secondary>
35593 </indexterm>
35594 <indexterm role="concept" id="IIDgenoprou2" class="startofrange">
35595 <primary>generic options</primary>
35596 <secondary>router</secondary>
35597 </indexterm>
35598 This chapter describes the generic options that apply to all routers.
35599 Those that are preconditions are marked with &Dagger; in the <quote>use</quote> field.
35600 </para>
35601 <para>
35602 For a general description of how a router operates, see sections
35603 <xref linkend="SECTrunindrou"/> and <xref linkend="SECTrouprecon"/>. The latter specifies the order in
35604 which the preconditions are tested. The order of expansion of the options that
35605 provide data for a transport is: <option>errors_to</option>, <option>headers_add</option>,
35606 <option>headers_remove</option>, <option>transport</option>.
35607 </para>
35608 <para>
35609 The name of a router is limited to be 64 ASCII characters long;
35610 prior to Exim 4.95 names would be silently truncated at this length, but now
35611 it is enforced.
35612 </para>
35613 <para>
35614 <indexterm role="option">
35615 <primary><option>address_data</option></primary>
35616 </indexterm>
35617 </para>
35618 <informaltable frame="all">
35619 <tgroup cols="4" colsep="0" rowsep="0">
35620 <colspec colwidth="8*" align="left"/>
35621 <colspec colwidth="6*" align="center"/>
35622 <colspec colwidth="6*" align="center"/>
35623 <colspec colwidth="6*" align="right"/>
35624 <tbody>
35625 <row>
35626 <entry><option>address_data</option></entry>
35627 <entry>Use: <emphasis>routers</emphasis></entry>
35628 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35629 <entry>Default: <emphasis>unset</emphasis></entry>
35630 </row>
35631 </tbody>
35632 </tgroup>
35633 </informaltable>
35634 <para>
35635 <indexterm role="concept">
35636 <primary>router</primary>
35637 <secondary>data attached to address</secondary>
35638 </indexterm>
35639 The string is expanded just before the router is run, that is, after all the
35640 precondition tests have succeeded. If the expansion is forced to fail, the
35641 router declines, the value of <option>address_data</option> remains unchanged, and the
35642 <option>more</option> option controls what happens next. Other expansion failures cause
35643 delivery of the address to be deferred.
35644 </para>
35645 <para>
35646 <indexterm role="variable">
35647 <primary><varname>$address_data</varname></primary>
35648 </indexterm>
35649 When the expansion succeeds, the value is retained with the address, and can be
35650 accessed using the variable <varname>$address_data</varname> in the current router, subsequent
35651 routers, and the eventual transport.
35652 </para>
35653 <para>
35654 <emphasis role="bold">Warning</emphasis>: If the current or any subsequent router is a <command>redirect</command> router
35655 that runs a user&#x2019;s filter file, the contents of <varname>$address_data</varname> are accessible
35656 in the filter. This is not normally a problem, because such data is usually
35657 either not confidential or it <quote>belongs</quote> to the current user, but if you do
35658 put confidential data into <varname>$address_data</varname> you need to remember this point.
35659 </para>
35660 <para>
35661 Even if the router declines or passes, the value of <varname>$address_data</varname> remains
35662 with the address, though it can be changed by another <option>address_data</option> setting
35663 on a subsequent router. If a router generates child addresses, the value of
35664 <varname>$address_data</varname> propagates to them. This also applies to the special kind of
35665 <quote>child</quote> that is generated by a router with the <option>unseen</option> option.
35666 </para>
35667 <para>
35668 The idea of <option>address_data</option> is that you can use it to look up a lot of data
35669 for the address once, and then pick out parts of the data later. For example,
35670 you could use a single LDAP lookup to return a string of the form
35671 </para>
35672 <literallayout class="monospaced">
35673 uid=1234 gid=5678 mailbox=/mail/xyz forward=/home/xyz/.forward
35674 </literallayout>
35675 <para>
35676 In the transport you could pick out the mailbox by a setting such as
35677 </para>
35678 <literallayout class="monospaced">
35679 file = ${extract{mailbox}{$address_data}}
35680 </literallayout>
35681 <para>
35682 This makes the configuration file less messy, and also reduces the number of
35683 lookups (though Exim does cache lookups).
35684 </para>
35685 <para>
35686 See also the <option>set</option> option below.
35687 </para>
35688 <para>
35689 <indexterm role="variable">
35690 <primary><varname>$sender_address_data</varname></primary>
35691 </indexterm>
35692 <indexterm role="variable">
35693 <primary><varname>$address_data</varname></primary>
35694 </indexterm>
35695 The <option>address_data</option> facility is also useful as a means of passing information
35696 from one router to another, and from a router to a transport. In addition, if
35697 <varname>$address_data</varname> is set by a router when verifying a recipient address from an
35698 ACL, it remains available for use in the rest of the ACL statement. After
35699 verifying a sender, the value is transferred to <varname>$sender_address_data</varname>.
35700 </para>
35701 <para>
35702 <indexterm role="option">
35703 <primary><option>address_test</option></primary>
35704 </indexterm>
35705 </para>
35706 <informaltable frame="all">
35707 <tgroup cols="4" colsep="0" rowsep="0">
35708 <colspec colwidth="8*" align="left"/>
35709 <colspec colwidth="6*" align="center"/>
35710 <colspec colwidth="6*" align="center"/>
35711 <colspec colwidth="6*" align="right"/>
35712 <tbody>
35713 <row>
35714 <entry><option>address_test</option></entry>
35715 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35716 <entry>Type: <emphasis>boolean</emphasis></entry>
35717 <entry>Default: <emphasis>true</emphasis></entry>
35718 </row>
35719 </tbody>
35720 </tgroup>
35721 </informaltable>
35722 <para>
35723 <indexterm role="option">
35724 <primary><option>-bt</option></primary>
35725 </indexterm>
35726 <indexterm role="concept">
35727 <primary>router</primary>
35728 <secondary>skipping when address testing</secondary>
35729 </indexterm>
35730 If this option is set false, the router is skipped when routing is being tested
35731 by means of the <option>-bt</option> command line option. This can be a convenience when
35732 your first router sends messages to an external scanner, because it saves you
35733 having to set the <quote>already scanned</quote> indicator when testing real address
35734 routing.
35735 </para>
35736 <para>
35737 <indexterm role="option">
35738 <primary><option>cannot_route_message</option></primary>
35739 </indexterm>
35740 </para>
35741 <informaltable frame="all">
35742 <tgroup cols="4" colsep="0" rowsep="0">
35743 <colspec colwidth="8*" align="left"/>
35744 <colspec colwidth="6*" align="center"/>
35745 <colspec colwidth="6*" align="center"/>
35746 <colspec colwidth="6*" align="right"/>
35747 <tbody>
35748 <row>
35749 <entry><option>cannot_route_message</option></entry>
35750 <entry>Use: <emphasis>routers</emphasis></entry>
35751 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35752 <entry>Default: <emphasis>unset</emphasis></entry>
35753 </row>
35754 </tbody>
35755 </tgroup>
35756 </informaltable>
35757 <para>
35758 <indexterm role="concept">
35759 <primary>router</primary>
35760 <secondary>customizing <quote>cannot route</quote> message</secondary>
35761 </indexterm>
35762 <indexterm role="concept">
35763 <primary>customizing</primary>
35764 <secondary><quote>cannot route</quote> message</secondary>
35765 </indexterm>
35766 This option specifies a text message that is used when an address cannot be
35767 routed because Exim has run out of routers. The default message is
35768 <quote>Unrouteable address</quote>. This option is useful only on routers that have
35769 <option>more</option> set false, or on the very last router in a configuration, because the
35770 value that is used is taken from the last router that is considered. This
35771 includes a router that is skipped because its preconditions are not met, as
35772 well as a router that declines. For example, using the default configuration,
35773 you could put:
35774 </para>
35775 <literallayout class="monospaced">
35776 cannot_route_message = Remote domain not found in DNS
35777 </literallayout>
35778 <para>
35779 on the first router, which is a <command>dnslookup</command> router with <option>more</option> set false,
35780 and
35781 </para>
35782 <literallayout class="monospaced">
35783 cannot_route_message = Unknown local user
35784 </literallayout>
35785 <para>
35786 on the final router that checks for local users. If string expansion fails for
35787 this option, the default message is used. Unless the expansion failure was
35788 explicitly forced, a message about the failure is written to the main and panic
35789 logs, in addition to the normal message about the routing failure.
35790 </para>
35791 <para>
35792 <indexterm role="option">
35793 <primary><option>caseful_local_part</option></primary>
35794 </indexterm>
35795 </para>
35796 <informaltable frame="all">
35797 <tgroup cols="4" colsep="0" rowsep="0">
35798 <colspec colwidth="8*" align="left"/>
35799 <colspec colwidth="6*" align="center"/>
35800 <colspec colwidth="6*" align="center"/>
35801 <colspec colwidth="6*" align="right"/>
35802 <tbody>
35803 <row>
35804 <entry><option>caseful_local_part</option></entry>
35805 <entry>Use: <emphasis>routers</emphasis></entry>
35806 <entry>Type: <emphasis>boolean</emphasis></entry>
35807 <entry>Default: <emphasis>false</emphasis></entry>
35808 </row>
35809 </tbody>
35810 </tgroup>
35811 </informaltable>
35812 <para>
35813 <indexterm role="concept">
35814 <primary>case of local parts</primary>
35815 </indexterm>
35816 <indexterm role="concept">
35817 <primary>router</primary>
35818 <secondary>case of local parts</secondary>
35819 </indexterm>
35820 By default, routers handle the local parts of addresses in a case-insensitive
35821 manner, though the actual case is preserved for transmission with the message.
35822 If you want the case of letters to be significant in a router, you must set
35823 this option true. For individual router options that contain address or local
35824 part lists (for example, <option>local_parts</option>), case-sensitive matching can be
35825 turned on by <quote>+caseful</quote> as a list item. See section <xref linkend="SECTcasletadd"/> for
35826 more details.
35827 </para>
35828 <para>
35829 <indexterm role="variable">
35830 <primary><varname>$local_part</varname></primary>
35831 </indexterm>
35832 <indexterm role="variable">
35833 <primary><varname>$original_local_part</varname></primary>
35834 </indexterm>
35835 <indexterm role="variable">
35836 <primary><varname>$parent_local_part</varname></primary>
35837 </indexterm>
35838 The value of the <varname>$local_part</varname> variable is forced to lower case while a
35839 router is running unless <option>caseful_local_part</option> is set. When a router assigns
35840 an address to a transport, the value of <varname>$local_part</varname> when the transport runs
35841 is the same as it was in the router. Similarly, when a router generates child
35842 addresses by aliasing or forwarding, the values of <varname>$original_local_part</varname>
35843 and <varname>$parent_local_part</varname> are those that were used by the redirecting router.
35844 </para>
35845 <para>
35846 This option applies to the processing of an address by a router. When a
35847 recipient address is being processed in an ACL, there is a separate <option>control</option>
35848 modifier that can be used to specify case-sensitive processing within the ACL
35849 (see section <xref linkend="SECTcontrols"/>).
35850 </para>
35851 <para>
35852 <indexterm role="option">
35853 <primary><option>check_local_user</option></primary>
35854 </indexterm>
35855 </para>
35856 <informaltable frame="all">
35857 <tgroup cols="4" colsep="0" rowsep="0">
35858 <colspec colwidth="8*" align="left"/>
35859 <colspec colwidth="6*" align="center"/>
35860 <colspec colwidth="6*" align="center"/>
35861 <colspec colwidth="6*" align="right"/>
35862 <tbody>
35863 <row>
35864 <entry><option>check_local_user</option></entry>
35865 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35866 <entry>Type: <emphasis>boolean</emphasis></entry>
35867 <entry>Default: <emphasis>false</emphasis></entry>
35868 </row>
35869 </tbody>
35870 </tgroup>
35871 </informaltable>
35872 <para>
35873 <indexterm role="concept">
35874 <primary>local user, checking in router</primary>
35875 </indexterm>
35876 <indexterm role="concept">
35877 <primary>router</primary>
35878 <secondary>checking for local user</secondary>
35879 </indexterm>
35880 <indexterm role="concept">
35881 <primary><filename>/etc/passwd</filename></primary>
35882 </indexterm>
35883 <indexterm role="variable">
35884 <primary><varname>$home</varname></primary>
35885 </indexterm>
35886 When this option is true, Exim checks that the local part of the recipient
35887 address (with affixes removed if relevant) is the name of an account on the
35888 local system. The check is done by calling the <function>getpwnam()</function> function rather
35889 than trying to read <filename>/etc/passwd</filename> directly. This means that other methods of
35890 holding password data (such as NIS) are supported. If the local part is a local
35891 user,
35892 <indexterm role="concept">
35893 <primary>tainted data</primary>
35894 <secondary>de-tainting</secondary>
35895 </indexterm>
35896 <indexterm role="concept">
35897 <primary>de-tainting</primary>
35898 <secondary>using router check_local_user option</secondary>
35899 </indexterm>
35900 <varname>$local_part_data</varname> is set to an untainted version of the local part and
35901 <varname>$home</varname> is set from the password data. The latter can be tested in other
35902 preconditions that are evaluated after this one (the order of evaluation is
35903 given in section <xref linkend="SECTrouprecon"/>). However, the value of <varname>$home</varname> can be
35904 overridden by <option>router_home_directory</option>. If the local part is not a local user,
35905 the router is skipped.
35906 </para>
35907 <para>
35908 If you want to check that the local part is either the name of a local user
35909 or matches something else, you cannot combine <option>check_local_user</option> with a
35910 setting of <option>local_parts</option>, because that specifies the logical <emphasis>and</emphasis> of the
35911 two conditions. However, you can use a <command>passwd</command> lookup in a <option>local_parts</option>
35912 setting to achieve this. For example:
35913 </para>
35914 <literallayout class="monospaced">
35915 local_parts = passwd;$local_part : lsearch;/etc/other/users
35916 </literallayout>
35917 <para>
35918 Note, however, that the side effects of <option>check_local_user</option> (such as setting
35919 up a home directory) do not occur when a <command>passwd</command> lookup is used in a
35920 <option>local_parts</option> (or any other) precondition.
35921 </para>
35922 <para>
35923 <indexterm role="option">
35924 <primary><option>condition</option></primary>
35925 </indexterm>
35926 </para>
35927 <informaltable frame="all">
35928 <tgroup cols="4" colsep="0" rowsep="0">
35929 <colspec colwidth="8*" align="left"/>
35930 <colspec colwidth="6*" align="center"/>
35931 <colspec colwidth="6*" align="center"/>
35932 <colspec colwidth="6*" align="right"/>
35933 <tbody>
35934 <row>
35935 <entry><option>condition</option></entry>
35936 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
35937 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
35938 <entry>Default: <emphasis>unset</emphasis></entry>
35939 </row>
35940 </tbody>
35941 </tgroup>
35942 </informaltable>
35943 <para>
35944 <indexterm role="concept">
35945 <primary>router</primary>
35946 <secondary>customized precondition</secondary>
35947 </indexterm>
35948 This option specifies a general precondition test that has to succeed for the
35949 router to be called. The <option>condition</option> option is the last precondition to be
35950 evaluated (see section <xref linkend="SECTrouprecon"/>). The string is expanded, and if the
35951 result is a forced failure, or an empty string, or one of the strings <quote>0</quote> or
35952 <quote>no</quote> or <quote>false</quote> (checked without regard to the case of the letters), the
35953 router is skipped, and the address is offered to the next one.
35954 </para>
35955 <para>
35956 If the result is any other value, the router is run (as this is the last
35957 precondition to be evaluated, all the other preconditions must be true).
35958 </para>
35959 <para>
35960 This option is unusual in that multiple <option>condition</option> options may be present.
35961 All <option>condition</option> options must succeed.
35962 </para>
35963 <para>
35964 The <option>condition</option> option provides a means of applying custom conditions to the
35965 running of routers. Note that in the case of a simple conditional expansion,
35966 the default expansion values are exactly what is wanted. For example:
35967 </para>
35968 <literallayout class="monospaced">
35969 condition = ${if &gt;{$message_age}{600}}
35970 </literallayout>
35971 <para>
35972 Because of the default behaviour of the string expansion, this is equivalent to
35973 </para>
35974 <literallayout class="monospaced">
35975 condition = ${if &gt;{$message_age}{600}{true}{}}
35976 </literallayout>
35977 <para>
35978 A multiple condition example, which succeeds:
35979 </para>
35980 <literallayout class="monospaced">
35981 condition = ${if &gt;{$message_age}{600}}
35982 condition = ${if !eq{${lc:$local_part}}{postmaster}}
35983 condition = foobar
35984 </literallayout>
35985 <para>
35986 If the expansion fails (other than forced failure) delivery is deferred. Some
35987 of the other precondition options are common special cases that could in fact
35988 be specified using <option>condition</option>.
35989 </para>
35990 <para>
35991 Historical note: We have <option>condition</option> on ACLs and on Routers.  Routers
35992 are far older, and use one set of semantics.  ACLs are newer and when
35993 they were created, the ACL <option>condition</option> process was given far stricter
35994 parse semantics.  The <option>bool{}</option> expansion condition uses the same rules as
35995 ACLs.  The <option>bool_lax{}</option> expansion condition uses the same rules as
35996 Routers.  More pointedly, the <option>bool_lax{}</option> was written to match the existing
35997 Router rules processing behavior.
35998 </para>
35999 <para>
36000 This is best illustrated in an example:
36001 </para>
36002 <literallayout class="monospaced">
36003 # If used in an ACL condition will fail with a syntax error, but
36004 # in a router condition any extra characters are treated as a string
36005
36006 $ exim -be '${if eq {${lc:GOOGLE.com}} {google.com}} {yes} {no}}'
36007 true {yes} {no}}
36008
36009 $ exim -be '${if eq {${lc:WHOIS.com}} {google.com}} {yes} {no}}'
36010  {yes} {no}}
36011 </literallayout>
36012 <para>
36013 In each example above, the <option>if</option> statement actually ends after
36014 <quote>{google.com}}</quote>.  Since no true or false braces were defined, the
36015 default <option>if</option> behavior is to return a boolean true or a null answer
36016 (which evaluates to false). The rest of the line is then treated as a
36017 string. So the first example resulted in the boolean answer <quote>true</quote>
36018 with the string <quote> {yes} {no}}</quote> appended to it. The second example
36019 resulted in the null output (indicating false) with the string
36020 <quote> {yes} {no}}</quote> appended to it.
36021 </para>
36022 <para>
36023 In fact you can put excess forward braces in too.  In the router
36024 <option>condition</option>, Exim&#x2019;s parser only looks for <quote>{</quote> symbols when they
36025 mean something, like after a <quote>$</quote> or when required as part of a
36026 conditional.  But otherwise <quote>{</quote> and <quote>}</quote> are treated as ordinary
36027 string characters.
36028 </para>
36029 <para>
36030 Thus, in a Router, the above expansion strings will both always evaluate
36031 true, as the result of expansion is a non-empty string which doesn&#x2019;t
36032 match an explicit false value.  This can be tricky to debug.  By
36033 contrast, in an ACL either of those strings will always result in an
36034 expansion error because the result doesn&#x2019;t look sufficiently boolean.
36035 </para>
36036 <para>
36037 <indexterm role="option">
36038 <primary><option>debug_print</option></primary>
36039 </indexterm>
36040 </para>
36041 <informaltable frame="all">
36042 <tgroup cols="4" colsep="0" rowsep="0">
36043 <colspec colwidth="8*" align="left"/>
36044 <colspec colwidth="6*" align="center"/>
36045 <colspec colwidth="6*" align="center"/>
36046 <colspec colwidth="6*" align="right"/>
36047 <tbody>
36048 <row>
36049 <entry><option>debug_print</option></entry>
36050 <entry>Use: <emphasis>routers</emphasis></entry>
36051 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36052 <entry>Default: <emphasis>unset</emphasis></entry>
36053 </row>
36054 </tbody>
36055 </tgroup>
36056 </informaltable>
36057 <para>
36058 <indexterm role="concept">
36059 <primary>testing</primary>
36060 <secondary>variables in drivers</secondary>
36061 </indexterm>
36062 If this option is set and debugging is enabled (see the <option>-d</option> command line
36063 option) or in address-testing mode (see the <option>-bt</option> command line option),
36064 the string is expanded and included in the debugging output.
36065 If expansion of the string fails, the error message is written to the debugging
36066 output, and Exim carries on processing.
36067 This option is provided to help with checking out the values of variables and
36068 so on when debugging router configurations. For example, if a <option>condition</option>
36069 option appears not to be working, <option>debug_print</option> can be used to output the
36070 variables it references. The output happens after checks for <option>domains</option>,
36071 <option>local_parts</option>, and <option>check_local_user</option> but before any other preconditions
36072 are tested. A newline is added to the text if it does not end with one.
36073 The variable <varname>$router_name</varname> contains the name of the router.
36074 </para>
36075 <para>
36076 <indexterm role="option">
36077 <primary><option>disable_logging</option></primary>
36078 </indexterm>
36079 </para>
36080 <informaltable frame="all">
36081 <tgroup cols="4" colsep="0" rowsep="0">
36082 <colspec colwidth="8*" align="left"/>
36083 <colspec colwidth="6*" align="center"/>
36084 <colspec colwidth="6*" align="center"/>
36085 <colspec colwidth="6*" align="right"/>
36086 <tbody>
36087 <row>
36088 <entry><option>disable_logging</option></entry>
36089 <entry>Use: <emphasis>routers</emphasis></entry>
36090 <entry>Type: <emphasis>boolean</emphasis></entry>
36091 <entry>Default: <emphasis>false</emphasis></entry>
36092 </row>
36093 </tbody>
36094 </tgroup>
36095 </informaltable>
36096 <para>
36097 If this option is set true, nothing is logged for any routing errors
36098 or for any deliveries caused by this router. You should not set this option
36099 unless you really, really know what you are doing. See also the generic
36100 transport option of the same name.
36101 </para>
36102 <para>
36103 <indexterm role="option">
36104 <primary><option>dnssec_request_domains</option></primary>
36105 </indexterm>
36106 </para>
36107 <informaltable frame="all">
36108 <tgroup cols="4" colsep="0" rowsep="0">
36109 <colspec colwidth="8*" align="left"/>
36110 <colspec colwidth="6*" align="center"/>
36111 <colspec colwidth="6*" align="center"/>
36112 <colspec colwidth="6*" align="right"/>
36113 <tbody>
36114 <row>
36115 <entry><option>dnssec_request_domains</option></entry>
36116 <entry>Use: <emphasis>routers</emphasis></entry>
36117 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36118 <entry>Default: <emphasis>*</emphasis></entry>
36119 </row>
36120 </tbody>
36121 </tgroup>
36122 </informaltable>
36123 <para>
36124 <indexterm role="concept">
36125 <primary>MX record</primary>
36126 <secondary>security</secondary>
36127 </indexterm>
36128 <indexterm role="concept">
36129 <primary>DNSSEC</primary>
36130 <secondary>MX lookup</secondary>
36131 </indexterm>
36132 <indexterm role="concept">
36133 <primary>security</primary>
36134 <secondary>MX lookup</secondary>
36135 </indexterm>
36136 <indexterm role="concept">
36137 <primary>DNS</primary>
36138 <secondary>DNSSEC</secondary>
36139 </indexterm>
36140 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
36141 the DNSSEC request bit set.
36142 This applies to all of the SRV, MX, AAAA, A lookup sequence.
36143 </para>
36144 <para>
36145 <indexterm role="option">
36146 <primary><option>dnssec_require_domains</option></primary>
36147 </indexterm>
36148 </para>
36149 <informaltable frame="all">
36150 <tgroup cols="4" colsep="0" rowsep="0">
36151 <colspec colwidth="8*" align="left"/>
36152 <colspec colwidth="6*" align="center"/>
36153 <colspec colwidth="6*" align="center"/>
36154 <colspec colwidth="6*" align="right"/>
36155 <tbody>
36156 <row>
36157 <entry><option>dnssec_require_domains</option></entry>
36158 <entry>Use: <emphasis>routers</emphasis></entry>
36159 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36160 <entry>Default: <emphasis>unset</emphasis></entry>
36161 </row>
36162 </tbody>
36163 </tgroup>
36164 </informaltable>
36165 <para>
36166 <indexterm role="concept">
36167 <primary>MX record</primary>
36168 <secondary>security</secondary>
36169 </indexterm>
36170 <indexterm role="concept">
36171 <primary>DNSSEC</primary>
36172 <secondary>MX lookup</secondary>
36173 </indexterm>
36174 <indexterm role="concept">
36175 <primary>security</primary>
36176 <secondary>MX lookup</secondary>
36177 </indexterm>
36178 <indexterm role="concept">
36179 <primary>DNS</primary>
36180 <secondary>DNSSEC</secondary>
36181 </indexterm>
36182 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
36183 the DNSSEC request bit set.  Any returns not having the Authenticated Data bit
36184 (AD bit) set will be ignored and logged as a host-lookup failure.
36185 This applies to all of the SRV, MX, AAAA, A lookup sequence.
36186 </para>
36187 <para>
36188 <indexterm role="option">
36189 <primary><option>domains</option></primary>
36190 </indexterm>
36191 </para>
36192 <informaltable frame="all">
36193 <tgroup cols="4" colsep="0" rowsep="0">
36194 <colspec colwidth="8*" align="left"/>
36195 <colspec colwidth="6*" align="center"/>
36196 <colspec colwidth="6*" align="center"/>
36197 <colspec colwidth="6*" align="right"/>
36198 <tbody>
36199 <row>
36200 <entry><option>domains</option></entry>
36201 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36202 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
36203 <entry>Default: <emphasis>unset</emphasis></entry>
36204 </row>
36205 </tbody>
36206 </tgroup>
36207 </informaltable>
36208 <para>
36209 <indexterm role="concept">
36210 <primary>router</primary>
36211 <secondary>restricting to specific domains</secondary>
36212 </indexterm>
36213 <indexterm role="variable">
36214 <primary><varname>$domain_data</varname></primary>
36215 </indexterm>
36216 If this option is set, the router is skipped unless the current domain matches
36217 the list. If the match is achieved by means of a file lookup, the data that the
36218 lookup returned for the domain is placed in <varname>$domain_data</varname> for use in string
36219 expansions of the driver&#x2019;s private options and in the transport.
36220 See section <xref linkend="SECTrouprecon"/> for
36221 a list of the order in which preconditions are evaluated.
36222 </para>
36223 <para>
36224 <indexterm role="option">
36225 <primary><option>driver</option></primary>
36226 </indexterm>
36227 </para>
36228 <informaltable frame="all">
36229 <tgroup cols="4" colsep="0" rowsep="0">
36230 <colspec colwidth="8*" align="left"/>
36231 <colspec colwidth="6*" align="center"/>
36232 <colspec colwidth="6*" align="center"/>
36233 <colspec colwidth="6*" align="right"/>
36234 <tbody>
36235 <row>
36236 <entry><option>driver</option></entry>
36237 <entry>Use: <emphasis>routers</emphasis></entry>
36238 <entry>Type: <emphasis>string</emphasis></entry>
36239 <entry>Default: <emphasis>unset</emphasis></entry>
36240 </row>
36241 </tbody>
36242 </tgroup>
36243 </informaltable>
36244 <para>
36245 This option must always be set. It specifies which of the available routers is
36246 to be used.
36247 </para>
36248 <para>
36249 <indexterm role="option">
36250 <primary><option>dsn_lasthop</option></primary>
36251 </indexterm>
36252 </para>
36253 <informaltable frame="all">
36254 <tgroup cols="4" colsep="0" rowsep="0">
36255 <colspec colwidth="8*" align="left"/>
36256 <colspec colwidth="6*" align="center"/>
36257 <colspec colwidth="6*" align="center"/>
36258 <colspec colwidth="6*" align="right"/>
36259 <tbody>
36260 <row>
36261 <entry><option>dsn_lasthop</option></entry>
36262 <entry>Use: <emphasis>routers</emphasis></entry>
36263 <entry>Type: <emphasis>boolean</emphasis></entry>
36264 <entry>Default: <emphasis>false</emphasis></entry>
36265 </row>
36266 </tbody>
36267 </tgroup>
36268 </informaltable>
36269 <para>
36270 <indexterm role="concept">
36271 <primary>DSN</primary>
36272 <secondary>success</secondary>
36273 </indexterm>
36274 <indexterm role="concept">
36275 <primary>Delivery Status Notification</primary>
36276 <secondary>success</secondary>
36277 </indexterm>
36278 If this option is set true, and extended DSN (RFC3461) processing is in effect,
36279 Exim will not pass on DSN requests to downstream DSN-aware hosts but will
36280 instead send a success DSN as if the next hop does not support DSN.
36281 Not effective on redirect routers.
36282 </para>
36283 <para>
36284 <indexterm role="option">
36285 <primary><option>errors_to</option></primary>
36286 </indexterm>
36287 </para>
36288 <informaltable frame="all">
36289 <tgroup cols="4" colsep="0" rowsep="0">
36290 <colspec colwidth="8*" align="left"/>
36291 <colspec colwidth="6*" align="center"/>
36292 <colspec colwidth="6*" align="center"/>
36293 <colspec colwidth="6*" align="right"/>
36294 <tbody>
36295 <row>
36296 <entry><option>errors_to</option></entry>
36297 <entry>Use: <emphasis>routers</emphasis></entry>
36298 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36299 <entry>Default: <emphasis>unset</emphasis></entry>
36300 </row>
36301 </tbody>
36302 </tgroup>
36303 </informaltable>
36304 <para>
36305 <indexterm role="concept">
36306 <primary>envelope from</primary>
36307 </indexterm>
36308 <indexterm role="concept">
36309 <primary>envelope sender</primary>
36310 </indexterm>
36311 <indexterm role="concept">
36312 <primary>router</primary>
36313 <secondary>changing address for errors</secondary>
36314 </indexterm>
36315 If a router successfully handles an address, it may assign the address to a
36316 transport for delivery or it may generate child addresses. In both cases, if
36317 there is a delivery problem during later processing, the resulting bounce
36318 message is sent to the address that results from expanding this string,
36319 provided that the address verifies successfully. The <option>errors_to</option> option is
36320 expanded before <option>headers_add</option>, <option>headers_remove</option>, and <option>transport</option>.
36321 </para>
36322 <para>
36323 The <option>errors_to</option> setting associated with an address can be overridden if it
36324 subsequently passes through other routers that have their own <option>errors_to</option>
36325 settings, or if the message is delivered by a transport with a <option>return_path</option>
36326 setting.
36327 </para>
36328 <para>
36329 If <option>errors_to</option> is unset, or the expansion is forced to fail, or the result of
36330 the expansion fails to verify, the errors address associated with the incoming
36331 address is used. At top level, this is the envelope sender. A non-forced
36332 expansion failure causes delivery to be deferred.
36333 </para>
36334 <para>
36335 If an address for which <option>errors_to</option> has been set ends up being delivered over
36336 SMTP, the envelope sender for that delivery is the <option>errors_to</option> value, so that
36337 any bounces that are generated by other MTAs on the delivery route are also
36338 sent there. You can set <option>errors_to</option> to the empty string by either of these
36339 settings:
36340 </para>
36341 <literallayout class="monospaced">
36342 errors_to =
36343 errors_to = ""
36344 </literallayout>
36345 <para>
36346 An expansion item that yields an empty string has the same effect. If you do
36347 this, a locally detected delivery error for addresses processed by this router
36348 no longer gives rise to a bounce message; the error is discarded. If the
36349 address is delivered to a remote host, the return path is set to <literal>&lt;&gt;</literal>, unless
36350 overridden by the <option>return_path</option> option on the transport.
36351 </para>
36352 <para>
36353 <indexterm role="variable">
36354 <primary><varname>$address_data</varname></primary>
36355 </indexterm>
36356 If for some reason you want to discard local errors, but use a non-empty
36357 MAIL command for remote delivery, you can preserve the original return
36358 path in <varname>$address_data</varname> in the router, and reinstate it in the transport by
36359 setting <option>return_path</option>.
36360 </para>
36361 <para>
36362 The most common use of <option>errors_to</option> is to direct mailing list bounces to the
36363 manager of the list, as described in section <xref linkend="SECTmailinglists"/>, or to
36364 implement VERP (Variable Envelope Return Paths) (see section <xref linkend="SECTverp"/>).
36365 </para>
36366 <para>
36367 <indexterm role="option">
36368 <primary><option>expn</option></primary>
36369 </indexterm>
36370 </para>
36371 <informaltable frame="all">
36372 <tgroup cols="4" colsep="0" rowsep="0">
36373 <colspec colwidth="8*" align="left"/>
36374 <colspec colwidth="6*" align="center"/>
36375 <colspec colwidth="6*" align="center"/>
36376 <colspec colwidth="6*" align="right"/>
36377 <tbody>
36378 <row>
36379 <entry><option>expn</option></entry>
36380 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36381 <entry>Type: <emphasis>boolean</emphasis></entry>
36382 <entry>Default: <emphasis>true</emphasis></entry>
36383 </row>
36384 </tbody>
36385 </tgroup>
36386 </informaltable>
36387 <para>
36388 <indexterm role="concept">
36389 <primary>address</primary>
36390 <secondary>testing</secondary>
36391 </indexterm>
36392 <indexterm role="concept">
36393 <primary>testing</primary>
36394 <secondary>addresses</secondary>
36395 </indexterm>
36396 <indexterm role="concept">
36397 <primary>EXPN</primary>
36398 <secondary>router skipping</secondary>
36399 </indexterm>
36400 <indexterm role="concept">
36401 <primary>router</primary>
36402 <secondary>skipping for EXPN</secondary>
36403 </indexterm>
36404 If this option is turned off, the router is skipped when testing an address
36405 as a result of processing an SMTP EXPN command. You might, for example,
36406 want to turn it off on a router for users&#x2019; <filename>.forward</filename> files, while leaving it
36407 on for the system alias file.
36408 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
36409 are evaluated.
36410 </para>
36411 <para>
36412 The use of the SMTP EXPN command is controlled by an ACL (see chapter
36413 <xref linkend="CHAPACL"/>). When Exim is running an EXPN command, it is similar to testing
36414 an address with <option>-bt</option>. Compare VRFY, whose counterpart is <option>-bv</option>.
36415 </para>
36416 <para>
36417 <indexterm role="option">
36418 <primary><option>fail_verify</option></primary>
36419 </indexterm>
36420 </para>
36421 <informaltable frame="all">
36422 <tgroup cols="4" colsep="0" rowsep="0">
36423 <colspec colwidth="8*" align="left"/>
36424 <colspec colwidth="6*" align="center"/>
36425 <colspec colwidth="6*" align="center"/>
36426 <colspec colwidth="6*" align="right"/>
36427 <tbody>
36428 <row>
36429 <entry><option>fail_verify</option></entry>
36430 <entry>Use: <emphasis>routers</emphasis></entry>
36431 <entry>Type: <emphasis>boolean</emphasis></entry>
36432 <entry>Default: <emphasis>false</emphasis></entry>
36433 </row>
36434 </tbody>
36435 </tgroup>
36436 </informaltable>
36437 <para>
36438 <indexterm role="concept">
36439 <primary>router</primary>
36440 <secondary>forcing verification failure</secondary>
36441 </indexterm>
36442 Setting this option has the effect of setting both <option>fail_verify_sender</option> and
36443 <option>fail_verify_recipient</option> to the same value.
36444 </para>
36445 <para>
36446 <indexterm role="option">
36447 <primary><option>fail_verify_recipient</option></primary>
36448 </indexterm>
36449 </para>
36450 <informaltable frame="all">
36451 <tgroup cols="4" colsep="0" rowsep="0">
36452 <colspec colwidth="8*" align="left"/>
36453 <colspec colwidth="6*" align="center"/>
36454 <colspec colwidth="6*" align="center"/>
36455 <colspec colwidth="6*" align="right"/>
36456 <tbody>
36457 <row>
36458 <entry><option>fail_verify_recipient</option></entry>
36459 <entry>Use: <emphasis>routers</emphasis></entry>
36460 <entry>Type: <emphasis>boolean</emphasis></entry>
36461 <entry>Default: <emphasis>false</emphasis></entry>
36462 </row>
36463 </tbody>
36464 </tgroup>
36465 </informaltable>
36466 <para>
36467 If this option is true and an address is accepted by this router when
36468 verifying a recipient, verification fails.
36469 </para>
36470 <para>
36471 <indexterm role="option">
36472 <primary><option>fail_verify_sender</option></primary>
36473 </indexterm>
36474 </para>
36475 <informaltable frame="all">
36476 <tgroup cols="4" colsep="0" rowsep="0">
36477 <colspec colwidth="8*" align="left"/>
36478 <colspec colwidth="6*" align="center"/>
36479 <colspec colwidth="6*" align="center"/>
36480 <colspec colwidth="6*" align="right"/>
36481 <tbody>
36482 <row>
36483 <entry><option>fail_verify_sender</option></entry>
36484 <entry>Use: <emphasis>routers</emphasis></entry>
36485 <entry>Type: <emphasis>boolean</emphasis></entry>
36486 <entry>Default: <emphasis>false</emphasis></entry>
36487 </row>
36488 </tbody>
36489 </tgroup>
36490 </informaltable>
36491 <para>
36492 If this option is true and an address is accepted by this router when
36493 verifying a sender, verification fails.
36494 </para>
36495 <para>
36496 <indexterm role="option">
36497 <primary><option>fallback_hosts</option></primary>
36498 </indexterm>
36499 </para>
36500 <informaltable frame="all">
36501 <tgroup cols="4" colsep="0" rowsep="0">
36502 <colspec colwidth="8*" align="left"/>
36503 <colspec colwidth="6*" align="center"/>
36504 <colspec colwidth="6*" align="center"/>
36505 <colspec colwidth="6*" align="right"/>
36506 <tbody>
36507 <row>
36508 <entry><option>fallback_hosts</option></entry>
36509 <entry>Use: <emphasis>routers</emphasis></entry>
36510 <entry>Type: <emphasis>string list</emphasis></entry>
36511 <entry>Default: <emphasis>unset</emphasis></entry>
36512 </row>
36513 </tbody>
36514 </tgroup>
36515 </informaltable>
36516 <para>
36517 <indexterm role="concept">
36518 <primary>router</primary>
36519 <secondary>fallback hosts</secondary>
36520 </indexterm>
36521 <indexterm role="concept">
36522 <primary>fallback</primary>
36523 <secondary>hosts specified on router</secondary>
36524 </indexterm>
36525 String expansion is not applied to this option. The argument must be a
36526 colon-separated list of host names or IP addresses. The list separator can be
36527 changed (see section <xref linkend="SECTlistsepchange"/>), and a port can be specified with
36528 each name or address. In fact, the format of each item is exactly the same as
36529 defined for the list of hosts in a <command>manualroute</command> router (see section
36530 <xref linkend="SECTformatonehostitem"/>).
36531 </para>
36532 <para>
36533 If a router queues an address for a remote transport, this host list is
36534 associated with the address, and used instead of the transport&#x2019;s fallback host
36535 list. If <option>hosts_randomize</option> is set on the transport, the order of the list is
36536 randomized for each use. See the <option>fallback_hosts</option> option of the <command>smtp</command>
36537 transport for further details.
36538 </para>
36539 <para>
36540 <indexterm role="option">
36541 <primary><option>group</option></primary>
36542 </indexterm>
36543 </para>
36544 <informaltable frame="all">
36545 <tgroup cols="4" colsep="0" rowsep="0">
36546 <colspec colwidth="8*" align="left"/>
36547 <colspec colwidth="6*" align="center"/>
36548 <colspec colwidth="6*" align="center"/>
36549 <colspec colwidth="6*" align="right"/>
36550 <tbody>
36551 <row>
36552 <entry><option>group</option></entry>
36553 <entry>Use: <emphasis>routers</emphasis></entry>
36554 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
36555 <entry>Default: <emphasis>see below</emphasis></entry>
36556 </row>
36557 </tbody>
36558 </tgroup>
36559 </informaltable>
36560 <para>
36561 <indexterm role="concept">
36562 <primary>gid (group id)</primary>
36563 <secondary>local delivery</secondary>
36564 </indexterm>
36565 <indexterm role="concept">
36566 <primary>local transports</primary>
36567 <secondary>uid and gid</secondary>
36568 </indexterm>
36569 <indexterm role="concept">
36570 <primary>transport</primary>
36571 <secondary>local</secondary>
36572 </indexterm>
36573 <indexterm role="concept">
36574 <primary>router</primary>
36575 <secondary>setting group</secondary>
36576 </indexterm>
36577 When a router queues an address for a transport, and the transport does not
36578 specify a group, the group given here is used when running the delivery
36579 process.
36580 The group may be specified numerically or by name. If expansion fails, the
36581 error is logged and delivery is deferred.
36582 The default is unset, unless <option>check_local_user</option> is set, when the default
36583 is taken from the password information. See also <option>initgroups</option> and <option>user</option>
36584 and the discussion in chapter <xref linkend="CHAPenvironment"/>.
36585 </para>
36586 <para>
36587 <indexterm role="option">
36588 <primary><option>headers_add</option></primary>
36589 </indexterm>
36590 </para>
36591 <informaltable frame="all">
36592 <tgroup cols="4" colsep="0" rowsep="0">
36593 <colspec colwidth="8*" align="left"/>
36594 <colspec colwidth="6*" align="center"/>
36595 <colspec colwidth="6*" align="center"/>
36596 <colspec colwidth="6*" align="right"/>
36597 <tbody>
36598 <row>
36599 <entry><option>headers_add</option></entry>
36600 <entry>Use: <emphasis>routers</emphasis></entry>
36601 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
36602 <entry>Default: <emphasis>unset</emphasis></entry>
36603 </row>
36604 </tbody>
36605 </tgroup>
36606 </informaltable>
36607 <para>
36608 <indexterm role="concept">
36609 <primary>header lines</primary>
36610 <secondary>adding</secondary>
36611 </indexterm>
36612 <indexterm role="concept">
36613 <primary>router</primary>
36614 <secondary>adding header lines</secondary>
36615 </indexterm>
36616 This option specifies a list of text headers,
36617 newline-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
36618 that is associated with any addresses that are accepted by the router.
36619 Each item is separately expanded, at routing time.  However, this
36620 option has no effect when an address is just being verified. The way in which
36621 the text is used to add header lines at transport time is described in section
36622 <xref linkend="SECTheadersaddrem"/>. New header lines are not actually added until the
36623 message is in the process of being transported. This means that references to
36624 header lines in string expansions in the transport&#x2019;s configuration do not
36625 <quote>see</quote> the added header lines.
36626 </para>
36627 <para>
36628 The <option>headers_add</option> option is expanded after <option>errors_to</option>, but before
36629 <option>headers_remove</option> and <option>transport</option>. If an item is empty, or if
36630 an item expansion is forced to fail, the item has no effect. Other expansion
36631 failures are treated as configuration errors.
36632 </para>
36633 <para>
36634 Unlike most options, <option>headers_add</option> can be specified multiple times
36635 for a router; all listed headers are added.
36636 </para>
36637 <para>
36638 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_add</option> option cannot be used for a <command>redirect</command>
36639 router that has the <option>one_time</option> option set.
36640 </para>
36641 <para>
36642 <indexterm role="concept">
36643 <primary>duplicate addresses</primary>
36644 </indexterm>
36645 <indexterm role="option">
36646 <primary><option>unseen</option></primary>
36647 </indexterm>
36648 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
36649 additions are deleted when the address is passed on to subsequent routers.
36650 For a <option>redirect</option> router, if a generated address is the same as the incoming
36651 address, this can lead to duplicate addresses with different header
36652 modifications. Exim does not do duplicate deliveries (except, in certain
36653 circumstances, to pipes -- see section <xref linkend="SECTdupaddr"/>), but it is undefined
36654 which of the duplicates is discarded, so this ambiguous situation should be
36655 avoided. The <option>repeat_use</option> option of the <option>redirect</option> router may be of help.
36656 </para>
36657 <para>
36658 <indexterm role="option">
36659 <primary><option>headers_remove</option></primary>
36660 </indexterm>
36661 </para>
36662 <informaltable frame="all">
36663 <tgroup cols="4" colsep="0" rowsep="0">
36664 <colspec colwidth="8*" align="left"/>
36665 <colspec colwidth="6*" align="center"/>
36666 <colspec colwidth="6*" align="center"/>
36667 <colspec colwidth="6*" align="right"/>
36668 <tbody>
36669 <row>
36670 <entry><option>headers_remove</option></entry>
36671 <entry>Use: <emphasis>routers</emphasis></entry>
36672 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
36673 <entry>Default: <emphasis>unset</emphasis></entry>
36674 </row>
36675 </tbody>
36676 </tgroup>
36677 </informaltable>
36678 <para>
36679 <indexterm role="concept">
36680 <primary>header lines</primary>
36681 <secondary>removing</secondary>
36682 </indexterm>
36683 <indexterm role="concept">
36684 <primary>router</primary>
36685 <secondary>removing header lines</secondary>
36686 </indexterm>
36687 This option specifies a list of text headers,
36688 colon-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
36689 that is associated with any addresses that are accepted by the router.
36690 However, the option has no effect when an address is just being verified.
36691 Each list item is separately expanded, at transport time.
36692 If an item ends in *, it will match any header with the given prefix.
36693 The way in which
36694 the text is used to remove header lines at transport time is described in
36695 section <xref linkend="SECTheadersaddrem"/>. Header lines are not actually removed until
36696 the message is in the process of being transported. This means that references
36697 to header lines in string expansions in the transport&#x2019;s configuration still
36698 <quote>see</quote> the original header lines.
36699 </para>
36700 <para>
36701 The <option>headers_remove</option> option is handled after <option>errors_to</option> and
36702 <option>headers_add</option>, but before <option>transport</option>. If an item expansion is forced to fail,
36703 the item has no effect. Other expansion failures are treated as configuration
36704 errors.
36705 </para>
36706 <para>
36707 Unlike most options, <option>headers_remove</option> can be specified multiple times
36708 for a router; all listed headers are removed.
36709 </para>
36710 <para>
36711 <emphasis role="bold">Warning 1</emphasis>: The <option>headers_remove</option> option cannot be used for a <command>redirect</command>
36712 router that has the <option>one_time</option> option set.
36713 </para>
36714 <para>
36715 <emphasis role="bold">Warning 2</emphasis>: If the <option>unseen</option> option is set on the router, all header
36716 removal requests are deleted when the address is passed on to subsequent
36717 routers, and this can lead to problems with duplicates -- see the similar
36718 warning for <option>headers_add</option> above.
36719 </para>
36720 <para>
36721 <emphasis role="bold">Warning 3</emphasis>: Because of the separate expansion of the list items,
36722 items that contain a list separator must have it doubled.
36723 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
36724 </para>
36725 <para>
36726 <indexterm role="option">
36727 <primary><option>ignore_target_hosts</option></primary>
36728 </indexterm>
36729 </para>
36730 <informaltable frame="all">
36731 <tgroup cols="4" colsep="0" rowsep="0">
36732 <colspec colwidth="8*" align="left"/>
36733 <colspec colwidth="6*" align="center"/>
36734 <colspec colwidth="6*" align="center"/>
36735 <colspec colwidth="6*" align="right"/>
36736 <tbody>
36737 <row>
36738 <entry><option>ignore_target_hosts</option></entry>
36739 <entry>Use: <emphasis>routers</emphasis></entry>
36740 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
36741 <entry>Default: <emphasis>unset</emphasis></entry>
36742 </row>
36743 </tbody>
36744 </tgroup>
36745 </informaltable>
36746 <para>
36747 <indexterm role="concept">
36748 <primary>IP address</primary>
36749 <secondary>discarding</secondary>
36750 </indexterm>
36751 <indexterm role="concept">
36752 <primary>router</primary>
36753 <secondary>discarding IP addresses</secondary>
36754 </indexterm>
36755 Although this option is a host list, it should normally contain IP address
36756 entries rather than names. If any host that is looked up by the router has an
36757 IP address that matches an item in this list, Exim behaves as if that IP
36758 address did not exist. This option allows you to cope with rogue DNS entries
36759 like
36760 </para>
36761 <literallayout class="monospaced">
36762 remote.domain.example.  A  127.0.0.1
36763 </literallayout>
36764 <para>
36765 by setting
36766 </para>
36767 <literallayout class="monospaced">
36768 ignore_target_hosts = 127.0.0.1
36769 </literallayout>
36770 <para>
36771 on the relevant router. If all the hosts found by a <command>dnslookup</command> router are
36772 discarded in this way, the router declines. In a conventional configuration, an
36773 attempt to mail to such a domain would normally provoke the <quote>unrouteable
36774 domain</quote> error, and an attempt to verify an address in the domain would fail.
36775 Similarly, if <option>ignore_target_hosts</option> is set on an <command>ipliteral</command> router, the
36776 router declines if presented with one of the listed addresses.
36777 </para>
36778 <para>
36779 You can use this option to disable the use of IPv4 or IPv6 for mail delivery by
36780 means of the first or the second of the following settings, respectively:
36781 </para>
36782 <literallayout class="monospaced">
36783 ignore_target_hosts = 0.0.0.0/0
36784 ignore_target_hosts = &lt;; 0::0/0
36785 </literallayout>
36786 <para>
36787 The pattern in the first line matches all IPv4 addresses, whereas the pattern
36788 in the second line matches all IPv6 addresses.
36789 </para>
36790 <para>
36791 This option may also be useful for ignoring link-local and site-local IPv6
36792 addresses. Because, like all host lists, the value of <option>ignore_target_hosts</option>
36793 is expanded before use as a list, it is possible to make it dependent on the
36794 domain that is being routed.
36795 </para>
36796 <para>
36797 <indexterm role="variable">
36798 <primary><varname>$host_address</varname></primary>
36799 </indexterm>
36800 During its expansion, <varname>$host_address</varname> is set to the IP address that is being
36801 checked.
36802 </para>
36803 <para>
36804 <indexterm role="option">
36805 <primary><option>initgroups</option></primary>
36806 </indexterm>
36807 </para>
36808 <informaltable frame="all">
36809 <tgroup cols="4" colsep="0" rowsep="0">
36810 <colspec colwidth="8*" align="left"/>
36811 <colspec colwidth="6*" align="center"/>
36812 <colspec colwidth="6*" align="center"/>
36813 <colspec colwidth="6*" align="right"/>
36814 <tbody>
36815 <row>
36816 <entry><option>initgroups</option></entry>
36817 <entry>Use: <emphasis>routers</emphasis></entry>
36818 <entry>Type: <emphasis>boolean</emphasis></entry>
36819 <entry>Default: <emphasis>false</emphasis></entry>
36820 </row>
36821 </tbody>
36822 </tgroup>
36823 </informaltable>
36824 <para>
36825 <indexterm role="concept">
36826 <primary>additional groups</primary>
36827 </indexterm>
36828 <indexterm role="concept">
36829 <primary>groups</primary>
36830 <secondary>additional</secondary>
36831 </indexterm>
36832 <indexterm role="concept">
36833 <primary>local transports</primary>
36834 <secondary>uid and gid</secondary>
36835 </indexterm>
36836 <indexterm role="concept">
36837 <primary>transport</primary>
36838 <secondary>local</secondary>
36839 </indexterm>
36840 If the router queues an address for a transport, and this option is true, and
36841 the uid supplied by the router is not overridden by the transport, the
36842 <function>initgroups()</function> function is called when running the transport to ensure that
36843 any additional groups associated with the uid are set up. See also <option>group</option>
36844 and <option>user</option> and the discussion in chapter <xref linkend="CHAPenvironment"/>.
36845 </para>
36846 <para>
36847 <indexterm role="option">
36848 <primary><option>local_part_prefix</option></primary>
36849 </indexterm>
36850 </para>
36851 <informaltable frame="all">
36852 <tgroup cols="4" colsep="0" rowsep="0">
36853 <colspec colwidth="8*" align="left"/>
36854 <colspec colwidth="6*" align="center"/>
36855 <colspec colwidth="6*" align="center"/>
36856 <colspec colwidth="6*" align="right"/>
36857 <tbody>
36858 <row>
36859 <entry><option>local_part_prefix</option></entry>
36860 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36861 <entry>Type: <emphasis>string list</emphasis></entry>
36862 <entry>Default: <emphasis>unset</emphasis></entry>
36863 </row>
36864 </tbody>
36865 </tgroup>
36866 </informaltable>
36867 <para>
36868 <indexterm role="concept">
36869 <primary>affix</primary>
36870 <secondary>router precondition</secondary>
36871 </indexterm>
36872 <indexterm role="concept">
36873 <primary>router</primary>
36874 <secondary>prefix for local part</secondary>
36875 </indexterm>
36876 <indexterm role="concept">
36877 <primary>prefix</primary>
36878 <secondary>for local part, used in router</secondary>
36879 </indexterm>
36880 If this option is set, the router is skipped unless the local part starts with
36881 one of the given strings, or <option>local_part_prefix_optional</option> is true. See
36882 section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions are
36883 evaluated.
36884 </para>
36885 <para>
36886 The list is scanned from left to right, and the first prefix that matches is
36887 used. A limited form of wildcard is available; if the prefix begins with an
36888 asterisk, it matches the longest possible sequence of arbitrary characters at
36889 the start of the local part. An asterisk should therefore always be followed by
36890 some character that does not occur in normal local parts.
36891 <indexterm role="concept">
36892 <primary>multiple mailboxes</primary>
36893 </indexterm>
36894 <indexterm role="concept">
36895 <primary>mailbox</primary>
36896 <secondary>multiple</secondary>
36897 </indexterm>
36898 Wildcarding can be used to set up multiple user mailboxes, as described in
36899 section <xref linkend="SECTmulbox"/>.
36900 </para>
36901 <para>
36902 <indexterm role="variable">
36903 <primary><varname>$local_part</varname></primary>
36904 </indexterm>
36905 <indexterm role="variable">
36906 <primary><varname>$local_part_prefix</varname></primary>
36907 </indexterm>
36908 During the testing of the <option>local_parts</option> option, and while the router is
36909 running, the prefix is removed from the local part, and is available in the
36910 expansion variable <varname>$local_part_prefix</varname>. When a message is being delivered, if
36911 the router accepts the address, this remains true during subsequent delivery by
36912 a transport. In particular, the local part that is transmitted in the RCPT
36913 command for LMTP, SMTP, and BSMTP deliveries has the prefix removed by default.
36914 This behaviour can be overridden by setting <option>rcpt_include_affixes</option> true on
36915 the relevant transport.
36916 </para>
36917 <para>
36918 <indexterm role="variable">
36919 <primary><varname>$local_part_prefix_v</varname></primary>
36920 </indexterm>
36921 If wildcarding (above) was used then the part of the prefix matching the
36922 wildcard is available in <varname>$local_part_prefix_v</varname>.
36923 </para>
36924 <para>
36925 When an address is being verified, <option>local_part_prefix</option> affects only the
36926 behaviour of the router. If the callout feature of verification is in use, this
36927 means that the full address, including the prefix, will be used during the
36928 callout.
36929 </para>
36930 <para>
36931 The prefix facility is commonly used to handle local parts of the form
36932 <option>owner-something</option>. Another common use is to support local parts of the form
36933 <option>real-username</option> to bypass a user&#x2019;s <filename>.forward</filename> file &ndash; helpful when trying
36934 to tell a user their forwarding is broken &ndash; by placing a router like this one
36935 immediately before the router that handles <filename>.forward</filename> files:
36936 </para>
36937 <literallayout class="monospaced">
36938 real_localuser:
36939   driver = accept
36940   local_part_prefix = real-
36941   check_local_user
36942   transport = local_delivery
36943 </literallayout>
36944 <para>
36945 For security, it would probably be a good idea to restrict the use of this
36946 router to locally-generated messages, using a condition such as this:
36947 </para>
36948 <literallayout class="monospaced">
36949   condition = ${if match {$sender_host_address}\
36950                          {\N^(|127\.0\.0\.1)$\N}}
36951 </literallayout>
36952 <para>
36953 If both <option>local_part_prefix</option> and <option>local_part_suffix</option> are set for a router,
36954 both conditions must be met if not optional. Care must be taken if wildcards
36955 are used in both a prefix and a suffix on the same router. Different
36956 separator characters must be used to avoid ambiguity.
36957 </para>
36958 <para>
36959 <indexterm role="option">
36960 <primary><option>local_part_prefix_optional</option></primary>
36961 </indexterm>
36962 </para>
36963 <informaltable frame="all">
36964 <tgroup cols="4" colsep="0" rowsep="0">
36965 <colspec colwidth="8*" align="left"/>
36966 <colspec colwidth="6*" align="center"/>
36967 <colspec colwidth="6*" align="center"/>
36968 <colspec colwidth="6*" align="right"/>
36969 <tbody>
36970 <row>
36971 <entry><option>local_part_prefix_optional</option></entry>
36972 <entry>Use: <emphasis>routers</emphasis></entry>
36973 <entry>Type: <emphasis>boolean</emphasis></entry>
36974 <entry>Default: <emphasis>false</emphasis></entry>
36975 </row>
36976 </tbody>
36977 </tgroup>
36978 </informaltable>
36979 <para>
36980 See <option>local_part_prefix</option> above.
36981 </para>
36982 <para>
36983 <indexterm role="option">
36984 <primary><option>local_part_suffix</option></primary>
36985 </indexterm>
36986 </para>
36987 <informaltable frame="all">
36988 <tgroup cols="4" colsep="0" rowsep="0">
36989 <colspec colwidth="8*" align="left"/>
36990 <colspec colwidth="6*" align="center"/>
36991 <colspec colwidth="6*" align="center"/>
36992 <colspec colwidth="6*" align="right"/>
36993 <tbody>
36994 <row>
36995 <entry><option>local_part_suffix</option></entry>
36996 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
36997 <entry>Type: <emphasis>string list</emphasis></entry>
36998 <entry>Default: <emphasis>unset</emphasis></entry>
36999 </row>
37000 </tbody>
37001 </tgroup>
37002 </informaltable>
37003 <para>
37004 <indexterm role="concept">
37005 <primary>router</primary>
37006 <secondary>suffix for local part</secondary>
37007 </indexterm>
37008 <indexterm role="concept">
37009 <primary>suffix for local part</primary>
37010 <secondary>used in router</secondary>
37011 </indexterm>
37012 This option operates in the same way as <option>local_part_prefix</option>, except that the
37013 local part must end (rather than start) with the given string, the
37014 <option>local_part_suffix_optional</option> option determines whether the suffix is
37015 mandatory, and the wildcard * character, if present, must be the last
37016 character of the suffix. This option facility is commonly used to handle local
37017 parts of the form <option>something-request</option> and multiple user mailboxes of the form
37018 <option>username-foo</option>.
37019 </para>
37020 <para>
37021 <indexterm role="option">
37022 <primary><option>local_part_suffix_optional</option></primary>
37023 </indexterm>
37024 </para>
37025 <informaltable frame="all">
37026 <tgroup cols="4" colsep="0" rowsep="0">
37027 <colspec colwidth="8*" align="left"/>
37028 <colspec colwidth="6*" align="center"/>
37029 <colspec colwidth="6*" align="center"/>
37030 <colspec colwidth="6*" align="right"/>
37031 <tbody>
37032 <row>
37033 <entry><option>local_part_suffix_optional</option></entry>
37034 <entry>Use: <emphasis>routers</emphasis></entry>
37035 <entry>Type: <emphasis>boolean</emphasis></entry>
37036 <entry>Default: <emphasis>false</emphasis></entry>
37037 </row>
37038 </tbody>
37039 </tgroup>
37040 </informaltable>
37041 <para>
37042 See <option>local_part_suffix</option> above.
37043 </para>
37044 <para>
37045 <indexterm role="option">
37046 <primary><option>local_parts</option></primary>
37047 </indexterm>
37048 </para>
37049 <informaltable frame="all">
37050 <tgroup cols="4" colsep="0" rowsep="0">
37051 <colspec colwidth="8*" align="left"/>
37052 <colspec colwidth="6*" align="center"/>
37053 <colspec colwidth="6*" align="center"/>
37054 <colspec colwidth="6*" align="right"/>
37055 <tbody>
37056 <row>
37057 <entry><option>local_parts</option></entry>
37058 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37059 <entry>Type: <emphasis>local part list</emphasis>&dagger;<emphasis></emphasis></entry>
37060 <entry>Default: <emphasis>unset</emphasis></entry>
37061 </row>
37062 </tbody>
37063 </tgroup>
37064 </informaltable>
37065 <para>
37066 <indexterm role="concept">
37067 <primary>router</primary>
37068 <secondary>restricting to specific local parts</secondary>
37069 </indexterm>
37070 <indexterm role="concept">
37071 <primary>local part</primary>
37072 <secondary>checking in router</secondary>
37073 </indexterm>
37074 The router is run only if the local part of the address matches the list.
37075 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
37076 are evaluated, and
37077 section <xref linkend="SECTlocparlis"/> for a discussion of local part lists. Because the
37078 string is expanded, it is possible to make it depend on the domain, for
37079 example:
37080 </para>
37081 <literallayout class="monospaced">
37082 local_parts = dbm;/usr/local/specials/$domain_data
37083 </literallayout>
37084 <para>
37085 <indexterm role="variable">
37086 <primary><varname>$local_part_data</varname></primary>
37087 </indexterm>
37088 If the match is achieved by a lookup, the data that the lookup returned
37089 for the local part is placed in the variable <varname>$local_part_data</varname> for use in
37090 expansions of the router&#x2019;s private options or in the transport.
37091 You might use this option, for
37092 example, if you have a large number of local virtual domains, and you want to
37093 send all postmaster mail to the same place without having to set up an alias in
37094 each virtual domain:
37095 </para>
37096 <literallayout class="monospaced">
37097 postmaster:
37098   driver = redirect
37099   local_parts = postmaster
37100   data = postmaster@real.domain.example
37101 </literallayout>
37102 <para>
37103 <indexterm role="option">
37104 <primary><option>log_as_local</option></primary>
37105 </indexterm>
37106 </para>
37107 <informaltable frame="all">
37108 <tgroup cols="4" colsep="0" rowsep="0">
37109 <colspec colwidth="8*" align="left"/>
37110 <colspec colwidth="6*" align="center"/>
37111 <colspec colwidth="6*" align="center"/>
37112 <colspec colwidth="6*" align="right"/>
37113 <tbody>
37114 <row>
37115 <entry><option>log_as_local</option></entry>
37116 <entry>Use: <emphasis>routers</emphasis></entry>
37117 <entry>Type: <emphasis>boolean</emphasis></entry>
37118 <entry>Default: <emphasis>see below</emphasis></entry>
37119 </row>
37120 </tbody>
37121 </tgroup>
37122 </informaltable>
37123 <para>
37124 <indexterm role="concept">
37125 <primary>log</primary>
37126 <secondary>delivery line</secondary>
37127 </indexterm>
37128 <indexterm role="concept">
37129 <primary>delivery</primary>
37130 <secondary>log line format</secondary>
37131 </indexterm>
37132 Exim has two logging styles for delivery, the idea being to make local
37133 deliveries stand out more visibly from remote ones. In the <quote>local</quote> style, the
37134 recipient address is given just as the local part, without a domain. The use of
37135 this style is controlled by this option. It defaults to true for the <command>accept</command>
37136 router, and false for all the others. This option applies only when a
37137 router assigns an address to a transport. It has no effect on routers that
37138 redirect addresses.
37139 </para>
37140 <para>
37141 <indexterm role="option">
37142 <primary><option>more</option></primary>
37143 </indexterm>
37144 </para>
37145 <informaltable frame="all">
37146 <tgroup cols="4" colsep="0" rowsep="0">
37147 <colspec colwidth="8*" align="left"/>
37148 <colspec colwidth="6*" align="center"/>
37149 <colspec colwidth="6*" align="center"/>
37150 <colspec colwidth="6*" align="right"/>
37151 <tbody>
37152 <row>
37153 <entry><option>more</option></entry>
37154 <entry>Use: <emphasis>routers</emphasis></entry>
37155 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
37156 <entry>Default: <emphasis>true</emphasis></entry>
37157 </row>
37158 </tbody>
37159 </tgroup>
37160 </informaltable>
37161 <para>
37162 The result of string expansion for this option must be a valid boolean value,
37163 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
37164 result causes an error, and delivery is deferred. If the expansion is forced to
37165 fail, the default value for the option (true) is used. Other failures cause
37166 delivery to be deferred.
37167 </para>
37168 <para>
37169 If this option is set false, and the router declines to handle the address, no
37170 further routers are tried, routing fails, and the address is bounced.
37171 <indexterm role="option">
37172 <primary><option>self</option></primary>
37173 </indexterm>
37174 However, if the router explicitly passes an address to the following router by
37175 means of the setting
37176 </para>
37177 <literallayout class="monospaced">
37178 self = pass
37179 </literallayout>
37180 <para>
37181 or otherwise, the setting of <option>more</option> is ignored. Also, the setting of <option>more</option>
37182 does not affect the behaviour if one of the precondition tests fails. In that
37183 case, the address is always passed to the next router.
37184 </para>
37185 <para>
37186 Note that <option>address_data</option> is not considered to be a precondition. If its
37187 expansion is forced to fail, the router declines, and the value of <option>more</option>
37188 controls what happens next.
37189 </para>
37190 <para>
37191 <indexterm role="option">
37192 <primary><option>pass_on_timeout</option></primary>
37193 </indexterm>
37194 </para>
37195 <informaltable frame="all">
37196 <tgroup cols="4" colsep="0" rowsep="0">
37197 <colspec colwidth="8*" align="left"/>
37198 <colspec colwidth="6*" align="center"/>
37199 <colspec colwidth="6*" align="center"/>
37200 <colspec colwidth="6*" align="right"/>
37201 <tbody>
37202 <row>
37203 <entry><option>pass_on_timeout</option></entry>
37204 <entry>Use: <emphasis>routers</emphasis></entry>
37205 <entry>Type: <emphasis>boolean</emphasis></entry>
37206 <entry>Default: <emphasis>false</emphasis></entry>
37207 </row>
37208 </tbody>
37209 </tgroup>
37210 </informaltable>
37211 <para>
37212 <indexterm role="concept">
37213 <primary>timeout</primary>
37214 <secondary>of router</secondary>
37215 </indexterm>
37216 <indexterm role="concept">
37217 <primary>router</primary>
37218 <secondary>timeout</secondary>
37219 </indexterm>
37220 If a router times out during a host lookup, it normally causes deferral of the
37221 address. If <option>pass_on_timeout</option> is set, the address is passed on to the next
37222 router, overriding <option>no_more</option>. This may be helpful for systems that are
37223 intermittently connected to the Internet, or those that want to pass to a smart
37224 host any messages that cannot immediately be delivered.
37225 </para>
37226 <para>
37227 There are occasional other temporary errors that can occur while doing DNS
37228 lookups. They are treated in the same way as a timeout, and this option
37229 applies to all of them.
37230 </para>
37231 <para>
37232 <indexterm role="option">
37233 <primary><option>pass_router</option></primary>
37234 </indexterm>
37235 </para>
37236 <informaltable frame="all">
37237 <tgroup cols="4" colsep="0" rowsep="0">
37238 <colspec colwidth="8*" align="left"/>
37239 <colspec colwidth="6*" align="center"/>
37240 <colspec colwidth="6*" align="center"/>
37241 <colspec colwidth="6*" align="right"/>
37242 <tbody>
37243 <row>
37244 <entry><option>pass_router</option></entry>
37245 <entry>Use: <emphasis>routers</emphasis></entry>
37246 <entry>Type: <emphasis>string</emphasis></entry>
37247 <entry>Default: <emphasis>unset</emphasis></entry>
37248 </row>
37249 </tbody>
37250 </tgroup>
37251 </informaltable>
37252 <para>
37253 <indexterm role="concept">
37254 <primary>router</primary>
37255 <secondary>go to after <quote>pass</quote></secondary>
37256 </indexterm>
37257 Routers that recognize the generic <option>self</option> option (<command>dnslookup</command>,
37258 <command>ipliteral</command>, and <command>manualroute</command>) are able to return <quote>pass</quote>, forcing
37259 routing to continue, and overriding a false setting of <option>more</option>. When one of
37260 these routers returns <quote>pass</quote>, the address is normally handed on to the next
37261 router in sequence. This can be changed by setting <option>pass_router</option> to the name
37262 of another router. However (unlike <option>redirect_router</option>) the named router must
37263 be below the current router, to avoid loops. Note that this option applies only
37264 to the special case of <quote>pass</quote>. It does not apply when a router returns
37265 <quote>decline</quote> because it cannot handle an address.
37266 </para>
37267 <para>
37268 <indexterm role="option">
37269 <primary><option>redirect_router</option></primary>
37270 </indexterm>
37271 </para>
37272 <informaltable frame="all">
37273 <tgroup cols="4" colsep="0" rowsep="0">
37274 <colspec colwidth="8*" align="left"/>
37275 <colspec colwidth="6*" align="center"/>
37276 <colspec colwidth="6*" align="center"/>
37277 <colspec colwidth="6*" align="right"/>
37278 <tbody>
37279 <row>
37280 <entry><option>redirect_router</option></entry>
37281 <entry>Use: <emphasis>routers</emphasis></entry>
37282 <entry>Type: <emphasis>string</emphasis></entry>
37283 <entry>Default: <emphasis>unset</emphasis></entry>
37284 </row>
37285 </tbody>
37286 </tgroup>
37287 </informaltable>
37288 <para>
37289 <indexterm role="concept">
37290 <primary>router</primary>
37291 <secondary>start at after redirection</secondary>
37292 </indexterm>
37293 Sometimes an administrator knows that it is pointless to reprocess addresses
37294 generated from alias or forward files with the same router again. For
37295 example, if an alias file translates real names into login ids there is no
37296 point searching the alias file a second time, especially if it is a large file.
37297 </para>
37298 <para>
37299 The <option>redirect_router</option> option can be set to the name of any router instance.
37300 It causes the routing of any generated addresses to start at the named router
37301 instead of at the first router. This option has no effect if the router in
37302 which it is set does not generate new addresses.
37303 </para>
37304 <para>
37305 <indexterm role="option">
37306 <primary><option>require_files</option></primary>
37307 </indexterm>
37308 </para>
37309 <informaltable frame="all">
37310 <tgroup cols="4" colsep="0" rowsep="0">
37311 <colspec colwidth="8*" align="left"/>
37312 <colspec colwidth="6*" align="center"/>
37313 <colspec colwidth="6*" align="center"/>
37314 <colspec colwidth="6*" align="right"/>
37315 <tbody>
37316 <row>
37317 <entry><option>require_files</option></entry>
37318 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37319 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
37320 <entry>Default: <emphasis>unset</emphasis></entry>
37321 </row>
37322 </tbody>
37323 </tgroup>
37324 </informaltable>
37325 <para>
37326 <indexterm role="concept">
37327 <primary>file</primary>
37328 <secondary>requiring for router</secondary>
37329 </indexterm>
37330 <indexterm role="concept">
37331 <primary>router</primary>
37332 <secondary>requiring file existence</secondary>
37333 </indexterm>
37334 This option provides a general mechanism for predicating the running of a
37335 router on the existence or non-existence of certain files or directories.
37336 Before running a router, as one of its precondition tests, Exim works its way
37337 through the <option>require_files</option> list, expanding each item separately.
37338 </para>
37339 <para>
37340 Because the list is split before expansion, any colons in expansion items must
37341 be doubled, or the facility for using a different list separator must be used
37342 (<xref linkend="SECTlistsepchange"/>).
37343 If any expansion is forced to fail, the item is ignored. Other expansion
37344 failures cause routing of the address to be deferred.
37345 </para>
37346 <para>
37347 If any expanded string is empty, it is ignored. Otherwise, except as described
37348 below, each string must be a fully qualified file path, optionally preceded by
37349 <quote>!</quote>. The paths are passed to the <function>stat()</function> function to test for the
37350 existence of the files or directories. The router is skipped if any paths not
37351 preceded by <quote>!</quote> do not exist, or if any paths preceded by <quote>!</quote> do exist.
37352 </para>
37353 <para>
37354 <indexterm role="concept">
37355 <primary>NFS</primary>
37356 </indexterm>
37357 If <function>stat()</function> cannot determine whether a file exists or not, delivery of
37358 the message is deferred. This can happen when NFS-mounted filesystems are
37359 unavailable.
37360 </para>
37361 <para>
37362 This option is checked after the <option>domains</option>, <option>local_parts</option>, and <option>senders</option>
37363 options, so you cannot use it to check for the existence of a file in which to
37364 look up a domain, local part, or sender. (See section <xref linkend="SECTrouprecon"/> for a
37365 full list of the order in which preconditions are evaluated.) However, as
37366 these options are all expanded, you can use the <option>exists</option> expansion condition
37367 to make such tests. The <option>require_files</option> option is intended for checking files
37368 that the router may be going to use internally, or which are needed by a
37369 transport (e.g., <filename>.procmailrc</filename>).
37370 </para>
37371 <para>
37372 During delivery, the <function>stat()</function> function is run as root, but there is a
37373 facility for some checking of the accessibility of a file by another user.
37374 This is not a proper permissions check, but just a <quote>rough</quote> check that
37375 operates as follows:
37376 </para>
37377 <para>
37378 If an item in a <option>require_files</option> list does not contain any forward slash
37379 characters, it is taken to be the user (and optional group, separated by a
37380 comma) to be checked for subsequent files in the list. If no group is specified
37381 but the user is specified symbolically, the gid associated with the uid is
37382 used. For example:
37383 </para>
37384 <literallayout class="monospaced">
37385 require_files = mail:/some/file
37386 require_files = $local_part_data:$home/.procmailrc
37387 </literallayout>
37388 <para>
37389 If a user or group name in a <option>require_files</option> list does not exist, the
37390 <option>require_files</option> condition fails.
37391 </para>
37392 <para>
37393 Exim performs the check by scanning along the components of the file path, and
37394 checking the access for the given uid and gid. It checks for <quote>x</quote> access on
37395 directories, and <quote>r</quote> access on the final file. Note that this means that file
37396 access control lists, if the operating system has them, are ignored.
37397 </para>
37398 <para>
37399 <emphasis role="bold">Warning 1</emphasis>: When the router is being run to verify addresses for an
37400 incoming SMTP message, Exim is not running as root, but under its own uid. This
37401 may affect the result of a <option>require_files</option> check. In particular, <function>stat()</function>
37402 may yield the error EACCES (<quote>Permission denied</quote>). This means that the Exim
37403 user is not permitted to read one of the directories on the file&#x2019;s path.
37404 </para>
37405 <para>
37406 <emphasis role="bold">Warning 2</emphasis>: Even when Exim is running as root while delivering a message,
37407 <function>stat()</function> can yield EACCES for a file in an NFS directory that is mounted
37408 without root access. In this case, if a check for access by a particular user
37409 is requested, Exim creates a subprocess that runs as that user, and tries the
37410 check again in that process.
37411 </para>
37412 <para>
37413 The default action for handling an unresolved EACCES is to consider it to
37414 be caused by a configuration error, and routing is deferred because the
37415 existence or non-existence of the file cannot be determined. However, in some
37416 circumstances it may be desirable to treat this condition as if the file did
37417 not exist. If the filename (or the exclamation mark that precedes the filename
37418 for non-existence) is preceded by a plus sign, the EACCES error is treated
37419 as if the file did not exist. For example:
37420 </para>
37421 <literallayout class="monospaced">
37422 require_files = +/some/file
37423 </literallayout>
37424 <para>
37425 If the router is not an essential part of verification (for example, it
37426 handles users&#x2019; <filename>.forward</filename> files), another solution is to set the <option>verify</option>
37427 option false so that the router is skipped when verifying.
37428 </para>
37429 <para>
37430 <indexterm role="option">
37431 <primary><option>retry_use_local_part</option></primary>
37432 </indexterm>
37433 </para>
37434 <informaltable frame="all">
37435 <tgroup cols="4" colsep="0" rowsep="0">
37436 <colspec colwidth="8*" align="left"/>
37437 <colspec colwidth="6*" align="center"/>
37438 <colspec colwidth="6*" align="center"/>
37439 <colspec colwidth="6*" align="right"/>
37440 <tbody>
37441 <row>
37442 <entry><option>retry_use_local_part</option></entry>
37443 <entry>Use: <emphasis>routers</emphasis></entry>
37444 <entry>Type: <emphasis>boolean</emphasis></entry>
37445 <entry>Default: <emphasis>see below</emphasis></entry>
37446 </row>
37447 </tbody>
37448 </tgroup>
37449 </informaltable>
37450 <para>
37451 <indexterm role="concept">
37452 <primary>hints database</primary>
37453 <secondary>retry keys</secondary>
37454 </indexterm>
37455 <indexterm role="concept">
37456 <primary>local part</primary>
37457 <secondary>in retry keys</secondary>
37458 </indexterm>
37459 When a delivery suffers a temporary routing failure, a retry record is created
37460 in Exim&#x2019;s hints database. For addresses whose routing depends only on the
37461 domain, the key for the retry record should not involve the local part, but for
37462 other addresses, both the domain and the local part should be included.
37463 Usually, remote routing is of the former kind, and local routing is of the
37464 latter kind.
37465 </para>
37466 <para>
37467 This option controls whether the local part is used to form the key for retry
37468 hints for addresses that suffer temporary errors while being handled by this
37469 router. The default value is true for any router that has any of
37470 <option>check_local_user</option>,
37471 <option>local_parts</option>,
37472 <option>condition</option>,
37473 <option>local_part_prefix</option>,
37474 <option>local_part_suffix</option>,
37475 <option>senders</option> or
37476 <option>require_files</option>
37477 set, and false otherwise. Note that this option does not apply to hints keys
37478 for transport delays; they are controlled by a generic transport option of the
37479 same name.
37480 </para>
37481 <para>
37482 Failing to set this option when it is needed
37483 (because a remote router handles only some of the local-parts for a domain)
37484 can result in incorrect error messages being generated.
37485 </para>
37486 <para>
37487 The setting of <option>retry_use_local_part</option> applies only to the router on which it
37488 appears. If the router generates child addresses, they are routed
37489 independently; this setting does not become attached to them.
37490 </para>
37491 <para>
37492 <indexterm role="option">
37493 <primary><option>router_home_directory</option></primary>
37494 </indexterm>
37495 </para>
37496 <informaltable frame="all">
37497 <tgroup cols="4" colsep="0" rowsep="0">
37498 <colspec colwidth="8*" align="left"/>
37499 <colspec colwidth="6*" align="center"/>
37500 <colspec colwidth="6*" align="center"/>
37501 <colspec colwidth="6*" align="right"/>
37502 <tbody>
37503 <row>
37504 <entry><option>router_home_directory</option></entry>
37505 <entry>Use: <emphasis>routers</emphasis></entry>
37506 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37507 <entry>Default: <emphasis>unset</emphasis></entry>
37508 </row>
37509 </tbody>
37510 </tgroup>
37511 </informaltable>
37512 <para>
37513 <indexterm role="concept">
37514 <primary>router</primary>
37515 <secondary>home directory for</secondary>
37516 </indexterm>
37517 <indexterm role="concept">
37518 <primary>home directory</primary>
37519 <secondary>for router</secondary>
37520 </indexterm>
37521 <indexterm role="variable">
37522 <primary><varname>$home</varname></primary>
37523 </indexterm>
37524 This option sets a home directory for use while the router is running. (Compare
37525 <option>transport_home_directory</option>, which sets a home directory for later
37526 transporting.) In particular, if used on a <command>redirect</command> router, this option
37527 sets a value for <varname>$home</varname> while a filter is running. The value is expanded;
37528 forced expansion failure causes the option to be ignored &ndash; other failures
37529 cause the router to defer.
37530 </para>
37531 <para>
37532 Expansion of <option>router_home_directory</option> happens immediately after the
37533 <option>check_local_user</option> test (if configured), before any further expansions take
37534 place.
37535 (See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
37536 are evaluated.)
37537 While the router is running, <option>router_home_directory</option> overrides the value of
37538 <varname>$home</varname> that came from <option>check_local_user</option>.
37539 </para>
37540 <para>
37541 When a router accepts an address and assigns it to a local transport (including
37542 the cases when a <command>redirect</command> router generates a pipe, file, or autoreply
37543 delivery), the home directory setting for the transport is taken from the first
37544 of these values that is set:
37545 </para>
37546 <itemizedlist>
37547 <listitem>
37548 <para>
37549 The <option>home_directory</option> option on the transport;
37550 </para>
37551 </listitem>
37552 <listitem>
37553 <para>
37554 The <option>transport_home_directory</option> option on the router;
37555 </para>
37556 </listitem>
37557 <listitem>
37558 <para>
37559 The password data if <option>check_local_user</option> is set on the router;
37560 </para>
37561 </listitem>
37562 <listitem>
37563 <para>
37564 The <option>router_home_directory</option> option on the router.
37565 </para>
37566 </listitem>
37567 </itemizedlist>
37568 <para>
37569 In other words, <option>router_home_directory</option> overrides the password data for the
37570 router, but not for the transport.
37571 </para>
37572 <para>
37573 <indexterm role="option">
37574 <primary><option>self</option></primary>
37575 </indexterm>
37576 </para>
37577 <informaltable frame="all">
37578 <tgroup cols="4" colsep="0" rowsep="0">
37579 <colspec colwidth="8*" align="left"/>
37580 <colspec colwidth="6*" align="center"/>
37581 <colspec colwidth="6*" align="center"/>
37582 <colspec colwidth="6*" align="right"/>
37583 <tbody>
37584 <row>
37585 <entry><option>self</option></entry>
37586 <entry>Use: <emphasis>routers</emphasis></entry>
37587 <entry>Type: <emphasis>string</emphasis></entry>
37588 <entry>Default: <emphasis>freeze</emphasis></entry>
37589 </row>
37590 </tbody>
37591 </tgroup>
37592 </informaltable>
37593 <para>
37594 <indexterm role="concept">
37595 <primary>MX record</primary>
37596 <secondary>pointing to local host</secondary>
37597 </indexterm>
37598 <indexterm role="concept">
37599 <primary>local host</primary>
37600 <secondary>MX pointing to</secondary>
37601 </indexterm>
37602 This option applies to those routers that use a recipient address to find a
37603 list of remote hosts. Currently, these are the <command>dnslookup</command>, <command>ipliteral</command>,
37604 and <command>manualroute</command> routers.
37605 Certain configurations of the <command>queryprogram</command> router can also specify a list
37606 of remote hosts.
37607 Usually such routers are configured to send the message to a remote host via an
37608 <command>smtp</command> transport. The <option>self</option> option specifies what happens when the first
37609 host on the list turns out to be the local host.
37610 The way in which Exim checks for the local host is described in section
37611 <xref linkend="SECTreclocipadd"/>.
37612 </para>
37613 <para>
37614 Normally this situation indicates either an error in Exim&#x2019;s configuration (for
37615 example, the router should be configured not to process this domain), or an
37616 error in the DNS (for example, the MX should not point to this host). For this
37617 reason, the default action is to log the incident, defer the address, and
37618 freeze the message. The following alternatives are provided for use in special
37619 cases:
37620 </para>
37621 <variablelist>
37622 <varlistentry>
37623 <term><option>defer</option></term>
37624 <listitem>
37625 <para>
37626 Delivery of the message is tried again later, but the message is not frozen.
37627 </para>
37628 </listitem></varlistentry>
37629 <varlistentry>
37630 <term><option>reroute</option>: &lt;<emphasis>domain</emphasis>&gt;</term>
37631 <listitem>
37632 <para>
37633 The domain is changed to the given domain, and the address is passed back to
37634 be reprocessed by the routers. No rewriting of headers takes place. This
37635 behaviour is essentially a redirection.
37636 </para>
37637 </listitem></varlistentry>
37638 <varlistentry>
37639 <term><option>reroute: rewrite:</option> &lt;<emphasis>domain</emphasis>&gt;</term>
37640 <listitem>
37641 <para>
37642 The domain is changed to the given domain, and the address is passed back to be
37643 reprocessed by the routers. Any headers that contain the original domain are
37644 rewritten.
37645 </para>
37646 </listitem></varlistentry>
37647 <varlistentry>
37648 <term><option>pass</option></term>
37649 <listitem>
37650 <para>
37651 <indexterm role="option">
37652 <primary><option>more</option></primary>
37653 </indexterm>
37654 <indexterm role="variable">
37655 <primary><varname>$self_hostname</varname></primary>
37656 </indexterm>
37657 The router passes the address to the next router, or to the router named in the
37658 <option>pass_router</option> option if it is set. This overrides <option>no_more</option>. During
37659 subsequent routing and delivery, the variable <varname>$self_hostname</varname> contains the
37660 name of the local host that the router encountered. This can be used to
37661 distinguish between different cases for hosts with multiple names. The
37662 combination
37663 </para>
37664 <literallayout class="monospaced">
37665 self = pass
37666 no_more
37667 </literallayout>
37668 <para>
37669 ensures that only those addresses that routed to the local host are passed on.
37670 Without <option>no_more</option>, addresses that were declined for other reasons would also
37671 be passed to the next router.
37672 </para>
37673 </listitem></varlistentry>
37674 <varlistentry>
37675 <term><option>fail</option></term>
37676 <listitem>
37677 <para>
37678 Delivery fails and an error report is generated.
37679 </para>
37680 </listitem></varlistentry>
37681 <varlistentry>
37682 <term><option>send</option></term>
37683 <listitem>
37684 <para>
37685 <indexterm role="concept">
37686 <primary>local host</primary>
37687 <secondary>sending to</secondary>
37688 </indexterm>
37689 The anomaly is ignored and the address is queued for the transport. This
37690 setting should be used with extreme caution. For an <command>smtp</command> transport, it
37691 makes sense only in cases where the program that is listening on the SMTP port
37692 is not this version of Exim. That is, it must be some other MTA, or Exim with a
37693 different configuration file that handles the domain in another way.
37694 </para>
37695 </listitem></varlistentry>
37696 </variablelist>
37697 <para>
37698 <indexterm role="option">
37699 <primary><option>senders</option></primary>
37700 </indexterm>
37701 </para>
37702 <informaltable frame="all">
37703 <tgroup cols="4" colsep="0" rowsep="0">
37704 <colspec colwidth="8*" align="left"/>
37705 <colspec colwidth="6*" align="center"/>
37706 <colspec colwidth="6*" align="center"/>
37707 <colspec colwidth="6*" align="right"/>
37708 <tbody>
37709 <row>
37710 <entry><option>senders</option></entry>
37711 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
37712 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
37713 <entry>Default: <emphasis>unset</emphasis></entry>
37714 </row>
37715 </tbody>
37716 </tgroup>
37717 </informaltable>
37718 <para>
37719 <indexterm role="concept">
37720 <primary>router</primary>
37721 <secondary>checking senders</secondary>
37722 </indexterm>
37723 If this option is set, the router is skipped unless the message&#x2019;s sender
37724 address matches something on the list.
37725 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
37726 are evaluated.
37727 </para>
37728 <para>
37729 There are issues concerning verification when the running of routers is
37730 dependent on the sender. When Exim is verifying the address in an <option>errors_to</option>
37731 setting, it sets the sender to the null string. When using the <option>-bt</option> option
37732 to check a configuration file, it is necessary also to use the <option>-f</option> option to
37733 set an appropriate sender. For incoming mail, the sender is unset when
37734 verifying the sender, but is available when verifying any recipients. If the
37735 SMTP VRFY command is enabled, it must be used after MAIL if the sender address
37736 matters.
37737 </para>
37738 <para>
37739 <indexterm role="option">
37740 <primary><option>set</option></primary>
37741 </indexterm>
37742 </para>
37743 <informaltable frame="all">
37744 <tgroup cols="4" colsep="0" rowsep="0">
37745 <colspec colwidth="8*" align="left"/>
37746 <colspec colwidth="6*" align="center"/>
37747 <colspec colwidth="6*" align="center"/>
37748 <colspec colwidth="6*" align="right"/>
37749 <tbody>
37750 <row>
37751 <entry><option>set</option></entry>
37752 <entry>Use: <emphasis>routers</emphasis></entry>
37753 <entry>Type: <emphasis>string list</emphasis></entry>
37754 <entry>Default: <emphasis>unset</emphasis></entry>
37755 </row>
37756 </tbody>
37757 </tgroup>
37758 </informaltable>
37759 <para>
37760 <indexterm role="concept">
37761 <primary>router</primary>
37762 <secondary>variables</secondary>
37763 </indexterm>
37764 This option may be used multiple times on a router;
37765 because of this the list aspect is mostly irrelevant.
37766 The list separator is a semicolon but can be changed in the
37767 usual way.
37768 </para>
37769 <para>
37770 Each list-element given must be of the form <quote>name = value</quote>
37771 and the names used must start with the string <quote>r_</quote>.
37772 Values containing a list-separator should have them doubled.
37773 When a router runs, the strings are evaluated in order,
37774 to create variables which are added to the set associated with
37775 the address.
37776 This is done immediately after all the preconditions, before the
37777 evaluation of the <option>address_data</option> option.
37778 The variable is set with the expansion of the value.
37779 The variables can be used by the router options
37780 (not including any preconditions)
37781 and by the transport.
37782 Later definitions of a given named variable will override former ones.
37783 Variable use is via the usual <varname>$r_...</varname> syntax.
37784 </para>
37785 <para>
37786 This is similar to the <option>address_data</option> option, except that
37787 many independent variables can be used, with choice of naming.
37788 </para>
37789 <para>
37790 <indexterm role="option">
37791 <primary><option>translate_ip_address</option></primary>
37792 </indexterm>
37793 </para>
37794 <informaltable frame="all">
37795 <tgroup cols="4" colsep="0" rowsep="0">
37796 <colspec colwidth="8*" align="left"/>
37797 <colspec colwidth="6*" align="center"/>
37798 <colspec colwidth="6*" align="center"/>
37799 <colspec colwidth="6*" align="right"/>
37800 <tbody>
37801 <row>
37802 <entry><option>translate_ip_address</option></entry>
37803 <entry>Use: <emphasis>routers</emphasis></entry>
37804 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37805 <entry>Default: <emphasis>unset</emphasis></entry>
37806 </row>
37807 </tbody>
37808 </tgroup>
37809 </informaltable>
37810 <para>
37811 <indexterm role="concept">
37812 <primary>IP address</primary>
37813 <secondary>translating</secondary>
37814 </indexterm>
37815 <indexterm role="concept">
37816 <primary>packet radio</primary>
37817 </indexterm>
37818 <indexterm role="concept">
37819 <primary>router</primary>
37820 <secondary>IP address translation</secondary>
37821 </indexterm>
37822 There exist some rare networking situations (for example, packet radio) where
37823 it is helpful to be able to translate IP addresses generated by normal routing
37824 mechanisms into other IP addresses, thus performing a kind of manual IP
37825 routing. This should be done only if the normal IP routing of the TCP/IP stack
37826 is inadequate or broken. Because this is an extremely uncommon requirement, the
37827 code to support this option is not included in the Exim binary unless
37828 SUPPORT_TRANSLATE_IP_ADDRESS=yes is set in <filename>Local/Makefile</filename>.
37829 </para>
37830 <para>
37831 <indexterm role="variable">
37832 <primary><varname>$host_address</varname></primary>
37833 </indexterm>
37834 The <option>translate_ip_address</option> string is expanded for every IP address generated
37835 by the router, with the generated address set in <varname>$host_address</varname>. If the
37836 expansion is forced to fail, no action is taken.
37837 For any other expansion error, delivery of the message is deferred.
37838 If the result of the expansion is an IP address, that replaces the original
37839 address; otherwise the result is assumed to be a host name &ndash; this is looked
37840 up using <function>gethostbyname()</function> (or <function>getipnodebyname()</function> when available) to
37841 produce one or more replacement IP addresses. For example, to subvert all IP
37842 addresses in some specific networks, this could be added to a router:
37843 </para>
37844 <literallayout class="monospaced">
37845 translate_ip_address = \
37846   ${lookup{${mask:$host_address/26}}lsearch{/some/file}\
37847     {$value}fail}}
37848 </literallayout>
37849 <para>
37850 The file would contain lines like
37851 </para>
37852 <literallayout class="monospaced">
37853 10.2.3.128/26    some.host
37854 10.8.4.34/26     10.44.8.15
37855 </literallayout>
37856 <para>
37857 You should not make use of this facility unless you really understand what you
37858 are doing.
37859 </para>
37860 <para>
37861 <indexterm role="option">
37862 <primary><option>transport</option></primary>
37863 </indexterm>
37864 </para>
37865 <informaltable frame="all">
37866 <tgroup cols="4" colsep="0" rowsep="0">
37867 <colspec colwidth="8*" align="left"/>
37868 <colspec colwidth="6*" align="center"/>
37869 <colspec colwidth="6*" align="center"/>
37870 <colspec colwidth="6*" align="right"/>
37871 <tbody>
37872 <row>
37873 <entry><option>transport</option></entry>
37874 <entry>Use: <emphasis>routers</emphasis></entry>
37875 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37876 <entry>Default: <emphasis>unset</emphasis></entry>
37877 </row>
37878 </tbody>
37879 </tgroup>
37880 </informaltable>
37881 <para>
37882 This option specifies the transport to be used when a router accepts an address
37883 and sets it up for delivery. A transport is never needed if a router is used
37884 only for verification. The value of the option is expanded at routing time,
37885 after the expansion of <option>errors_to</option>, <option>headers_add</option>, and <option>headers_remove</option>,
37886 and result must be the name of one of the configured transports. If it is not,
37887 delivery is deferred.
37888 </para>
37889 <para>
37890 The <option>transport</option> option is not used by the <command>redirect</command> router, but it does
37891 have some private options that set up transports for pipe and file deliveries
37892 (see chapter <xref linkend="CHAPredirect"/>).
37893 </para>
37894 <para>
37895 <indexterm role="option">
37896 <primary><option>transport_current_directory</option></primary>
37897 </indexterm>
37898 </para>
37899 <informaltable frame="all">
37900 <tgroup cols="4" colsep="0" rowsep="0">
37901 <colspec colwidth="8*" align="left"/>
37902 <colspec colwidth="6*" align="center"/>
37903 <colspec colwidth="6*" align="center"/>
37904 <colspec colwidth="6*" align="right"/>
37905 <tbody>
37906 <row>
37907 <entry><option>transport_current_directory</option></entry>
37908 <entry>Use: <emphasis>routers</emphasis></entry>
37909 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37910 <entry>Default: <emphasis>unset</emphasis></entry>
37911 </row>
37912 </tbody>
37913 </tgroup>
37914 </informaltable>
37915 <para>
37916 <indexterm role="concept">
37917 <primary>current directory for local transport</primary>
37918 </indexterm>
37919 This option associates a current directory with any address that is routed
37920 to a local transport. This can happen either because a transport is
37921 explicitly configured for the router, or because it generates a delivery to a
37922 file or a pipe. During the delivery process (that is, at transport time), this
37923 option string is expanded and is set as the current directory, unless
37924 overridden by a setting on the transport.
37925 If the expansion fails for any reason, including forced failure, an error is
37926 logged, and delivery is deferred.
37927 See chapter <xref linkend="CHAPenvironment"/> for details of the local delivery
37928 environment.
37929 </para>
37930 <para>
37931 <indexterm role="option">
37932 <primary><option>transport_home_directory</option></primary>
37933 </indexterm>
37934 </para>
37935 <informaltable frame="all">
37936 <tgroup cols="4" colsep="0" rowsep="0">
37937 <colspec colwidth="8*" align="left"/>
37938 <colspec colwidth="6*" align="center"/>
37939 <colspec colwidth="6*" align="center"/>
37940 <colspec colwidth="6*" align="right"/>
37941 <tbody>
37942 <row>
37943 <entry><option>transport_home_directory</option></entry>
37944 <entry>Use: <emphasis>routers</emphasis></entry>
37945 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
37946 <entry>Default: <emphasis>see below</emphasis></entry>
37947 </row>
37948 </tbody>
37949 </tgroup>
37950 </informaltable>
37951 <para>
37952 <indexterm role="concept">
37953 <primary>home directory</primary>
37954 <secondary>for local transport</secondary>
37955 </indexterm>
37956 This option associates a home directory with any address that is routed to a
37957 local transport. This can happen either because a transport is explicitly
37958 configured for the router, or because it generates a delivery to a file or a
37959 pipe. During the delivery process (that is, at transport time), the option
37960 string is expanded and is set as the home directory, unless overridden by a
37961 setting of <option>home_directory</option> on the transport.
37962 If the expansion fails for any reason, including forced failure, an error is
37963 logged, and delivery is deferred.
37964 </para>
37965 <para>
37966 If the transport does not specify a home directory, and
37967 <option>transport_home_directory</option> is not set for the router, the home directory for
37968 the transport is taken from the password data if <option>check_local_user</option> is set for
37969 the router. Otherwise it is taken from <option>router_home_directory</option> if that option
37970 is set; if not, no home directory is set for the transport.
37971 </para>
37972 <para>
37973 See chapter <xref linkend="CHAPenvironment"/> for further details of the local delivery
37974 environment.
37975 </para>
37976 <para>
37977 <indexterm role="option">
37978 <primary><option>unseen</option></primary>
37979 </indexterm>
37980 </para>
37981 <informaltable frame="all">
37982 <tgroup cols="4" colsep="0" rowsep="0">
37983 <colspec colwidth="8*" align="left"/>
37984 <colspec colwidth="6*" align="center"/>
37985 <colspec colwidth="6*" align="center"/>
37986 <colspec colwidth="6*" align="right"/>
37987 <tbody>
37988 <row>
37989 <entry><option>unseen</option></entry>
37990 <entry>Use: <emphasis>routers</emphasis></entry>
37991 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
37992 <entry>Default: <emphasis>false</emphasis></entry>
37993 </row>
37994 </tbody>
37995 </tgroup>
37996 </informaltable>
37997 <para>
37998 <indexterm role="concept">
37999 <primary>router</primary>
38000 <secondary>carrying on after success</secondary>
38001 </indexterm>
38002 The result of string expansion for this option must be a valid boolean value,
38003 that is, one of the strings <quote>yes</quote>, <quote>no</quote>, <quote>true</quote>, or <quote>false</quote>. Any other
38004 result causes an error, and delivery is deferred. If the expansion is forced to
38005 fail, the default value for the option (false) is used. Other failures cause
38006 delivery to be deferred.
38007 </para>
38008 <para>
38009 When this option is set true, routing does not cease if the router accepts the
38010 address. Instead, a copy of the incoming address is passed to the next router,
38011 overriding a false setting of <option>more</option>. There is little point in setting
38012 <option>more</option> false if <option>unseen</option> is always true, but it may be useful in cases when
38013 the value of <option>unseen</option> contains expansion items (and therefore, presumably, is
38014 sometimes true and sometimes false).
38015 </para>
38016 <para>
38017 <indexterm role="concept">
38018 <primary>copy of message (<option>unseen</option> option)</primary>
38019 </indexterm>
38020 Setting the <option>unseen</option> option has a similar effect to the <option>unseen</option> command
38021 qualifier in filter files. It can be used to cause copies of messages to be
38022 delivered to some other destination, while also carrying out a normal delivery.
38023 In effect, the current address is made into a <quote>parent</quote> that has two children
38024 &ndash; one that is delivered as specified by this router, and a clone that goes on
38025 to be routed further. For this reason, <option>unseen</option> may not be combined with the
38026 <option>one_time</option> option in a <command>redirect</command> router.
38027 </para>
38028 <para>
38029 <emphasis role="bold">Warning</emphasis>: Header lines added to the address (or specified for removal) by
38030 this router or by previous routers affect the <quote>unseen</quote> copy of the message
38031 only. The clone that continues to be processed by further routers starts with
38032 no added headers and none specified for removal. For a <option>redirect</option> router, if
38033 a generated address is the same as the incoming address, this can lead to
38034 duplicate addresses with different header modifications. Exim does not do
38035 duplicate deliveries (except, in certain circumstances, to pipes -- see section
38036 <xref linkend="SECTdupaddr"/>), but it is undefined which of the duplicates is discarded,
38037 so this ambiguous situation should be avoided. The <option>repeat_use</option> option of the
38038 <option>redirect</option> router may be of help.
38039 </para>
38040 <para>
38041 Unlike the handling of header modifications, any data that was set by the
38042 <option>address_data</option> option in the current or previous routers <emphasis>is</emphasis> passed on to
38043 subsequent routers.
38044 </para>
38045 <para>
38046 <indexterm role="option">
38047 <primary><option>user</option></primary>
38048 </indexterm>
38049 </para>
38050 <informaltable frame="all">
38051 <tgroup cols="4" colsep="0" rowsep="0">
38052 <colspec colwidth="8*" align="left"/>
38053 <colspec colwidth="6*" align="center"/>
38054 <colspec colwidth="6*" align="center"/>
38055 <colspec colwidth="6*" align="right"/>
38056 <tbody>
38057 <row>
38058 <entry><option>user</option></entry>
38059 <entry>Use: <emphasis>routers</emphasis></entry>
38060 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38061 <entry>Default: <emphasis>see below</emphasis></entry>
38062 </row>
38063 </tbody>
38064 </tgroup>
38065 </informaltable>
38066 <para>
38067 <indexterm role="concept">
38068 <primary>uid (user id)</primary>
38069 <secondary>local delivery</secondary>
38070 </indexterm>
38071 <indexterm role="concept">
38072 <primary>local transports</primary>
38073 <secondary>uid and gid</secondary>
38074 </indexterm>
38075 <indexterm role="concept">
38076 <primary>transport</primary>
38077 <secondary>local</secondary>
38078 </indexterm>
38079 <indexterm role="concept">
38080 <primary>router</primary>
38081 <secondary>user for filter processing</secondary>
38082 </indexterm>
38083 <indexterm role="concept">
38084 <primary>filter</primary>
38085 <secondary>user for processing</secondary>
38086 </indexterm>
38087 When a router queues an address for a transport, and the transport does not
38088 specify a user, the user given here is used when running the delivery process.
38089 The user may be specified numerically or by name. If expansion fails, the
38090 error is logged and delivery is deferred.
38091 This user is also used by the <command>redirect</command> router when running a filter file.
38092 The default is unset, except when <option>check_local_user</option> is set. In this case,
38093 the default is taken from the password information. If the user is specified as
38094 a name, and <option>group</option> is not set, the group associated with the user is used.
38095 See also <option>initgroups</option> and <option>group</option> and the discussion in chapter
38096 <xref linkend="CHAPenvironment"/>.
38097 </para>
38098 <para>
38099 <indexterm role="option">
38100 <primary><option>verify</option></primary>
38101 </indexterm>
38102 </para>
38103 <informaltable frame="all">
38104 <tgroup cols="4" colsep="0" rowsep="0">
38105 <colspec colwidth="8*" align="left"/>
38106 <colspec colwidth="6*" align="center"/>
38107 <colspec colwidth="6*" align="center"/>
38108 <colspec colwidth="6*" align="right"/>
38109 <tbody>
38110 <row>
38111 <entry><option>verify</option></entry>
38112 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
38113 <entry>Type: <emphasis>boolean</emphasis></entry>
38114 <entry>Default: <emphasis>true</emphasis></entry>
38115 </row>
38116 </tbody>
38117 </tgroup>
38118 </informaltable>
38119 <para>
38120 Setting this option has the effect of setting <option>verify_sender</option> and
38121 <option>verify_recipient</option> to the same value.
38122 </para>
38123 <para>
38124 <indexterm role="option">
38125 <primary><option>verify_only</option></primary>
38126 </indexterm>
38127 </para>
38128 <informaltable frame="all">
38129 <tgroup cols="4" colsep="0" rowsep="0">
38130 <colspec colwidth="8*" align="left"/>
38131 <colspec colwidth="6*" align="center"/>
38132 <colspec colwidth="6*" align="center"/>
38133 <colspec colwidth="6*" align="right"/>
38134 <tbody>
38135 <row>
38136 <entry><option>verify_only</option></entry>
38137 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
38138 <entry>Type: <emphasis>boolean</emphasis></entry>
38139 <entry>Default: <emphasis>false</emphasis></entry>
38140 </row>
38141 </tbody>
38142 </tgroup>
38143 </informaltable>
38144 <para>
38145 <indexterm role="concept">
38146 <primary>EXPN</primary>
38147 <secondary>with <option>verify_only</option></secondary>
38148 </indexterm>
38149 <indexterm role="option">
38150 <primary><option>-bv</option></primary>
38151 </indexterm>
38152 <indexterm role="concept">
38153 <primary>router</primary>
38154 <secondary>used only when verifying</secondary>
38155 </indexterm>
38156 If this option is set, the router is used only when verifying an address,
38157 delivering in cutthrough mode or
38158 testing with the <option>-bv</option> option, not when actually doing a delivery, testing
38159 with the <option>-bt</option> option, or running the SMTP EXPN command. It can be further
38160 restricted to verifying only senders or recipients by means of
38161 <option>verify_sender</option> and <option>verify_recipient</option>.
38162 </para>
38163 <para>
38164 <emphasis role="bold">Warning</emphasis>: When the router is being run to verify addresses for an incoming
38165 SMTP message, Exim is not running as root, but under its own uid. If the router
38166 accesses any files, you need to make sure that they are accessible to the Exim
38167 user or group.
38168 </para>
38169 <para>
38170 <indexterm role="option">
38171 <primary><option>verify_recipient</option></primary>
38172 </indexterm>
38173 </para>
38174 <informaltable frame="all">
38175 <tgroup cols="4" colsep="0" rowsep="0">
38176 <colspec colwidth="8*" align="left"/>
38177 <colspec colwidth="6*" align="center"/>
38178 <colspec colwidth="6*" align="center"/>
38179 <colspec colwidth="6*" align="right"/>
38180 <tbody>
38181 <row>
38182 <entry><option>verify_recipient</option></entry>
38183 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
38184 <entry>Type: <emphasis>boolean</emphasis></entry>
38185 <entry>Default: <emphasis>true</emphasis></entry>
38186 </row>
38187 </tbody>
38188 </tgroup>
38189 </informaltable>
38190 <para>
38191 If this option is false, the router is skipped when verifying recipient
38192 addresses,
38193 delivering in cutthrough mode
38194 or testing recipient verification using <option>-bv</option>.
38195 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
38196 are evaluated.
38197 See also the <varname>$verify_mode</varname> variable.
38198 </para>
38199 <para>
38200 <indexterm role="option">
38201 <primary><option>verify_sender</option></primary>
38202 </indexterm>
38203 </para>
38204 <informaltable frame="all">
38205 <tgroup cols="4" colsep="0" rowsep="0">
38206 <colspec colwidth="8*" align="left"/>
38207 <colspec colwidth="6*" align="center"/>
38208 <colspec colwidth="6*" align="center"/>
38209 <colspec colwidth="6*" align="right"/>
38210 <tbody>
38211 <row>
38212 <entry><option>verify_sender</option></entry>
38213 <entry>Use: <emphasis>routers</emphasis>&Dagger;<emphasis></emphasis></entry>
38214 <entry>Type: <emphasis>boolean</emphasis></entry>
38215 <entry>Default: <emphasis>true</emphasis></entry>
38216 </row>
38217 </tbody>
38218 </tgroup>
38219 </informaltable>
38220 <para>
38221 If this option is false, the router is skipped when verifying sender addresses
38222 or testing sender verification using <option>-bvs</option>.
38223 See section <xref linkend="SECTrouprecon"/> for a list of the order in which preconditions
38224 are evaluated.
38225 See also the <varname>$verify_mode</varname> variable.
38226 <indexterm role="concept" startref="IIDgenoprou1" class="endofrange"/>
38227 <indexterm role="concept" startref="IIDgenoprou2" class="endofrange"/>
38228 </para>
38229 </chapter>
38230
38231 <chapter id="CHID4">
38232 <title>The accept router</title>
38233 <para>
38234 <indexterm role="concept">
38235 <primary><command>accept</command> router</primary>
38236 </indexterm>
38237 <indexterm role="concept">
38238 <primary>routers</primary>
38239 <secondary><command>accept</command></secondary>
38240 </indexterm>
38241 The <command>accept</command> router has no private options of its own. Unless it is being
38242 used purely for verification (see <option>verify_only</option>) a transport is required to
38243 be defined by the generic <option>transport</option> option. If the preconditions that are
38244 specified by generic options are met, the router accepts the address and queues
38245 it for the given transport. The most common use of this router is for setting
38246 up deliveries to local mailboxes. For example:
38247 </para>
38248 <literallayout class="monospaced">
38249 localusers:
38250   driver = accept
38251   domains = mydomain.example
38252   check_local_user
38253   transport = local_delivery
38254 </literallayout>
38255 <para>
38256 The <option>domains</option> condition in this example checks the domain of the address, and
38257 <option>check_local_user</option> checks that the local part is the login of a local user.
38258 When both preconditions are met, the <command>accept</command> router runs, and queues the
38259 address for the <command>local_delivery</command> transport.
38260 </para>
38261 </chapter>
38262
38263 <chapter id="CHAPdnslookup">
38264 <title>The dnslookup router</title>
38265 <para>
38266 <indexterm role="concept" id="IIDdnsrou1" class="startofrange">
38267 <primary><command>dnslookup</command> router</primary>
38268 </indexterm>
38269 <indexterm role="concept" id="IIDdnsrou2" class="startofrange">
38270 <primary>routers</primary>
38271 <secondary><command>dnslookup</command></secondary>
38272 </indexterm>
38273 The <command>dnslookup</command> router looks up the hosts that handle mail for the
38274 recipient&#x2019;s domain in the DNS. A transport must always be set for this router,
38275 unless <option>verify_only</option> is set.
38276 </para>
38277 <para>
38278 If SRV support is configured (see <option>check_srv</option> below), Exim first searches for
38279 SRV records. If none are found, or if SRV support is not configured,
38280 MX records are looked up. If no MX records exist, address records are sought.
38281 However, <option>mx_domains</option> can be set to disable the direct use of address
38282 records.
38283 </para>
38284 <para>
38285 MX records of equal priority are sorted by Exim into a random order. Exim then
38286 looks for address records for the host names obtained from MX or SRV records.
38287 When a host has more than one IP address, they are sorted into a random order,
38288 except that IPv6 addresses are sorted before IPv4 addresses. If all the
38289 IP addresses found are discarded by a setting of the <option>ignore_target_hosts</option>
38290 generic option, the router declines.
38291 </para>
38292 <para>
38293 Unless they have the highest priority (lowest MX value), MX records that point
38294 to the local host, or to any host name that matches <option>hosts_treat_as_local</option>,
38295 are discarded, together with any other MX records of equal or lower priority.
38296 </para>
38297 <para>
38298 <indexterm role="concept">
38299 <primary>MX record</primary>
38300 <secondary>pointing to local host</secondary>
38301 </indexterm>
38302 <indexterm role="concept">
38303 <primary>local host</primary>
38304 <secondary>MX pointing to</secondary>
38305 </indexterm>
38306 <indexterm role="option">
38307 <primary><option>self</option></primary>
38308 <secondary>in <command>dnslookup</command> router</secondary>
38309 </indexterm>
38310 If the host pointed to by the highest priority MX record, or looked up as an
38311 address record, is the local host, or matches <option>hosts_treat_as_local</option>, what
38312 happens is controlled by the generic <option>self</option> option.
38313 </para>
38314 <section id="SECTprowitdnsloo">
38315 <title>Problems with DNS lookups</title>
38316 <para>
38317 There have been problems with DNS servers when SRV records are looked up.
38318 Some misbehaving servers return a DNS error or timeout when a non-existent
38319 SRV record is sought. Similar problems have in the past been reported for
38320 MX records. The global <option>dns_again_means_nonexist</option> option can help with this
38321 problem, but it is heavy-handed because it is a global option.
38322 </para>
38323 <para>
38324 For this reason, there are two options, <option>srv_fail_domains</option> and
38325 <option>mx_fail_domains</option>, that control what happens when a DNS lookup in a
38326 <command>dnslookup</command> router results in a DNS failure or a <quote>try again</quote> response. If
38327 an attempt to look up an SRV or MX record causes one of these results, and the
38328 domain matches the relevant list, Exim behaves as if the DNS had responded <quote>no
38329 such record</quote>. In the case of an SRV lookup, this means that the router
38330 proceeds to look for MX records; in the case of an MX lookup, it proceeds to
38331 look for A or AAAA records, unless the domain matches <option>mx_domains</option>, in which
38332 case routing fails.
38333 </para>
38334 </section>
38335 <section id="SECTdnslookupdecline">
38336 <title>Declining addresses by dnslookup</title>
38337 <para>
38338 <indexterm role="concept">
38339 <primary><command>dnslookup</command> router</primary>
38340 <secondary>declines</secondary>
38341 </indexterm>
38342 There are a few cases where a <command>dnslookup</command> router will decline to accept
38343 an address; if such a router is expected to handle "all remaining non-local
38344 domains", then it is important to set <option>no_more</option>.
38345 </para>
38346 <para>
38347 The router will defer rather than decline if the domain
38348 is found in the <option>fail_defer_domains</option> router option.
38349 </para>
38350 <para>
38351 Reasons for a <command>dnslookup</command> router to decline currently include:
38352 </para>
38353 <itemizedlist>
38354 <listitem>
38355 <para>
38356 The domain does not exist in DNS
38357 </para>
38358 </listitem>
38359 <listitem>
38360 <para>
38361 The domain exists but the MX record&#x2019;s host part is just "."; this is a common
38362 convention (borrowed from SRV) used to indicate that there is no such service
38363 for this domain and to not fall back to trying A/AAAA records.
38364 </para>
38365 </listitem>
38366 <listitem>
38367 <para>
38368 Ditto, but for SRV records, when <option>check_srv</option> is set on this router.
38369 </para>
38370 </listitem>
38371 <listitem>
38372 <para>
38373 MX record points to a non-existent host.
38374 </para>
38375 </listitem>
38376 <listitem>
38377 <para>
38378 MX record points to an IP address and the main section option
38379 <option>allow_mx_to_ip</option> is not set.
38380 </para>
38381 </listitem>
38382 <listitem>
38383 <para>
38384 MX records exist and point to valid hosts, but all hosts resolve only to
38385 addresses blocked by the <option>ignore_target_hosts</option> generic option on this router.
38386 </para>
38387 </listitem>
38388 <listitem>
38389 <para>
38390 The domain is not syntactically valid (see also <option>allow_utf8_domains</option> and
38391 <option>dns_check_names_pattern</option> for handling one variant of this)
38392 </para>
38393 </listitem>
38394 <listitem>
38395 <para>
38396 <option>check_secondary_mx</option> is set on this router but the local host can
38397 not be found in the MX records (see below)
38398 </para>
38399 </listitem>
38400 </itemizedlist>
38401 </section>
38402 <section id="SECID118">
38403 <title>Private options for dnslookup</title>
38404 <para>
38405 <indexterm role="concept">
38406 <primary>options</primary>
38407 <secondary><command>dnslookup</command> router</secondary>
38408 </indexterm>
38409 The private options for the <command>dnslookup</command> router are as follows:
38410 </para>
38411 <para>
38412 <indexterm role="option">
38413 <primary><option>check_secondary_mx</option></primary>
38414 </indexterm>
38415 </para>
38416 <informaltable frame="all">
38417 <tgroup cols="4" colsep="0" rowsep="0">
38418 <colspec colwidth="8*" align="left"/>
38419 <colspec colwidth="6*" align="center"/>
38420 <colspec colwidth="6*" align="center"/>
38421 <colspec colwidth="6*" align="right"/>
38422 <tbody>
38423 <row>
38424 <entry><option>check_secondary_mx</option></entry>
38425 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38426 <entry>Type: <emphasis>boolean</emphasis></entry>
38427 <entry>Default: <emphasis>false</emphasis></entry>
38428 </row>
38429 </tbody>
38430 </tgroup>
38431 </informaltable>
38432 <para>
38433 <indexterm role="concept">
38434 <primary>MX record</primary>
38435 <secondary>checking for secondary</secondary>
38436 </indexterm>
38437 If this option is set, the router declines unless the local host is found in
38438 (and removed from) the list of hosts obtained by MX lookup. This can be used to
38439 process domains for which the local host is a secondary mail exchanger
38440 differently to other domains. The way in which Exim decides whether a host is
38441 the local host is described in section <xref linkend="SECTreclocipadd"/>.
38442 </para>
38443 <para>
38444 <indexterm role="option">
38445 <primary><option>check_srv</option></primary>
38446 </indexterm>
38447 </para>
38448 <informaltable frame="all">
38449 <tgroup cols="4" colsep="0" rowsep="0">
38450 <colspec colwidth="8*" align="left"/>
38451 <colspec colwidth="6*" align="center"/>
38452 <colspec colwidth="6*" align="center"/>
38453 <colspec colwidth="6*" align="right"/>
38454 <tbody>
38455 <row>
38456 <entry><option>check_srv</option></entry>
38457 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38458 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38459 <entry>Default: <emphasis>unset</emphasis></entry>
38460 </row>
38461 </tbody>
38462 </tgroup>
38463 </informaltable>
38464 <para>
38465 <indexterm role="concept">
38466 <primary>SRV record</primary>
38467 <secondary>enabling use of</secondary>
38468 </indexterm>
38469 The <command>dnslookup</command> router supports the use of SRV records (see RFC 2782) in
38470 addition to MX and address records. The support is disabled by default. To
38471 enable SRV support, set the <option>check_srv</option> option to the name of the service
38472 required. For example,
38473 </para>
38474 <literallayout class="monospaced">
38475 check_srv = smtp
38476 </literallayout>
38477 <para>
38478 looks for SRV records that refer to the normal smtp service. The option is
38479 expanded, so the service name can vary from message to message or address
38480 to address. This might be helpful if SRV records are being used for a
38481 submission service. If the expansion is forced to fail, the <option>check_srv</option>
38482 option is ignored, and the router proceeds to look for MX records in the
38483 normal way.
38484 </para>
38485 <para>
38486 When the expansion succeeds, the router searches first for SRV records for
38487 the given service (it assumes TCP protocol). A single SRV record with a
38488 host name that consists of just a single dot indicates <quote>no such service for
38489 this domain</quote>; if this is encountered, the router declines. If other kinds of
38490 SRV record are found, they are used to construct a host list for delivery
38491 according to the rules of RFC 2782. MX records are not sought in this case.
38492 </para>
38493 <para>
38494 When no SRV records are found, MX records (and address records) are sought in
38495 the traditional way. In other words, SRV records take precedence over MX
38496 records, just as MX records take precedence over address records. Note that
38497 this behaviour is not sanctioned by RFC 2782, though a previous draft RFC
38498 defined it. It is apparently believed that MX records are sufficient for email
38499 and that SRV records should not be used for this purpose. However, SRV records
38500 have an additional <quote>weight</quote> feature which some people might find useful when
38501 trying to split an SMTP load between hosts of different power.
38502 </para>
38503 <para>
38504 See section <xref linkend="SECTprowitdnsloo"/> above for a discussion of Exim&#x2019;s behaviour
38505 when there is a DNS lookup error.
38506 </para>
38507 <para>
38508 <indexterm role="option">
38509 <primary><option>fail_defer_domains</option></primary>
38510 </indexterm>
38511 </para>
38512 <informaltable frame="all">
38513 <tgroup cols="4" colsep="0" rowsep="0">
38514 <colspec colwidth="8*" align="left"/>
38515 <colspec colwidth="6*" align="center"/>
38516 <colspec colwidth="6*" align="center"/>
38517 <colspec colwidth="6*" align="right"/>
38518 <tbody>
38519 <row>
38520 <entry><option>fail_defer_domains</option></entry>
38521 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38522 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
38523 <entry>Default: <emphasis>unset</emphasis></entry>
38524 </row>
38525 </tbody>
38526 </tgroup>
38527 </informaltable>
38528 <para>
38529 <indexterm role="concept">
38530 <primary>MX record</primary>
38531 <secondary>not found</secondary>
38532 </indexterm>
38533 DNS lookups for domains matching <option>fail_defer_domains</option>
38534 which find no matching record will cause the router to defer
38535 rather than the default behaviour of decline.
38536 This maybe be useful for queueing messages for a newly created
38537 domain while the DNS configuration is not ready.
38538 However, it will result in any message with mistyped domains
38539 also being queued.
38540 </para>
38541 <para>
38542 <indexterm role="option">
38543 <primary><option>ipv4_only</option></primary>
38544 </indexterm>
38545 </para>
38546 <informaltable frame="all">
38547 <tgroup cols="4" colsep="0" rowsep="0">
38548 <colspec colwidth="8*" align="left"/>
38549 <colspec colwidth="6*" align="center"/>
38550 <colspec colwidth="6*" align="center"/>
38551 <colspec colwidth="6*" align="right"/>
38552 <tbody>
38553 <row>
38554 <entry><option>ipv4_only</option></entry>
38555 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38556 <entry>Type: <emphasis>unset</emphasis></entry>
38557 <entry>Default: <emphasis></emphasis></entry>
38558 </row>
38559 </tbody>
38560 </tgroup>
38561 </informaltable>
38562 <para>
38563 <indexterm role="concept">
38564 <primary>IPv6</primary>
38565 <secondary>disabling</secondary>
38566 </indexterm>
38567 <indexterm role="concept">
38568 <primary>DNS</primary>
38569 <secondary>IPv6 disabling</secondary>
38570 </indexterm>
38571 The string is expanded, and if the result is anything but a forced failure,
38572 or an empty string, or one of the strings “0” or “no” or “false”
38573 (checked without regard to the case of the letters),
38574 only A records are used.
38575 </para>
38576 <para>
38577 <indexterm role="option">
38578 <primary><option>ipv4_prefer</option></primary>
38579 </indexterm>
38580 </para>
38581 <informaltable frame="all">
38582 <tgroup cols="4" colsep="0" rowsep="0">
38583 <colspec colwidth="8*" align="left"/>
38584 <colspec colwidth="6*" align="center"/>
38585 <colspec colwidth="6*" align="center"/>
38586 <colspec colwidth="6*" align="right"/>
38587 <tbody>
38588 <row>
38589 <entry><option>ipv4_prefer</option></entry>
38590 <entry>Use: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
38591 <entry>Type: <emphasis>unset</emphasis></entry>
38592 <entry>Default: <emphasis></emphasis></entry>
38593 </row>
38594 </tbody>
38595 </tgroup>
38596 </informaltable>
38597 <para>
38598 <indexterm role="concept">
38599 <primary>IPv4</primary>
38600 <secondary>preference</secondary>
38601 </indexterm>
38602 <indexterm role="concept">
38603 <primary>DNS</primary>
38604 <secondary>IPv4 preference</secondary>
38605 </indexterm>
38606 The string is expanded, and if the result is anything but a forced failure,
38607 or an empty string, or one of the strings “0” or “no” or “false”
38608 (checked without regard to the case of the letters),
38609 A records are sorted before AAAA records (inverting the default).
38610 </para>
38611 <para>
38612 <indexterm role="option">
38613 <primary><option>mx_domains</option></primary>
38614 </indexterm>
38615 </para>
38616 <informaltable frame="all">
38617 <tgroup cols="4" colsep="0" rowsep="0">
38618 <colspec colwidth="8*" align="left"/>
38619 <colspec colwidth="6*" align="center"/>
38620 <colspec colwidth="6*" align="center"/>
38621 <colspec colwidth="6*" align="right"/>
38622 <tbody>
38623 <row>
38624 <entry><option>mx_domains</option></entry>
38625 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38626 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
38627 <entry>Default: <emphasis>unset</emphasis></entry>
38628 </row>
38629 </tbody>
38630 </tgroup>
38631 </informaltable>
38632 <para>
38633 <indexterm role="concept">
38634 <primary>MX record</primary>
38635 <secondary>required to exist</secondary>
38636 </indexterm>
38637 <indexterm role="concept">
38638 <primary>SRV record</primary>
38639 <secondary>required to exist</secondary>
38640 </indexterm>
38641 A domain that matches <option>mx_domains</option> is required to have either an MX or an SRV
38642 record in order to be recognized. (The name of this option could be improved.)
38643 For example, if all the mail hosts in <emphasis>fict.example</emphasis> are known to have MX
38644 records, except for those in <emphasis>discworld.fict.example</emphasis>, you could use this
38645 setting:
38646 </para>
38647 <literallayout class="monospaced">
38648 mx_domains = ! *.discworld.fict.example : *.fict.example
38649 </literallayout>
38650 <para>
38651 This specifies that messages addressed to a domain that matches the list but
38652 has no MX record should be bounced immediately instead of being routed using
38653 the address record.
38654 </para>
38655 <para>
38656 <indexterm role="option">
38657 <primary><option>mx_fail_domains</option></primary>
38658 </indexterm>
38659 </para>
38660 <informaltable frame="all">
38661 <tgroup cols="4" colsep="0" rowsep="0">
38662 <colspec colwidth="8*" align="left"/>
38663 <colspec colwidth="6*" align="center"/>
38664 <colspec colwidth="6*" align="center"/>
38665 <colspec colwidth="6*" align="right"/>
38666 <tbody>
38667 <row>
38668 <entry><option>mx_fail_domains</option></entry>
38669 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38670 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
38671 <entry>Default: <emphasis>unset</emphasis></entry>
38672 </row>
38673 </tbody>
38674 </tgroup>
38675 </informaltable>
38676 <para>
38677 If the DNS lookup for MX records for one of the domains in this list causes a
38678 DNS lookup error, Exim behaves as if no MX records were found. See section
38679 <xref linkend="SECTprowitdnsloo"/> for more discussion.
38680 </para>
38681 <para>
38682 <indexterm role="option">
38683 <primary><option>qualify_single</option></primary>
38684 </indexterm>
38685 </para>
38686 <informaltable frame="all">
38687 <tgroup cols="4" colsep="0" rowsep="0">
38688 <colspec colwidth="8*" align="left"/>
38689 <colspec colwidth="6*" align="center"/>
38690 <colspec colwidth="6*" align="center"/>
38691 <colspec colwidth="6*" align="right"/>
38692 <tbody>
38693 <row>
38694 <entry><option>qualify_single</option></entry>
38695 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38696 <entry>Type: <emphasis>boolean</emphasis></entry>
38697 <entry>Default: <emphasis>true</emphasis></entry>
38698 </row>
38699 </tbody>
38700 </tgroup>
38701 </informaltable>
38702 <para>
38703 <indexterm role="concept">
38704 <primary>DNS</primary>
38705 <secondary>resolver options</secondary>
38706 </indexterm>
38707 <indexterm role="concept">
38708 <primary>DNS</primary>
38709 <secondary>qualifying single-component names</secondary>
38710 </indexterm>
38711 When this option is true, the resolver option RES_DEFNAMES is set for DNS
38712 lookups. Typically, but not standardly, this causes the resolver to qualify
38713 single-component names with the default domain. For example, on a machine
38714 called <emphasis>dictionary.ref.example</emphasis>, the domain <emphasis>thesaurus</emphasis> would be changed to
38715 <emphasis>thesaurus.ref.example</emphasis> inside the resolver. For details of what your
38716 resolver actually does, consult your man pages for <emphasis>resolver</emphasis> and
38717 <emphasis>resolv.conf</emphasis>.
38718 </para>
38719 <para>
38720 <indexterm role="option">
38721 <primary><option>rewrite_headers</option></primary>
38722 </indexterm>
38723 </para>
38724 <informaltable frame="all">
38725 <tgroup cols="4" colsep="0" rowsep="0">
38726 <colspec colwidth="8*" align="left"/>
38727 <colspec colwidth="6*" align="center"/>
38728 <colspec colwidth="6*" align="center"/>
38729 <colspec colwidth="6*" align="right"/>
38730 <tbody>
38731 <row>
38732 <entry><option>rewrite_headers</option></entry>
38733 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38734 <entry>Type: <emphasis>boolean</emphasis></entry>
38735 <entry>Default: <emphasis>true</emphasis></entry>
38736 </row>
38737 </tbody>
38738 </tgroup>
38739 </informaltable>
38740 <para>
38741 <indexterm role="concept">
38742 <primary>rewriting</primary>
38743 <secondary>header lines</secondary>
38744 </indexterm>
38745 <indexterm role="concept">
38746 <primary>header lines</primary>
38747 <secondary>rewriting</secondary>
38748 </indexterm>
38749 If the domain name in the address that is being processed is not fully
38750 qualified, it may be expanded to its full form by a DNS lookup. For example, if
38751 an address is specified as <emphasis>dormouse@teaparty</emphasis>, the domain might be
38752 expanded to <emphasis>teaparty.wonderland.fict.example</emphasis>. Domain expansion can also
38753 occur as a result of setting the <option>widen_domains</option> option. If
38754 <option>rewrite_headers</option> is true, all occurrences of the abbreviated domain name in
38755 any <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-to:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>
38756 header lines of the message are rewritten with the full domain name.
38757 </para>
38758 <para>
38759 This option should be turned off only when it is known that no message is
38760 ever going to be sent outside an environment where the abbreviation makes
38761 sense.
38762 </para>
38763 <para>
38764 When an MX record is looked up in the DNS and matches a wildcard record, name
38765 servers normally return a record containing the name that has been looked up,
38766 making it impossible to detect whether a wildcard was present or not. However,
38767 some name servers have recently been seen to return the wildcard entry. If the
38768 name returned by a DNS lookup begins with an asterisk, it is not used for
38769 header rewriting.
38770 </para>
38771 <para>
38772 <indexterm role="option">
38773 <primary><option>same_domain_copy_routing</option></primary>
38774 </indexterm>
38775 </para>
38776 <informaltable frame="all">
38777 <tgroup cols="4" colsep="0" rowsep="0">
38778 <colspec colwidth="8*" align="left"/>
38779 <colspec colwidth="6*" align="center"/>
38780 <colspec colwidth="6*" align="center"/>
38781 <colspec colwidth="6*" align="right"/>
38782 <tbody>
38783 <row>
38784 <entry><option>same_domain_copy_routing</option></entry>
38785 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38786 <entry>Type: <emphasis>boolean</emphasis></entry>
38787 <entry>Default: <emphasis>false</emphasis></entry>
38788 </row>
38789 </tbody>
38790 </tgroup>
38791 </informaltable>
38792 <para>
38793 <indexterm role="concept">
38794 <primary>address</primary>
38795 <secondary>copying routing</secondary>
38796 </indexterm>
38797 Addresses with the same domain are normally routed by the <command>dnslookup</command> router
38798 to the same list of hosts. However, this cannot be presumed, because the router
38799 options and preconditions may refer to the local part of the address. By
38800 default, therefore, Exim routes each address in a message independently. DNS
38801 servers run caches, so repeated DNS lookups are not normally expensive, and in
38802 any case, personal messages rarely have more than a few recipients.
38803 </para>
38804 <para>
38805 If you are running mailing lists with large numbers of subscribers at the same
38806 domain, and you are using a <command>dnslookup</command> router which is independent of the
38807 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
38808 lookups for identical domains in one message. In this case, when <command>dnslookup</command>
38809 routes an address to a remote transport, any other unrouted addresses in the
38810 message that have the same domain are automatically given the same routing
38811 without processing them independently,
38812 provided the following conditions are met:
38813 </para>
38814 <itemizedlist>
38815 <listitem>
38816 <para>
38817 No router that processed the address specified <option>headers_add</option> or
38818 <option>headers_remove</option>.
38819 </para>
38820 </listitem>
38821 <listitem>
38822 <para>
38823 The router did not change the address in any way, for example, by <quote>widening</quote>
38824 the domain.
38825 </para>
38826 </listitem>
38827 </itemizedlist>
38828 <para>
38829 <indexterm role="option">
38830 <primary><option>search_parents</option></primary>
38831 </indexterm>
38832 </para>
38833 <informaltable frame="all">
38834 <tgroup cols="4" colsep="0" rowsep="0">
38835 <colspec colwidth="8*" align="left"/>
38836 <colspec colwidth="6*" align="center"/>
38837 <colspec colwidth="6*" align="center"/>
38838 <colspec colwidth="6*" align="right"/>
38839 <tbody>
38840 <row>
38841 <entry><option>search_parents</option></entry>
38842 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38843 <entry>Type: <emphasis>boolean</emphasis></entry>
38844 <entry>Default: <emphasis>false</emphasis></entry>
38845 </row>
38846 </tbody>
38847 </tgroup>
38848 </informaltable>
38849 <para>
38850 <indexterm role="concept">
38851 <primary>DNS</primary>
38852 <secondary>resolver options</secondary>
38853 </indexterm>
38854 When this option is true, the resolver option RES_DNSRCH is set for DNS
38855 lookups. This is different from the <option>qualify_single</option> option in that it
38856 applies to domains containing dots. Typically, but not standardly, it causes
38857 the resolver to search for the name in the current domain and in parent
38858 domains. For example, on a machine in the <emphasis>fict.example</emphasis> domain, if looking
38859 up <emphasis>teaparty.wonderland</emphasis> failed, the resolver would try
38860 <emphasis>teaparty.wonderland.fict.example</emphasis>. For details of what your resolver
38861 actually does, consult your man pages for <emphasis>resolver</emphasis> and <emphasis>resolv.conf</emphasis>.
38862 </para>
38863 <para>
38864 Setting this option true can cause problems in domains that have a wildcard MX
38865 record, because any domain that does not have its own MX record matches the
38866 local wildcard.
38867 </para>
38868 <para>
38869 <indexterm role="option">
38870 <primary><option>srv_fail_domains</option></primary>
38871 </indexterm>
38872 </para>
38873 <informaltable frame="all">
38874 <tgroup cols="4" colsep="0" rowsep="0">
38875 <colspec colwidth="8*" align="left"/>
38876 <colspec colwidth="6*" align="center"/>
38877 <colspec colwidth="6*" align="center"/>
38878 <colspec colwidth="6*" align="right"/>
38879 <tbody>
38880 <row>
38881 <entry><option>srv_fail_domains</option></entry>
38882 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38883 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
38884 <entry>Default: <emphasis>unset</emphasis></entry>
38885 </row>
38886 </tbody>
38887 </tgroup>
38888 </informaltable>
38889 <para>
38890 If the DNS lookup for SRV records for one of the domains in this list causes a
38891 DNS lookup error, Exim behaves as if no SRV records were found. See section
38892 <xref linkend="SECTprowitdnsloo"/> for more discussion.
38893 </para>
38894 <para>
38895 <indexterm role="option">
38896 <primary><option>widen_domains</option></primary>
38897 </indexterm>
38898 </para>
38899 <informaltable frame="all">
38900 <tgroup cols="4" colsep="0" rowsep="0">
38901 <colspec colwidth="8*" align="left"/>
38902 <colspec colwidth="6*" align="center"/>
38903 <colspec colwidth="6*" align="center"/>
38904 <colspec colwidth="6*" align="right"/>
38905 <tbody>
38906 <row>
38907 <entry><option>widen_domains</option></entry>
38908 <entry>Use: <emphasis>dnslookup</emphasis></entry>
38909 <entry>Type: <emphasis>string list</emphasis></entry>
38910 <entry>Default: <emphasis>unset</emphasis></entry>
38911 </row>
38912 </tbody>
38913 </tgroup>
38914 </informaltable>
38915 <para>
38916 <indexterm role="concept">
38917 <primary>domain</primary>
38918 <secondary>partial; widening</secondary>
38919 </indexterm>
38920 If a DNS lookup fails and this option is set, each of its strings in turn is
38921 added onto the end of the domain, and the lookup is tried again. For example,
38922 if
38923 </para>
38924 <literallayout class="monospaced">
38925 widen_domains = fict.example:ref.example
38926 </literallayout>
38927 <para>
38928 is set and a lookup of <emphasis>klingon.dictionary</emphasis> fails,
38929 <emphasis>klingon.dictionary.fict.example</emphasis> is looked up, and if this fails,
38930 <emphasis>klingon.dictionary.ref.example</emphasis> is tried. Note that the <option>qualify_single</option>
38931 and <option>search_parents</option> options can cause some widening to be undertaken inside
38932 the DNS resolver. <option>widen_domains</option> is not applied to sender addresses
38933 when verifying, unless <option>rewrite_headers</option> is false (not the default).
38934 </para>
38935 </section>
38936 <section id="SECID119">
38937 <title>Effect of qualify_single and search_parents</title>
38938 <para>
38939 When a domain from an envelope recipient is changed by the resolver as a result
38940 of the <option>qualify_single</option> or <option>search_parents</option> options, Exim rewrites the
38941 corresponding address in the message&#x2019;s header lines unless <option>rewrite_headers</option>
38942 is set false. Exim then re-routes the address, using the full domain.
38943 </para>
38944 <para>
38945 These two options affect only the DNS lookup that takes place inside the router
38946 for the domain of the address that is being routed. They do not affect lookups
38947 such as that implied by
38948 </para>
38949 <literallayout class="monospaced">
38950 domains = @mx_any
38951 </literallayout>
38952 <para>
38953 that may happen while processing a router precondition before the router is
38954 entered. No widening ever takes place for these lookups.
38955 <indexterm role="concept" startref="IIDdnsrou1" class="endofrange"/>
38956 <indexterm role="concept" startref="IIDdnsrou2" class="endofrange"/>
38957 </para>
38958 </section>
38959 </chapter>
38960
38961 <chapter id="CHID5">
38962 <title>The ipliteral router</title>
38963 <para>
38964 <indexterm role="concept">
38965 <primary><command>ipliteral</command> router</primary>
38966 </indexterm>
38967 <indexterm role="concept">
38968 <primary>domain literal</primary>
38969 <secondary>routing</secondary>
38970 </indexterm>
38971 <indexterm role="concept">
38972 <primary>routers</primary>
38973 <secondary><command>ipliteral</command></secondary>
38974 </indexterm>
38975 This router has no private options. Unless it is being used purely for
38976 verification (see <option>verify_only</option>) a transport is required to be defined by the
38977 generic <option>transport</option> option. The router accepts the address if its domain part
38978 takes the form of an RFC 2822 domain literal. For example, the <command>ipliteral</command>
38979 router handles the address
38980 </para>
38981 <literallayout class="monospaced">
38982 root@[192.168.1.1]
38983 </literallayout>
38984 <para>
38985 by setting up delivery to the host with that IP address. IPv4 domain literals
38986 consist of an IPv4 address enclosed in square brackets. IPv6 domain literals
38987 are similar, but the address is preceded by <literal>ipv6:</literal>. For example:
38988 </para>
38989 <literallayout class="monospaced">
38990 postmaster@[ipv6:fe80::a00:20ff:fe86:a061.5678]
38991 </literallayout>
38992 <para>
38993 Exim allows <literal>ipv4:</literal> before IPv4 addresses, for consistency, and on the
38994 grounds that sooner or later somebody will try it.
38995 </para>
38996 <para>
38997 <indexterm role="option">
38998 <primary><option>self</option></primary>
38999 <secondary>in <command>ipliteral</command> router</secondary>
39000 </indexterm>
39001 If the IP address matches something in <option>ignore_target_hosts</option>, the router
39002 declines. If an IP literal turns out to refer to the local host, the generic
39003 <option>self</option> option determines what happens.
39004 </para>
39005 <para>
39006 The RFCs require support for domain literals; however, their use is
39007 controversial in today&#x2019;s Internet. If you want to use this router, you must
39008 also set the main configuration option <option>allow_domain_literals</option>. Otherwise,
39009 Exim will not recognize the domain literal syntax in addresses.
39010 </para>
39011 </chapter>
39012
39013 <chapter id="CHID6">
39014 <title>The iplookup router</title>
39015 <para>
39016 <indexterm role="concept">
39017 <primary><command>iplookup</command> router</primary>
39018 </indexterm>
39019 <indexterm role="concept">
39020 <primary>routers</primary>
39021 <secondary><command>iplookup</command></secondary>
39022 </indexterm>
39023 The <command>iplookup</command> router was written to fulfil a specific requirement in
39024 Cambridge University (which in fact no longer exists). For this reason, it is
39025 not included in the binary of Exim by default. If you want to include it, you
39026 must set
39027 </para>
39028 <literallayout class="monospaced">
39029 ROUTER_IPLOOKUP=yes
39030 </literallayout>
39031 <para>
39032 in your <filename>Local/Makefile</filename> configuration file.
39033 </para>
39034 <para>
39035 The <command>iplookup</command> router routes an address by sending it over a TCP or UDP
39036 connection to one or more specific hosts. The host can then return the same or
39037 a different address &ndash; in effect rewriting the recipient address in the
39038 message&#x2019;s envelope. The new address is then passed on to subsequent routers. If
39039 this process fails, the address can be passed on to other routers, or delivery
39040 can be deferred. Since <command>iplookup</command> is just a rewriting router, a transport
39041 must not be specified for it.
39042 </para>
39043 <para>
39044 <indexterm role="concept">
39045 <primary>options</primary>
39046 <secondary><command>iplookup</command> router</secondary>
39047 </indexterm>
39048 <indexterm role="option">
39049 <primary><option>hosts</option></primary>
39050 </indexterm>
39051 </para>
39052 <informaltable frame="all">
39053 <tgroup cols="4" colsep="0" rowsep="0">
39054 <colspec colwidth="8*" align="left"/>
39055 <colspec colwidth="6*" align="center"/>
39056 <colspec colwidth="6*" align="center"/>
39057 <colspec colwidth="6*" align="right"/>
39058 <tbody>
39059 <row>
39060 <entry><option>hosts</option></entry>
39061 <entry>Use: <emphasis>iplookup</emphasis></entry>
39062 <entry>Type: <emphasis>string</emphasis></entry>
39063 <entry>Default: <emphasis>unset</emphasis></entry>
39064 </row>
39065 </tbody>
39066 </tgroup>
39067 </informaltable>
39068 <para>
39069 This option must be supplied. Its value is a colon-separated list of host
39070 names. The hosts are looked up using <function>gethostbyname()</function>
39071 (or <function>getipnodebyname()</function> when available)
39072 and are tried in order until one responds to the query. If none respond, what
39073 happens is controlled by <option>optional</option>.
39074 </para>
39075 <para>
39076 <indexterm role="option">
39077 <primary><option>optional</option></primary>
39078 </indexterm>
39079 </para>
39080 <informaltable frame="all">
39081 <tgroup cols="4" colsep="0" rowsep="0">
39082 <colspec colwidth="8*" align="left"/>
39083 <colspec colwidth="6*" align="center"/>
39084 <colspec colwidth="6*" align="center"/>
39085 <colspec colwidth="6*" align="right"/>
39086 <tbody>
39087 <row>
39088 <entry><option>optional</option></entry>
39089 <entry>Use: <emphasis>iplookup</emphasis></entry>
39090 <entry>Type: <emphasis>boolean</emphasis></entry>
39091 <entry>Default: <emphasis>false</emphasis></entry>
39092 </row>
39093 </tbody>
39094 </tgroup>
39095 </informaltable>
39096 <para>
39097 If <option>optional</option> is true, if no response is obtained from any host, the address
39098 is passed to the next router, overriding <option>no_more</option>. If <option>optional</option> is false,
39099 delivery to the address is deferred.
39100 </para>
39101 <para>
39102 <indexterm role="option">
39103 <primary><option>port</option></primary>
39104 </indexterm>
39105 </para>
39106 <informaltable frame="all">
39107 <tgroup cols="4" colsep="0" rowsep="0">
39108 <colspec colwidth="8*" align="left"/>
39109 <colspec colwidth="6*" align="center"/>
39110 <colspec colwidth="6*" align="center"/>
39111 <colspec colwidth="6*" align="right"/>
39112 <tbody>
39113 <row>
39114 <entry><option>port</option></entry>
39115 <entry>Use: <emphasis>iplookup</emphasis></entry>
39116 <entry>Type: <emphasis>integer</emphasis></entry>
39117 <entry>Default: <emphasis>0</emphasis></entry>
39118 </row>
39119 </tbody>
39120 </tgroup>
39121 </informaltable>
39122 <para>
39123 <indexterm role="concept">
39124 <primary>port</primary>
39125 <secondary><command>iplookup</command> router</secondary>
39126 </indexterm>
39127 This option must be supplied. It specifies the port number for the TCP or UDP
39128 call.
39129 </para>
39130 <para>
39131 <indexterm role="option">
39132 <primary><option>protocol</option></primary>
39133 </indexterm>
39134 </para>
39135 <informaltable frame="all">
39136 <tgroup cols="4" colsep="0" rowsep="0">
39137 <colspec colwidth="8*" align="left"/>
39138 <colspec colwidth="6*" align="center"/>
39139 <colspec colwidth="6*" align="center"/>
39140 <colspec colwidth="6*" align="right"/>
39141 <tbody>
39142 <row>
39143 <entry><option>protocol</option></entry>
39144 <entry>Use: <emphasis>iplookup</emphasis></entry>
39145 <entry>Type: <emphasis>string</emphasis></entry>
39146 <entry>Default: <emphasis>udp</emphasis></entry>
39147 </row>
39148 </tbody>
39149 </tgroup>
39150 </informaltable>
39151 <para>
39152 This option can be set to <quote>udp</quote> or <quote>tcp</quote> to specify which of the two
39153 protocols is to be used.
39154 </para>
39155 <para>
39156 <indexterm role="option">
39157 <primary><option>query</option></primary>
39158 </indexterm>
39159 </para>
39160 <informaltable frame="all">
39161 <tgroup cols="4" colsep="0" rowsep="0">
39162 <colspec colwidth="8*" align="left"/>
39163 <colspec colwidth="6*" align="center"/>
39164 <colspec colwidth="6*" align="center"/>
39165 <colspec colwidth="6*" align="right"/>
39166 <tbody>
39167 <row>
39168 <entry><option>query</option></entry>
39169 <entry>Use: <emphasis>iplookup</emphasis></entry>
39170 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39171 <entry>Default: <emphasis>see below</emphasis></entry>
39172 </row>
39173 </tbody>
39174 </tgroup>
39175 </informaltable>
39176 <para>
39177 This defines the content of the query that is sent to the remote hosts. The
39178 default value is:
39179 </para>
39180 <literallayout class="monospaced">
39181 $local_part@$domain $local_part@$domain
39182 </literallayout>
39183 <para>
39184 The repetition serves as a way of checking that a response is to the correct
39185 query in the default case (see <option>response_pattern</option> below).
39186 </para>
39187 <para>
39188 <indexterm role="option">
39189 <primary><option>reroute</option></primary>
39190 </indexterm>
39191 </para>
39192 <informaltable frame="all">
39193 <tgroup cols="4" colsep="0" rowsep="0">
39194 <colspec colwidth="8*" align="left"/>
39195 <colspec colwidth="6*" align="center"/>
39196 <colspec colwidth="6*" align="center"/>
39197 <colspec colwidth="6*" align="right"/>
39198 <tbody>
39199 <row>
39200 <entry><option>reroute</option></entry>
39201 <entry>Use: <emphasis>iplookup</emphasis></entry>
39202 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39203 <entry>Default: <emphasis>unset</emphasis></entry>
39204 </row>
39205 </tbody>
39206 </tgroup>
39207 </informaltable>
39208 <para>
39209 If this option is not set, the rerouted address is precisely the byte string
39210 returned by the remote host, up to the first white space, if any. If set, the
39211 string is expanded to form the rerouted address. It can include parts matched
39212 in the response by <option>response_pattern</option> by means of numeric variables such as
39213 <varname>$1</varname>, <varname>$2</varname>, etc. The variable <varname>$0</varname> refers to the entire input string,
39214 whether or not a pattern is in use. In all cases, the rerouted address must end
39215 up in the form <emphasis>local_part@domain</emphasis>.
39216 </para>
39217 <para>
39218 <indexterm role="option">
39219 <primary><option>response_pattern</option></primary>
39220 </indexterm>
39221 </para>
39222 <informaltable frame="all">
39223 <tgroup cols="4" colsep="0" rowsep="0">
39224 <colspec colwidth="8*" align="left"/>
39225 <colspec colwidth="6*" align="center"/>
39226 <colspec colwidth="6*" align="center"/>
39227 <colspec colwidth="6*" align="right"/>
39228 <tbody>
39229 <row>
39230 <entry><option>response_pattern</option></entry>
39231 <entry>Use: <emphasis>iplookup</emphasis></entry>
39232 <entry>Type: <emphasis>string</emphasis></entry>
39233 <entry>Default: <emphasis>unset</emphasis></entry>
39234 </row>
39235 </tbody>
39236 </tgroup>
39237 </informaltable>
39238 <para>
39239 This option can be set to a regular expression that is applied to the string
39240 returned from the remote host. If the pattern does not match the response, the
39241 router declines. If <option>response_pattern</option> is not set, no checking of the
39242 response is done, unless the query was defaulted, in which case there is a
39243 check that the text returned after the first white space is the original
39244 address. This checks that the answer that has been received is in response to
39245 the correct question. For example, if the response is just a new domain, the
39246 following could be used:
39247 </para>
39248 <literallayout class="monospaced">
39249 response_pattern = ^([^@]+)$
39250 reroute = $local_part@$1
39251 </literallayout>
39252 <para>
39253 <indexterm role="option">
39254 <primary><option>timeout</option></primary>
39255 </indexterm>
39256 </para>
39257 <informaltable frame="all">
39258 <tgroup cols="4" colsep="0" rowsep="0">
39259 <colspec colwidth="8*" align="left"/>
39260 <colspec colwidth="6*" align="center"/>
39261 <colspec colwidth="6*" align="center"/>
39262 <colspec colwidth="6*" align="right"/>
39263 <tbody>
39264 <row>
39265 <entry><option>timeout</option></entry>
39266 <entry>Use: <emphasis>iplookup</emphasis></entry>
39267 <entry>Type: <emphasis>time</emphasis></entry>
39268 <entry>Default: <emphasis>5s</emphasis></entry>
39269 </row>
39270 </tbody>
39271 </tgroup>
39272 </informaltable>
39273 <para>
39274 This specifies the amount of time to wait for a response from the remote
39275 machine. The same timeout is used for the <function>connect()</function> function for a TCP
39276 call. It does not apply to UDP.
39277 </para>
39278 </chapter>
39279
39280 <chapter id="CHID7">
39281 <title>The manualroute router</title>
39282 <para>
39283 <indexterm role="concept" id="IIDmanrou1" class="startofrange">
39284 <primary><command>manualroute</command> router</primary>
39285 </indexterm>
39286 <indexterm role="concept" id="IIDmanrou2" class="startofrange">
39287 <primary>routers</primary>
39288 <secondary><command>manualroute</command></secondary>
39289 </indexterm>
39290 <indexterm role="concept">
39291 <primary>domain</primary>
39292 <secondary>manually routing</secondary>
39293 </indexterm>
39294 The <command>manualroute</command> router is so-called because it provides a way of manually
39295 routing an address according to its domain. It is mainly used when you want to
39296 route addresses to remote hosts according to your own rules, bypassing the
39297 normal DNS routing that looks up MX records. However, <command>manualroute</command> can also
39298 route to local transports, a facility that may be useful if you want to save
39299 messages for dial-in hosts in local files.
39300 </para>
39301 <para>
39302 The <command>manualroute</command> router compares a list of domain patterns with the domain
39303 it is trying to route. If there is no match, the router declines. Each pattern
39304 has associated with it a list of hosts and some other optional data, which may
39305 include a transport. The combination of a pattern and its data is called a
39306 <quote>routing rule</quote>. For patterns that do not have an associated transport, the
39307 generic <option>transport</option> option must specify a transport, unless the router is
39308 being used purely for verification (see <option>verify_only</option>).
39309 </para>
39310 <para>
39311 <indexterm role="variable">
39312 <primary><varname>$host</varname></primary>
39313 </indexterm>
39314 In the case of verification, matching the domain pattern is sufficient for the
39315 router to accept the address. When actually routing an address for delivery,
39316 an address that matches a domain pattern is queued for the associated
39317 transport. If the transport is not a local one, a host list must be associated
39318 with the pattern; IP addresses are looked up for the hosts, and these are
39319 passed to the transport along with the mail address. For local transports, a
39320 host list is optional. If it is present, it is passed in <varname>$host</varname> as a single
39321 text string.
39322 </para>
39323 <para>
39324 The list of routing rules can be provided as an inline string in
39325 <option>route_list</option>, or the data can be obtained by looking up the domain in a file
39326 or database by setting <option>route_data</option>. Only one of these settings may appear in
39327 any one instance of <command>manualroute</command>. The format of routing rules is described
39328 below, following the list of private options.
39329 </para>
39330 <section id="SECTprioptman">
39331 <title>Private options for manualroute</title>
39332 <para>
39333 <indexterm role="concept">
39334 <primary>options</primary>
39335 <secondary><command>manualroute</command> router</secondary>
39336 </indexterm>
39337 The private options for the <command>manualroute</command> router are as follows:
39338 </para>
39339 <para>
39340 <indexterm role="option">
39341 <primary><option>host_all_ignored</option></primary>
39342 </indexterm>
39343 </para>
39344 <informaltable frame="all">
39345 <tgroup cols="4" colsep="0" rowsep="0">
39346 <colspec colwidth="8*" align="left"/>
39347 <colspec colwidth="6*" align="center"/>
39348 <colspec colwidth="6*" align="center"/>
39349 <colspec colwidth="6*" align="right"/>
39350 <tbody>
39351 <row>
39352 <entry><option>host_all_ignored</option></entry>
39353 <entry>Use: <emphasis>manualroute</emphasis></entry>
39354 <entry>Type: <emphasis>string</emphasis></entry>
39355 <entry>Default: <emphasis>defer</emphasis></entry>
39356 </row>
39357 </tbody>
39358 </tgroup>
39359 </informaltable>
39360 <para>
39361 See <option>host_find_failed</option>.
39362 </para>
39363 <para>
39364 <indexterm role="option">
39365 <primary><option>host_find_failed</option></primary>
39366 </indexterm>
39367 </para>
39368 <informaltable frame="all">
39369 <tgroup cols="4" colsep="0" rowsep="0">
39370 <colspec colwidth="8*" align="left"/>
39371 <colspec colwidth="6*" align="center"/>
39372 <colspec colwidth="6*" align="center"/>
39373 <colspec colwidth="6*" align="right"/>
39374 <tbody>
39375 <row>
39376 <entry><option>host_find_failed</option></entry>
39377 <entry>Use: <emphasis>manualroute</emphasis></entry>
39378 <entry>Type: <emphasis>string</emphasis></entry>
39379 <entry>Default: <emphasis>freeze</emphasis></entry>
39380 </row>
39381 </tbody>
39382 </tgroup>
39383 </informaltable>
39384 <para>
39385 This option controls what happens when <command>manualroute</command> tries to find an IP
39386 address for a host, and the host does not exist. The option can be set to one
39387 of the following values:
39388 </para>
39389 <literallayout class="monospaced">
39390 decline
39391 defer
39392 fail
39393 freeze
39394 ignore
39395 pass
39396 </literallayout>
39397 <para>
39398 The default (<quote>freeze</quote>) assumes that this state is a serious configuration
39399 error. The difference between <quote>pass</quote> and <quote>decline</quote> is that the former
39400 forces the address to be passed to the next router (or the router defined by
39401 <option>pass_router</option>),
39402 <indexterm role="option">
39403 <primary><option>more</option></primary>
39404 </indexterm>
39405 overriding <option>no_more</option>, whereas the latter passes the address to the next
39406 router only if <option>more</option> is true.
39407 </para>
39408 <para>
39409 The value <quote>ignore</quote> causes Exim to completely ignore a host whose IP address
39410 cannot be found. If all the hosts in the list are ignored, the behaviour is
39411 controlled by the <option>host_all_ignored</option> option. This takes the same values
39412 as <option>host_find_failed</option>, except that it cannot be set to <quote>ignore</quote>.
39413 </para>
39414 <para>
39415 The <option>host_find_failed</option> option applies only to a definite <quote>does not exist</quote>
39416 state; if a host lookup gets a temporary error, delivery is deferred unless the
39417 generic <option>pass_on_timeout</option> option is set.
39418 </para>
39419 <para>
39420 <indexterm role="option">
39421 <primary><option>hosts_randomize</option></primary>
39422 </indexterm>
39423 </para>
39424 <informaltable frame="all">
39425 <tgroup cols="4" colsep="0" rowsep="0">
39426 <colspec colwidth="8*" align="left"/>
39427 <colspec colwidth="6*" align="center"/>
39428 <colspec colwidth="6*" align="center"/>
39429 <colspec colwidth="6*" align="right"/>
39430 <tbody>
39431 <row>
39432 <entry><option>hosts_randomize</option></entry>
39433 <entry>Use: <emphasis>manualroute</emphasis></entry>
39434 <entry>Type: <emphasis>boolean</emphasis></entry>
39435 <entry>Default: <emphasis>false</emphasis></entry>
39436 </row>
39437 </tbody>
39438 </tgroup>
39439 </informaltable>
39440 <para>
39441 <indexterm role="concept">
39442 <primary>randomized host list</primary>
39443 </indexterm>
39444 <indexterm role="concept">
39445 <primary>host</primary>
39446 <secondary>list of; randomized</secondary>
39447 </indexterm>
39448 If this option is set, the order of the items in a host list in a routing rule
39449 is randomized each time the list is used, unless an option in the routing rule
39450 overrides (see below). Randomizing the order of a host list can be used to do
39451 crude load sharing. However, if more than one mail address is routed by the
39452 same router to the same host list, the host lists are considered to be the same
39453 (even though they may be randomized into different orders) for the purpose of
39454 deciding whether to batch the deliveries into a single SMTP transaction.
39455 </para>
39456 <para>
39457 When <option>hosts_randomize</option> is true, a host list may be split
39458 into groups whose order is separately randomized. This makes it possible to
39459 set up MX-like behaviour. The boundaries between groups are indicated by an
39460 item that is just <literal>+</literal> in the host list. For example:
39461 </para>
39462 <literallayout class="monospaced">
39463 route_list = * host1:host2:host3:+:host4:host5
39464 </literallayout>
39465 <para>
39466 The order of the first three hosts and the order of the last two hosts is
39467 randomized for each use, but the first three always end up before the last two.
39468 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored. If a
39469 randomized host list is passed to an <command>smtp</command> transport that also has
39470 <option>hosts_randomize set</option>, the list is not re-randomized.
39471 </para>
39472 <para>
39473 <indexterm role="option">
39474 <primary><option>route_data</option></primary>
39475 </indexterm>
39476 </para>
39477 <informaltable frame="all">
39478 <tgroup cols="4" colsep="0" rowsep="0">
39479 <colspec colwidth="8*" align="left"/>
39480 <colspec colwidth="6*" align="center"/>
39481 <colspec colwidth="6*" align="center"/>
39482 <colspec colwidth="6*" align="right"/>
39483 <tbody>
39484 <row>
39485 <entry><option>route_data</option></entry>
39486 <entry>Use: <emphasis>manualroute</emphasis></entry>
39487 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
39488 <entry>Default: <emphasis>unset</emphasis></entry>
39489 </row>
39490 </tbody>
39491 </tgroup>
39492 </informaltable>
39493 <para>
39494 If this option is set, it must expand to yield the data part of a routing rule.
39495 Typically, the expansion string includes a lookup based on the domain. For
39496 example:
39497 </para>
39498 <literallayout class="monospaced">
39499 route_data = ${lookup{$domain}dbm{/etc/routes}}
39500 </literallayout>
39501 <para>
39502 If the expansion is forced to fail, or the result is an empty string, the
39503 router declines. Other kinds of expansion failure cause delivery to be
39504 deferred.
39505 </para>
39506 <para>
39507 <indexterm role="option">
39508 <primary><option>route_list</option></primary>
39509 </indexterm>
39510 </para>
39511 <informaltable frame="all">
39512 <tgroup cols="4" colsep="0" rowsep="0">
39513 <colspec colwidth="8*" align="left"/>
39514 <colspec colwidth="6*" align="center"/>
39515 <colspec colwidth="6*" align="center"/>
39516 <colspec colwidth="6*" align="right"/>
39517 <tbody>
39518 <row>
39519 <entry><option>route_list</option></entry>
39520 <entry>Use: <emphasis>manualroute</emphasis></entry>
39521 <entry>Type: <emphasis>string list</emphasis></entry>
39522 <entry>Default: <emphasis>unset</emphasis></entry>
39523 </row>
39524 </tbody>
39525 </tgroup>
39526 </informaltable>
39527 <para>
39528 This string is a list of routing rules, in the form defined below. Note that,
39529 unlike most string lists, the items are separated by semicolons. This is so
39530 that they may contain colon-separated host lists.
39531 </para>
39532 <para>
39533 <indexterm role="option">
39534 <primary><option>same_domain_copy_routing</option></primary>
39535 </indexterm>
39536 </para>
39537 <informaltable frame="all">
39538 <tgroup cols="4" colsep="0" rowsep="0">
39539 <colspec colwidth="8*" align="left"/>
39540 <colspec colwidth="6*" align="center"/>
39541 <colspec colwidth="6*" align="center"/>
39542 <colspec colwidth="6*" align="right"/>
39543 <tbody>
39544 <row>
39545 <entry><option>same_domain_copy_routing</option></entry>
39546 <entry>Use: <emphasis>manualroute</emphasis></entry>
39547 <entry>Type: <emphasis>boolean</emphasis></entry>
39548 <entry>Default: <emphasis>false</emphasis></entry>
39549 </row>
39550 </tbody>
39551 </tgroup>
39552 </informaltable>
39553 <para>
39554 <indexterm role="concept">
39555 <primary>address</primary>
39556 <secondary>copying routing</secondary>
39557 </indexterm>
39558 Addresses with the same domain are normally routed by the <command>manualroute</command>
39559 router to the same list of hosts. However, this cannot be presumed, because the
39560 router options and preconditions may refer to the local part of the address. By
39561 default, therefore, Exim routes each address in a message independently. DNS
39562 servers run caches, so repeated DNS lookups are not normally expensive, and in
39563 any case, personal messages rarely have more than a few recipients.
39564 </para>
39565 <para>
39566 If you are running mailing lists with large numbers of subscribers at the same
39567 domain, and you are using a <command>manualroute</command> router which is independent of the
39568 local part, you can set <option>same_domain_copy_routing</option> to bypass repeated DNS
39569 lookups for identical domains in one message. In this case, when
39570 <command>manualroute</command> routes an address to a remote transport, any other unrouted
39571 addresses in the message that have the same domain are automatically given the
39572 same routing without processing them independently. However, this is only done
39573 if <option>headers_add</option> and <option>headers_remove</option> are unset.
39574 </para>
39575 </section>
39576 <section id="SECID120">
39577 <title>Routing rules in route_list</title>
39578 <para>
39579 The value of <option>route_list</option> is a string consisting of a sequence of routing
39580 rules, separated by semicolons. If a semicolon is needed in a rule, it can be
39581 entered as two semicolons. Alternatively, the list separator can be changed as
39582 described (for colon-separated lists) in section <xref linkend="SECTlistconstruct"/>.
39583 Empty rules are ignored. The format of each rule is
39584 </para>
39585 <literallayout>
39586 &lt;<emphasis>domain pattern</emphasis>&gt;  &lt;<emphasis>list of hosts</emphasis>&gt;  &lt;<emphasis>options</emphasis>&gt;
39587 </literallayout>
39588 <para>
39589 The following example contains two rules, each with a simple domain pattern and
39590 no options:
39591 </para>
39592 <literallayout class="monospaced">
39593 route_list = \
39594   dict.ref.example  mail-1.ref.example:mail-2.ref.example ; \
39595   thes.ref.example  mail-3.ref.example:mail-4.ref.example
39596 </literallayout>
39597 <para>
39598 The three parts of a rule are separated by white space. The pattern and the
39599 list of hosts can be enclosed in quotes if necessary, and if they are, the
39600 usual quoting rules apply. Each rule in a <option>route_list</option> must start with a
39601 single domain pattern, which is the only mandatory item in the rule. The
39602 pattern is in the same format as one item in a domain list (see section
39603 <xref linkend="SECTdomainlist"/>),
39604 except that it may not be the name of an interpolated file.
39605 That is, it may be wildcarded, or a regular expression, or a file or database
39606 lookup (with semicolons doubled, because of the use of semicolon as a separator
39607 in a <option>route_list</option>).
39608 </para>
39609 <para>
39610 The rules in <option>route_list</option> are searched in order until one of the patterns
39611 matches the domain that is being routed. The list of hosts and then options are
39612 then used as described below. If there is no match, the router declines. When
39613 <option>route_list</option> is set, <option>route_data</option> must not be set.
39614 </para>
39615 </section>
39616 <section id="SECID121">
39617 <title>Routing rules in route_data</title>
39618 <para>
39619 The use of <option>route_list</option> is convenient when there are only a small number of
39620 routing rules. For larger numbers, it is easier to use a file or database to
39621 hold the routing information, and use the <option>route_data</option> option instead.
39622 The value of <option>route_data</option> is a list of hosts, followed by (optional) options.
39623 Most commonly, <option>route_data</option> is set as a string that contains an
39624 expansion lookup. For example, suppose we place two routing rules in a file
39625 like this:
39626 </para>
39627 <literallayout class="monospaced">
39628 dict.ref.example:  mail-1.ref.example:mail-2.ref.example
39629 thes.ref.example:  mail-3.ref.example:mail-4.ref.example
39630 </literallayout>
39631 <para>
39632 This data can be accessed by setting
39633 </para>
39634 <literallayout class="monospaced">
39635 route_data = ${lookup{$domain}lsearch{/the/file/name}}
39636 </literallayout>
39637 <para>
39638 Failure of the lookup results in an empty string, causing the router to
39639 decline. However, you do not have to use a lookup in <option>route_data</option>. The only
39640 requirement is that the result of expanding the string is a list of hosts,
39641 possibly followed by options, separated by white space. The list of hosts must
39642 be enclosed in quotes if it contains white space.
39643 </para>
39644 </section>
39645 <section id="SECID122">
39646 <title>Format of the list of hosts</title>
39647 <para>
39648 A list of hosts, whether obtained via <option>route_data</option> or <option>route_list</option>, is
39649 always separately expanded before use. If the expansion fails, the router
39650 declines. The result of the expansion must be a colon-separated list of names
39651 and/or IP addresses, optionally also including ports.
39652 If the list is written with spaces, it must be protected with quotes.
39653 The format of each item
39654 in the list is described in the next section. The list separator can be changed
39655 as described in section <xref linkend="SECTlistsepchange"/>.
39656 </para>
39657 <para>
39658 If the list of hosts was obtained from a <option>route_list</option> item, the following
39659 variables are set during its expansion:
39660 </para>
39661 <itemizedlist>
39662 <listitem>
39663 <para>
39664 <indexterm role="concept">
39665 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname>  etc)</primary>
39666 <secondary>in <command>manualroute</command> router</secondary>
39667 </indexterm>
39668 If the domain was matched against a regular expression, the numeric variables
39669 <varname>$1</varname>, <varname>$2</varname>, etc. may be set. For example:
39670 </para>
39671 <literallayout class="monospaced">
39672 route_list = ^domain(\d+)   host-$1.text.example
39673 </literallayout>
39674 </listitem>
39675 <listitem>
39676 <para>
39677 <varname>$0</varname> is always set to the entire domain.
39678 </para>
39679 </listitem>
39680 <listitem>
39681 <para>
39682 <varname>$1</varname> is also set when partial matching is done in a file lookup.
39683 </para>
39684 </listitem>
39685 <listitem>
39686 <para>
39687 <indexterm role="variable">
39688 <primary><varname>$value</varname></primary>
39689 </indexterm>
39690 If the pattern that matched the domain was a lookup item, the data that was
39691 looked up is available in the expansion variable <varname>$value</varname>. For example:
39692 </para>
39693 <literallayout class="monospaced">
39694 route_list = lsearch;;/some/file.routes  $value
39695 </literallayout>
39696 </listitem>
39697 </itemizedlist>
39698 <para>
39699 Note the doubling of the semicolon in the pattern that is necessary because
39700 semicolon is the default route list separator.
39701 </para>
39702 </section>
39703 <section id="SECTformatonehostitem">
39704 <title>Format of one host item</title>
39705 <para>
39706 Each item in the list of hosts can be either a host name or an IP address,
39707 optionally with an attached port number, or it can be a single "+"
39708 (see <option>hosts_randomize</option>).
39709 When no port is given, an IP address
39710 is not enclosed in brackets. When a port is specified, it overrides the port
39711 specification on the transport. The port is separated from the name or address
39712 by a colon. This leads to some complications:
39713 </para>
39714 <itemizedlist>
39715 <listitem>
39716 <para>
39717 Because colon is the default separator for the list of hosts, either
39718 the colon that specifies a port must be doubled, or the list separator must
39719 be changed. The following two examples have the same effect:
39720 </para>
39721 <literallayout class="monospaced">
39722 route_list = * "host1.tld::1225 : host2.tld::1226"
39723 route_list = * "&lt;+ host1.tld:1225 + host2.tld:1226"
39724 </literallayout>
39725 </listitem>
39726 <listitem>
39727 <para>
39728 When IPv6 addresses are involved, it gets worse, because they contain
39729 colons of their own. To make this case easier, it is permitted to
39730 enclose an IP address (either v4 or v6) in square brackets if a port
39731 number follows. For example:
39732 </para>
39733 <literallayout class="monospaced">
39734 route_list = * "&lt;/ [10.1.1.1]:1225 / [::1]:1226"
39735 </literallayout>
39736 </listitem>
39737 </itemizedlist>
39738 </section>
39739 <section id="SECThostshowused">
39740 <title>How the list of hosts is used</title>
39741 <para>
39742 When an address is routed to an <command>smtp</command> transport by <command>manualroute</command>, each of
39743 the hosts is tried, in the order specified, when carrying out the SMTP
39744 delivery. However, the order can be changed by setting the <option>hosts_randomize</option>
39745 option, either on the router (see section <xref linkend="SECTprioptman"/> above), or on the
39746 transport.
39747 </para>
39748 <para>
39749 Hosts may be listed by name or by IP address. An unadorned name in the list of
39750 hosts is interpreted as a host name. A name that is followed by <literal>/MX</literal> is
39751 interpreted as an indirection to a sublist of hosts obtained by looking up MX
39752 records in the DNS. For example:
39753 </para>
39754 <literallayout class="monospaced">
39755 route_list = *  x.y.z:p.q.r/MX:e.f.g
39756 </literallayout>
39757 <para>
39758 If this feature is used with a port specifier, the port must come last. For
39759 example:
39760 </para>
39761 <literallayout class="monospaced">
39762 route_list = *  dom1.tld/mx::1225
39763 </literallayout>
39764 <para>
39765 If the <option>hosts_randomize</option> option is set, the order of the items in the list is
39766 randomized before any lookups are done. Exim then scans the list; for any name
39767 that is not followed by <literal>/MX</literal> it looks up an IP address. If this turns out to
39768 be an interface on the local host and the item is not the first in the list,
39769 Exim discards it and any subsequent items. If it is the first item, what
39770 happens is controlled by the
39771 <indexterm role="option">
39772 <primary><option>self</option></primary>
39773 <secondary>in <command>manualroute</command> router</secondary>
39774 </indexterm>
39775 <option>self</option> option of the router.
39776 </para>
39777 <para>
39778 A name on the list that is followed by <literal>/MX</literal> is replaced with the list of
39779 hosts obtained by looking up MX records for the name. This is always a DNS
39780 lookup; the <option>bydns</option> and <option>byname</option> options (see section <xref linkend="SECThowoptused"/>
39781 below) are not relevant here. The order of these hosts is determined by the
39782 preference values in the MX records, according to the usual rules. Because
39783 randomizing happens before the MX lookup, it does not affect the order that is
39784 defined by MX preferences.
39785 </para>
39786 <para>
39787 If the local host is present in the sublist obtained from MX records, but is
39788 not the most preferred host in that list, it and any equally or less
39789 preferred hosts are removed before the sublist is inserted into the main list.
39790 </para>
39791 <para>
39792 If the local host is the most preferred host in the MX list, what happens
39793 depends on where in the original list of hosts the <literal>/MX</literal> item appears. If it
39794 is not the first item (that is, there are previous hosts in the main list),
39795 Exim discards this name and any subsequent items in the main list.
39796 </para>
39797 <para>
39798 If the MX item is first in the list of hosts, and the local host is the
39799 most preferred host, what happens is controlled by the <option>self</option> option of the
39800 router.
39801 </para>
39802 <para>
39803 DNS failures when lookup up the MX records are treated in the same way as DNS
39804 failures when looking up IP addresses: <option>pass_on_timeout</option> and
39805 <option>host_find_failed</option> are used when relevant.
39806 </para>
39807 <para>
39808 The generic <option>ignore_target_hosts</option> option applies to all hosts in the list,
39809 whether obtained from an MX lookup or not.
39810 </para>
39811 </section>
39812 <section id="SECThowoptused">
39813 <title>How the options are used</title>
39814 <para>
39815 The options are a sequence of words, space-separated.
39816 One of the words can be the name of a transport; this overrides the
39817 <option>transport</option> option on the router for this particular routing rule only. The
39818 other words (if present) control randomization of the list of hosts on a
39819 per-rule basis, and how the IP addresses of the hosts are to be found when
39820 routing to a remote transport. These options are as follows:
39821 </para>
39822 <itemizedlist>
39823 <listitem>
39824 <para>
39825 <option>randomize</option>: randomize the order of the hosts in this list, overriding the
39826 setting of <option>hosts_randomize</option> for this routing rule only.
39827 </para>
39828 </listitem>
39829 <listitem>
39830 <para>
39831 <option>no_randomize</option>: do not randomize the order of the hosts in this list,
39832 overriding the setting of <option>hosts_randomize</option> for this routing rule only.
39833 </para>
39834 </listitem>
39835 <listitem>
39836 <para>
39837 <option>byname</option>: use <function>getipnodebyname()</function> (<function>gethostbyname()</function> on older systems) to
39838 find IP addresses. This function may ultimately cause a DNS lookup, but it may
39839 also look in <filename>/etc/hosts</filename> or other sources of information.
39840 </para>
39841 </listitem>
39842 <listitem>
39843 <para>
39844 <option>bydns</option>: look up address records for the hosts directly in the DNS; fail if
39845 no address records are found. If there is a temporary DNS error (such as a
39846 timeout), delivery is deferred.
39847 </para>
39848 </listitem>
39849 <listitem>
39850 <para>
39851 <option>ipv4_only</option>: in direct DNS lookups, look up only A records.
39852 </para>
39853 </listitem>
39854 <listitem>
39855 <para>
39856 <option>ipv4_prefer</option>: in direct DNS lookups, sort A records before AAAA records.
39857 </para>
39858 </listitem>
39859 </itemizedlist>
39860 <para>
39861 For example:
39862 </para>
39863 <literallayout class="monospaced">
39864 route_list = domain1  host1:host2:host3  randomize bydns;\
39865              domain2  host4:host5
39866 </literallayout>
39867 <para>
39868 If neither <option>byname</option> nor <option>bydns</option> is given, Exim behaves as follows: First, a
39869 DNS lookup is done. If this yields anything other than HOST_NOT_FOUND, that
39870 result is used. Otherwise, Exim goes on to try a call to <function>getipnodebyname()</function>
39871 or <function>gethostbyname()</function>, and the result of the lookup is the result of that
39872 call.
39873 </para>
39874 <para>
39875 <emphasis role="bold">Warning</emphasis>: It has been discovered that on some systems, if a DNS lookup
39876 called via <function>getipnodebyname()</function> times out, HOST_NOT_FOUND is returned
39877 instead of TRY_AGAIN. That is why the default action is to try a DNS
39878 lookup first. Only if that gives a definite <quote>no such host</quote> is the local
39879 function called.
39880 </para>
39881 <para>
39882 <emphasis role="bold">Compatibility</emphasis>: From Exim 4.85 until fixed for 4.90, there was an
39883 inadvertent constraint that a transport name as an option had to be the last
39884 option specified.
39885 </para>
39886 <para>
39887 If no IP address for a host can be found, what happens is controlled by the
39888 <option>host_find_failed</option> option.
39889 </para>
39890 <para>
39891 <indexterm role="variable">
39892 <primary><varname>$host</varname></primary>
39893 </indexterm>
39894 When an address is routed to a local transport, IP addresses are not looked up.
39895 The host list is passed to the transport in the <varname>$host</varname> variable.
39896 </para>
39897 </section>
39898 <section id="SECID123">
39899 <title>Manualroute examples</title>
39900 <para>
39901 In some of the examples that follow, the presence of the <option>remote_smtp</option>
39902 transport, as defined in the default configuration file, is assumed:
39903 </para>
39904 <itemizedlist>
39905 <listitem>
39906 <para>
39907 <indexterm role="concept">
39908 <primary>smart host</primary>
39909 <secondary>example router</secondary>
39910 </indexterm>
39911 The <command>manualroute</command> router can be used to forward all external mail to a
39912 <emphasis>smart host</emphasis>. If you have set up, in the main part of the configuration, a
39913 named domain list that contains your local domains, for example:
39914 </para>
39915 <literallayout class="monospaced">
39916 domainlist local_domains = my.domain.example
39917 </literallayout>
39918 <para>
39919 You can arrange for all other domains to be routed to a smart host by making
39920 your first router something like this:
39921 </para>
39922 <literallayout class="monospaced">
39923 smart_route:
39924   driver = manualroute
39925   domains = !+local_domains
39926   transport = remote_smtp
39927   route_list = * smarthost.ref.example
39928 </literallayout>
39929 <para>
39930 This causes all non-local addresses to be sent to the single host
39931 <emphasis>smarthost.ref.example</emphasis>. If a colon-separated list of smart hosts is given,
39932 they are tried in order
39933 (but you can use <option>hosts_randomize</option> to vary the order each time).
39934 Another way of configuring the same thing is this:
39935 </para>
39936 <literallayout class="monospaced">
39937 smart_route:
39938   driver = manualroute
39939   transport = remote_smtp
39940   route_list = !+local_domains  smarthost.ref.example
39941 </literallayout>
39942 <para>
39943 There is no difference in behaviour between these two routers as they stand.
39944 However, they behave differently if <option>no_more</option> is added to them. In the first
39945 example, the router is skipped if the domain does not match the <option>domains</option>
39946 precondition; the following router is always tried. If the router runs, it
39947 always matches the domain and so can never decline. Therefore, <option>no_more</option>
39948 would have no effect. In the second case, the router is never skipped; it
39949 always runs. However, if it doesn&#x2019;t match the domain, it declines. In this case
39950 <option>no_more</option> would prevent subsequent routers from running.
39951 </para>
39952 </listitem>
39953 <listitem>
39954 <para>
39955 <indexterm role="concept">
39956 <primary>mail hub example</primary>
39957 </indexterm>
39958 A <emphasis>mail hub</emphasis> is a host which receives mail for a number of domains via MX
39959 records in the DNS and delivers it via its own private routing mechanism. Often
39960 the final destinations are behind a firewall, with the mail hub being the one
39961 machine that can connect to machines both inside and outside the firewall. The
39962 <command>manualroute</command> router is usually used on a mail hub to route incoming messages
39963 to the correct hosts. For a small number of domains, the routing can be inline,
39964 using the <option>route_list</option> option, but for a larger number a file or database
39965 lookup is easier to manage.
39966 </para>
39967 <para>
39968 If the domain names are in fact the names of the machines to which the mail is
39969 to be sent by the mail hub, the configuration can be quite simple. For
39970 example:
39971 </para>
39972 <literallayout class="monospaced">
39973 hub_route:
39974   driver = manualroute
39975   transport = remote_smtp
39976   route_list = *.rhodes.tvs.example  $domain
39977 </literallayout>
39978 <para>
39979 This configuration routes domains that match <literal>*.rhodes.tvs.example</literal> to hosts
39980 whose names are the same as the mail domains. A similar approach can be taken
39981 if the host name can be obtained from the domain name by a string manipulation
39982 that the expansion facilities can handle. Otherwise, a lookup based on the
39983 domain can be used to find the host:
39984 </para>
39985 <literallayout class="monospaced">
39986 through_firewall:
39987   driver = manualroute
39988   transport = remote_smtp
39989   route_data = ${lookup {$domain} cdb {/internal/host/routes}}
39990 </literallayout>
39991 <para>
39992 The result of the lookup must be the name or IP address of the host (or
39993 hosts) to which the address is to be routed. If the lookup fails, the route
39994 data is empty, causing the router to decline. The address then passes to the
39995 next router.
39996 </para>
39997 </listitem>
39998 <listitem>
39999 <para>
40000 <indexterm role="concept">
40001 <primary>batched SMTP output example</primary>
40002 </indexterm>
40003 <indexterm role="concept">
40004 <primary>SMTP</primary>
40005 <secondary>batched outgoing; example</secondary>
40006 </indexterm>
40007 You can use <command>manualroute</command> to deliver messages to pipes or files in batched
40008 SMTP format for onward transportation by some other means. This is one way of
40009 storing mail for a dial-up host when it is not connected. The route list entry
40010 can be as simple as a single domain name in a configuration like this:
40011 </para>
40012 <literallayout class="monospaced">
40013 save_in_file:
40014   driver = manualroute
40015   transport = batchsmtp_appendfile
40016   route_list = saved.domain.example
40017 </literallayout>
40018 <para>
40019 though often a pattern is used to pick up more than one domain. If there are
40020 several domains or groups of domains with different transport requirements,
40021 different transports can be listed in the routing information:
40022 </para>
40023 <literallayout class="monospaced">
40024 save_in_file:
40025   driver = manualroute
40026   route_list = \
40027     *.saved.domain1.example  $domain  batch_appendfile; \
40028     *.saved.domain2.example  \
40029       ${lookup{$domain}dbm{/domain2/hosts}{$value}fail} \
40030       batch_pipe
40031 </literallayout>
40032 <para>
40033 <indexterm role="variable">
40034 <primary><varname>$domain</varname></primary>
40035 </indexterm>
40036 <indexterm role="variable">
40037 <primary><varname>$host</varname></primary>
40038 </indexterm>
40039 The first of these just passes the domain in the <varname>$host</varname> variable, which
40040 doesn&#x2019;t achieve much (since it is also in <varname>$domain</varname>), but the second does a
40041 file lookup to find a value to pass, causing the router to decline to handle
40042 the address if the lookup fails.
40043 </para>
40044 </listitem>
40045 <listitem>
40046 <para>
40047 <indexterm role="concept">
40048 <primary>UUCP</primary>
40049 <secondary>example of router for</secondary>
40050 </indexterm>
40051 Routing mail directly to UUCP software is a specific case of the use of
40052 <command>manualroute</command> in a gateway to another mail environment. This is an example of
40053 one way it can be done:
40054 </para>
40055 <literallayout class="monospaced">
40056 # Transport
40057 uucp:
40058   driver = pipe
40059   user = nobody
40060   command = /usr/local/bin/uux -r - \
40061     ${substr_-5:$host}!rmail ${local_part}
40062   return_fail_output = true
40063
40064 # Router
40065 uucphost:
40066   transport = uucp
40067   driver = manualroute
40068   route_data = \
40069     ${lookup{$domain}lsearch{/usr/local/exim/uucphosts}}
40070 </literallayout>
40071 <para>
40072 The file <filename>/usr/local/exim/uucphosts</filename> contains entries like
40073 </para>
40074 <literallayout class="monospaced">
40075 darksite.ethereal.example:           darksite.UUCP
40076 </literallayout>
40077 <para>
40078 It can be set up more simply without adding and removing <quote>.UUCP</quote> but this way
40079 makes clear the distinction between the domain name
40080 <emphasis>darksite.ethereal.example</emphasis> and the UUCP host name <emphasis>darksite</emphasis>.
40081 </para>
40082 </listitem>
40083 </itemizedlist>
40084 <para>
40085 <indexterm role="concept" startref="IIDmanrou1" class="endofrange"/>
40086 <indexterm role="concept" startref="IIDmanrou2" class="endofrange"/>
40087 </para>
40088 </section>
40089 </chapter>
40090
40091 <chapter id="CHAPdriverlast">
40092 <title>The queryprogram router</title>
40093 <para>
40094 <indexterm role="concept" id="IIDquerou1" class="startofrange">
40095 <primary><command>queryprogram</command> router</primary>
40096 </indexterm>
40097 <indexterm role="concept" id="IIDquerou2" class="startofrange">
40098 <primary>routers</primary>
40099 <secondary><command>queryprogram</command></secondary>
40100 </indexterm>
40101 <indexterm role="concept">
40102 <primary>routing</primary>
40103 <secondary>by external program</secondary>
40104 </indexterm>
40105 The <command>queryprogram</command> router routes an address by running an external command
40106 and acting on its output. This is an expensive way to route, and is intended
40107 mainly for use in lightly-loaded systems, or for performing experiments.
40108 However, if it is possible to use the precondition options (<option>domains</option>,
40109 <option>local_parts</option>, etc) to skip this router for most addresses, it could sensibly
40110 be used in special cases, even on a busy host. There are the following private
40111 options:
40112 <indexterm role="concept">
40113 <primary>options</primary>
40114 <secondary><command>queryprogram</command> router</secondary>
40115 </indexterm>
40116 </para>
40117 <para>
40118 <indexterm role="option">
40119 <primary><option>command</option></primary>
40120 </indexterm>
40121 </para>
40122 <informaltable frame="all">
40123 <tgroup cols="4" colsep="0" rowsep="0">
40124 <colspec colwidth="8*" align="left"/>
40125 <colspec colwidth="6*" align="center"/>
40126 <colspec colwidth="6*" align="center"/>
40127 <colspec colwidth="6*" align="right"/>
40128 <tbody>
40129 <row>
40130 <entry><option>command</option></entry>
40131 <entry>Use: <emphasis>queryprogram</emphasis></entry>
40132 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
40133 <entry>Default: <emphasis>unset</emphasis></entry>
40134 </row>
40135 </tbody>
40136 </tgroup>
40137 </informaltable>
40138 <para>
40139 This option must be set. It specifies the command that is to be run. The
40140 command is split up into a command name and arguments, and then each is
40141 expanded separately (exactly as for a <command>pipe</command> transport, described in chapter
40142 <xref linkend="CHAPpipetransport"/>).
40143 </para>
40144 <para>
40145 <indexterm role="option">
40146 <primary><option>command_group</option></primary>
40147 </indexterm>
40148 </para>
40149 <informaltable frame="all">
40150 <tgroup cols="4" colsep="0" rowsep="0">
40151 <colspec colwidth="8*" align="left"/>
40152 <colspec colwidth="6*" align="center"/>
40153 <colspec colwidth="6*" align="center"/>
40154 <colspec colwidth="6*" align="right"/>
40155 <tbody>
40156 <row>
40157 <entry><option>command_group</option></entry>
40158 <entry>Use: <emphasis>queryprogram</emphasis></entry>
40159 <entry>Type: <emphasis>string</emphasis></entry>
40160 <entry>Default: <emphasis>unset</emphasis></entry>
40161 </row>
40162 </tbody>
40163 </tgroup>
40164 </informaltable>
40165 <para>
40166 <indexterm role="concept">
40167 <primary>gid (group id)</primary>
40168 <secondary>in <command>queryprogram</command> router</secondary>
40169 </indexterm>
40170 This option specifies a gid to be set when running the command while routing an
40171 address for deliver. It must be set if <option>command_user</option> specifies a numerical
40172 uid. If it begins with a digit, it is interpreted as the numerical value of the
40173 gid. Otherwise it is looked up using <function>getgrnam()</function>.
40174 </para>
40175 <para>
40176 <indexterm role="option">
40177 <primary><option>command_user</option></primary>
40178 </indexterm>
40179 </para>
40180 <informaltable frame="all">
40181 <tgroup cols="4" colsep="0" rowsep="0">
40182 <colspec colwidth="8*" align="left"/>
40183 <colspec colwidth="6*" align="center"/>
40184 <colspec colwidth="6*" align="center"/>
40185 <colspec colwidth="6*" align="right"/>
40186 <tbody>
40187 <row>
40188 <entry><option>command_user</option></entry>
40189 <entry>Use: <emphasis>queryprogram</emphasis></entry>
40190 <entry>Type: <emphasis>string</emphasis></entry>
40191 <entry>Default: <emphasis>unset</emphasis></entry>
40192 </row>
40193 </tbody>
40194 </tgroup>
40195 </informaltable>
40196 <para>
40197 <indexterm role="concept">
40198 <primary>uid (user id)</primary>
40199 <secondary>for <command>queryprogram</command></secondary>
40200 </indexterm>
40201 This option must be set. It specifies the uid which is set when running the
40202 command while routing an address for delivery. If the value begins with a digit,
40203 it is interpreted as the numerical value of the uid. Otherwise, it is looked up
40204 using <function>getpwnam()</function> to obtain a value for the uid and, if <option>command_group</option> is
40205 not set, a value for the gid also.
40206 </para>
40207 <para>
40208 <emphasis role="bold">Warning:</emphasis> Changing uid and gid is possible only when Exim is running as
40209 root, which it does during a normal delivery in a conventional configuration.
40210 However, when an address is being verified during message reception, Exim is
40211 usually running as the Exim user, not as root. If the <command>queryprogram</command> router
40212 is called from a non-root process, Exim cannot change uid or gid before running
40213 the command. In this circumstance the command runs under the current uid and
40214 gid.
40215 </para>
40216 <para>
40217 <indexterm role="option">
40218 <primary><option>current_directory</option></primary>
40219 </indexterm>
40220 </para>
40221 <informaltable frame="all">
40222 <tgroup cols="4" colsep="0" rowsep="0">
40223 <colspec colwidth="8*" align="left"/>
40224 <colspec colwidth="6*" align="center"/>
40225 <colspec colwidth="6*" align="center"/>
40226 <colspec colwidth="6*" align="right"/>
40227 <tbody>
40228 <row>
40229 <entry><option>current_directory</option></entry>
40230 <entry>Use: <emphasis>queryprogram</emphasis></entry>
40231 <entry>Type: <emphasis>string</emphasis></entry>
40232 <entry>Default: <emphasis>/</emphasis></entry>
40233 </row>
40234 </tbody>
40235 </tgroup>
40236 </informaltable>
40237 <para>
40238 This option specifies an absolute path which is made the current directory
40239 before running the command.
40240 </para>
40241 <para>
40242 <indexterm role="option">
40243 <primary><option>timeout</option></primary>
40244 </indexterm>
40245 </para>
40246 <informaltable frame="all">
40247 <tgroup cols="4" colsep="0" rowsep="0">
40248 <colspec colwidth="8*" align="left"/>
40249 <colspec colwidth="6*" align="center"/>
40250 <colspec colwidth="6*" align="center"/>
40251 <colspec colwidth="6*" align="right"/>
40252 <tbody>
40253 <row>
40254 <entry><option>timeout</option></entry>
40255 <entry>Use: <emphasis>queryprogram</emphasis></entry>
40256 <entry>Type: <emphasis>time</emphasis></entry>
40257 <entry>Default: <emphasis>1h</emphasis></entry>
40258 </row>
40259 </tbody>
40260 </tgroup>
40261 </informaltable>
40262 <para>
40263 If the command does not complete within the timeout period, its process group
40264 is killed and the message is frozen. A value of zero time specifies no
40265 timeout.
40266 </para>
40267 <para>
40268 The standard output of the command is connected to a pipe, which is read when
40269 the command terminates. It should consist of a single line of output,
40270 containing up to five fields, separated by white space. The maximum length of
40271 the line is 1023 characters. Longer lines are silently truncated. The first
40272 field is one of the following words (case-insensitive):
40273 </para>
40274 <itemizedlist>
40275 <listitem>
40276 <para>
40277 <emphasis>Accept</emphasis>: routing succeeded; the remaining fields specify what to do (see
40278 below).
40279 </para>
40280 </listitem>
40281 <listitem>
40282 <para>
40283 <emphasis>Decline</emphasis>: the router declines; pass the address to the next router, unless
40284 <option>no_more</option> is set.
40285 </para>
40286 </listitem>
40287 <listitem>
40288 <para>
40289 <emphasis>Fail</emphasis>: routing failed; do not pass the address to any more routers. Any
40290 subsequent text on the line is an error message. If the router is run as part
40291 of address verification during an incoming SMTP message, the message is
40292 included in the SMTP response.
40293 </para>
40294 </listitem>
40295 <listitem>
40296 <para>
40297 <emphasis>Defer</emphasis>: routing could not be completed at this time; try again later. Any
40298 subsequent text on the line is an error message which is logged. It is not
40299 included in any SMTP response.
40300 </para>
40301 </listitem>
40302 <listitem>
40303 <para>
40304 <emphasis>Freeze</emphasis>: the same as <emphasis>defer</emphasis>, except that the message is frozen.
40305 </para>
40306 </listitem>
40307 <listitem>
40308 <para>
40309 <emphasis>Pass</emphasis>: pass the address to the next router (or the router specified by
40310 <option>pass_router</option>), overriding <option>no_more</option>.
40311 </para>
40312 </listitem>
40313 <listitem>
40314 <para>
40315 <emphasis>Redirect</emphasis>: the message is redirected. The remainder of the line is a list of
40316 new addresses, which are routed independently, starting with the first router,
40317 or the router specified by <option>redirect_router</option>, if set.
40318 </para>
40319 </listitem>
40320 </itemizedlist>
40321 <para>
40322 When the first word is <emphasis>accept</emphasis>, the remainder of the line consists of a
40323 number of keyed data values, as follows (split into two lines here, to fit on
40324 the page):
40325 </para>
40326 <literallayout class="monospaced">
40327 ACCEPT TRANSPORT=&lt;transport&gt; HOSTS=&lt;list of hosts&gt;
40328 LOOKUP=byname|bydns DATA=&lt;text&gt;
40329 </literallayout>
40330 <para>
40331 The data items can be given in any order, and all are optional. If no transport
40332 is included, the transport specified by the generic <option>transport</option> option is
40333 used. The list of hosts and the lookup type are needed only if the transport is
40334 an <command>smtp</command> transport that does not itself supply a list of hosts.
40335 </para>
40336 <para>
40337 The format of the list of hosts is the same as for the <command>manualroute</command> router.
40338 As well as host names and IP addresses with optional port numbers, as described
40339 in section <xref linkend="SECTformatonehostitem"/>, it may contain names followed by
40340 <literal>/MX</literal> to specify sublists of hosts that are obtained by looking up MX records
40341 (see section <xref linkend="SECThostshowused"/>).
40342 </para>
40343 <para>
40344 If the lookup type is not specified, Exim behaves as follows when trying to
40345 find an IP address for each host: First, a DNS lookup is done. If this yields
40346 anything other than HOST_NOT_FOUND, that result is used. Otherwise, Exim
40347 goes on to try a call to <function>getipnodebyname()</function> or <function>gethostbyname()</function>, and the
40348 result of the lookup is the result of that call.
40349 </para>
40350 <para>
40351 <indexterm role="variable">
40352 <primary><varname>$address_data</varname></primary>
40353 </indexterm>
40354 If the DATA field is set, its value is placed in the <varname>$address_data</varname>
40355 variable. For example, this return line
40356 </para>
40357 <literallayout class="monospaced">
40358 accept hosts=x1.y.example:x2.y.example data="rule1"
40359 </literallayout>
40360 <para>
40361 routes the address to the default transport, passing a list of two hosts. When
40362 the transport runs, the string <quote>rule1</quote> is in <varname>$address_data</varname>.
40363 <indexterm role="concept" startref="IIDquerou1" class="endofrange"/>
40364 <indexterm role="concept" startref="IIDquerou2" class="endofrange"/>
40365 </para>
40366 </chapter>
40367
40368 <chapter id="CHAPredirect">
40369 <title>The redirect router</title>
40370 <para>
40371 <indexterm role="concept" id="IIDredrou1" class="startofrange">
40372 <primary><command>redirect</command> router</primary>
40373 </indexterm>
40374 <indexterm role="concept" id="IIDredrou2" class="startofrange">
40375 <primary>routers</primary>
40376 <secondary><command>redirect</command></secondary>
40377 </indexterm>
40378 <indexterm role="concept">
40379 <primary>alias file</primary>
40380 <secondary>in a <command>redirect</command> router</secondary>
40381 </indexterm>
40382 <indexterm role="concept">
40383 <primary>address redirection</primary>
40384 <secondary><command>redirect</command> router</secondary>
40385 </indexterm>
40386 The <command>redirect</command> router handles several kinds of address redirection. Its most
40387 common uses are for resolving local part aliases from a central alias file
40388 (usually called <filename>/etc/aliases</filename>) and for handling users&#x2019; personal <filename>.forward</filename>
40389 files, but it has many other potential uses. The incoming address can be
40390 redirected in several different ways:
40391 </para>
40392 <itemizedlist>
40393 <listitem>
40394 <para>
40395 It can be replaced by one or more new addresses which are themselves routed
40396 independently.
40397 </para>
40398 </listitem>
40399 <listitem>
40400 <para>
40401 It can be routed to be delivered to a given file or directory.
40402 </para>
40403 </listitem>
40404 <listitem>
40405 <para>
40406 It can be routed to be delivered to a specified pipe command.
40407 </para>
40408 </listitem>
40409 <listitem>
40410 <para>
40411 It can cause an automatic reply to be generated.
40412 </para>
40413 </listitem>
40414 <listitem>
40415 <para>
40416 It can be forced to fail, optionally with a custom error message.
40417 </para>
40418 </listitem>
40419 <listitem>
40420 <para>
40421 It can be temporarily deferred, optionally with a custom message.
40422 </para>
40423 </listitem>
40424 <listitem>
40425 <para>
40426 It can be discarded.
40427 </para>
40428 </listitem>
40429 </itemizedlist>
40430 <para>
40431 The generic <option>transport</option> option must not be set for <command>redirect</command> routers.
40432 However, there are some private options which define transports for delivery to
40433 files and pipes, and for generating autoreplies. See the <option>file_transport</option>,
40434 <option>pipe_transport</option> and <option>reply_transport</option> descriptions below.
40435 </para>
40436 <para>
40437 If success DSNs have been requested
40438 <indexterm role="concept">
40439 <primary>DSN</primary>
40440 <secondary>success</secondary>
40441 </indexterm>
40442 <indexterm role="concept">
40443 <primary>Delivery Status Notification</primary>
40444 <secondary>success</secondary>
40445 </indexterm>
40446 redirection triggers one and the DSN options are not passed any further.
40447 </para>
40448 <section id="SECID124">
40449 <title>Redirection data</title>
40450 <para>
40451 The router operates by interpreting a text string which it obtains either by
40452 expanding the contents of the <option>data</option> option, or by reading the entire
40453 contents of a file whose name is given in the <option>file</option> option. These two
40454 options are mutually exclusive. The first is commonly used for handling system
40455 aliases, in a configuration like this:
40456 </para>
40457 <literallayout class="monospaced">
40458 system_aliases:
40459   driver = redirect
40460   data = ${lookup{$local_part}lsearch{/etc/aliases}}
40461 </literallayout>
40462 <para>
40463 If the lookup fails, the expanded string in this example is empty. When the
40464 expansion of <option>data</option> results in an empty string, the router declines. A forced
40465 expansion failure also causes the router to decline; other expansion failures
40466 cause delivery to be deferred.
40467 </para>
40468 <para>
40469 A configuration using <option>file</option> is commonly used for handling users&#x2019;
40470 <filename>.forward</filename> files, like this:
40471 </para>
40472 <literallayout class="monospaced">
40473 userforward:
40474   driver = redirect
40475   check_local_user
40476   file = $home/.forward
40477   no_verify
40478 </literallayout>
40479 <para>
40480 If the file does not exist, or causes no action to be taken (for example, it is
40481 empty or consists only of comments), the router declines. <emphasis role="bold">Warning</emphasis>: This
40482 is not the case when the file contains syntactically valid items that happen to
40483 yield empty addresses, for example, items containing only RFC 2822 address
40484 comments.
40485 </para>
40486 <para>
40487 <indexterm role="concept">
40488 <primary>tainted data</primary>
40489 <secondary>in filenames</secondary>
40490 </indexterm>
40491 <indexterm role="concept">
40492 <primary>redirect</primary>
40493 <secondary>tainted data</secondary>
40494 </indexterm>
40495 Tainted data may not be used for a filename.
40496 </para>
40497 <para>
40498 <emphasis role="bold">Warning</emphasis>: It is unwise to use <varname>$local_part</varname> or <varname>$domain</varname>
40499 directly for redirection,
40500 as they are provided by a potential attacker.
40501 In the examples above, <varname>$local_part</varname> is used for looking up data held locally
40502 on the system, and not used directly (the second example derives <varname>$home</varname> via
40503 the passsword file or database, using <varname>$local_part</varname>).
40504 </para>
40505 </section>
40506 <section id="SECID125">
40507 <title>Forward files and address verification</title>
40508 <para>
40509 <indexterm role="concept">
40510 <primary>address redirection</primary>
40511 <secondary>while verifying</secondary>
40512 </indexterm>
40513 It is usual to set <option>no_verify</option> on <command>redirect</command> routers which handle users&#x2019;
40514 <filename>.forward</filename> files, as in the example above. There are two reasons for this:
40515 </para>
40516 <itemizedlist>
40517 <listitem>
40518 <para>
40519 When Exim is receiving an incoming SMTP message from a remote host, it is
40520 running under the Exim uid, not as root. Exim is unable to change uid to read
40521 the file as the user, and it may not be able to read it as the Exim user. So in
40522 practice the router may not be able to operate.
40523 </para>
40524 </listitem>
40525 <listitem>
40526 <para>
40527 However, even when the router can operate, the existence of a <filename>.forward</filename> file
40528 is unimportant when verifying an address. What should be checked is whether the
40529 local part is a valid user name or not. Cutting out the redirection processing
40530 saves some resources.
40531 </para>
40532 </listitem>
40533 </itemizedlist>
40534 </section>
40535 <section id="SECID126">
40536 <title>Interpreting redirection data</title>
40537 <para>
40538 <indexterm role="concept">
40539 <primary>Sieve filter</primary>
40540 <secondary>specifying in redirection data</secondary>
40541 </indexterm>
40542 <indexterm role="concept">
40543 <primary>filter</primary>
40544 <secondary>specifying in redirection data</secondary>
40545 </indexterm>
40546 The contents of the data string, whether obtained from <option>data</option> or <option>file</option>,
40547 can be interpreted in two different ways:
40548 </para>
40549 <itemizedlist>
40550 <listitem>
40551 <para>
40552 If the <option>allow_filter</option> option is set true, and the data begins with the text
40553 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote>, it is interpreted as a list of
40554 <emphasis>filtering</emphasis> instructions in the form of an Exim or Sieve filter file,
40555 respectively. Details of the syntax and semantics of filter files are described
40556 in a separate document entitled <emphasis>Exim&#x2019;s interfaces to mail filtering</emphasis>; this
40557 document is intended for use by end users.
40558 </para>
40559 </listitem>
40560 <listitem>
40561 <para>
40562 Otherwise, the data must be a comma-separated list of redirection items, as
40563 described in the next section.
40564 </para>
40565 </listitem>
40566 </itemizedlist>
40567 <para>
40568 When a message is redirected to a file (a <quote>mail folder</quote>), the filename given
40569 in a non-filter redirection list must always be an absolute path. A filter may
40570 generate a relative path &ndash; how this is handled depends on the transport&#x2019;s
40571 configuration. See section <xref linkend="SECTfildiropt"/> for a discussion of this issue
40572 for the <command>appendfile</command> transport.
40573 </para>
40574 </section>
40575 <section id="SECTitenonfilred">
40576 <title>Items in a non-filter redirection list</title>
40577 <para>
40578 <indexterm role="concept">
40579 <primary>address redirection</primary>
40580 <secondary>non-filter list items</secondary>
40581 </indexterm>
40582 When the redirection data is not an Exim or Sieve filter, for example, if it
40583 comes from a conventional alias or forward file, it consists of a list of
40584 addresses, filenames, pipe commands, or certain special items (see section
40585 <xref linkend="SECTspecitredli"/> below). The special items can be individually enabled or
40586 disabled by means of options whose names begin with <option>allow_</option> or <option>forbid_</option>,
40587 depending on their default values. The items in the list are separated by
40588 commas or newlines.
40589 If a comma is required in an item, the entire item must be enclosed in double
40590 quotes.
40591 </para>
40592 <para>
40593 Lines starting with a # character are comments, and are ignored, and # may
40594 also appear following a comma, in which case everything between the # and the
40595 next newline character is ignored.
40596 </para>
40597 <para>
40598 If an item is entirely enclosed in double quotes, these are removed. Otherwise
40599 double quotes are retained because some forms of mail address require their use
40600 (but never to enclose the entire address). In the following description,
40601 <quote>item</quote> refers to what remains after any surrounding double quotes have been
40602 removed.
40603 </para>
40604 <para>
40605 <indexterm role="variable">
40606 <primary><varname>$local_part</varname></primary>
40607 </indexterm>
40608 <emphasis role="bold">Warning</emphasis>: If you use an Exim expansion to construct a redirection address,
40609 and the expansion contains a reference to <varname>$local_part</varname>, you should make use
40610 of the <option>quote_local_part</option> expansion operator, in case the local part contains
40611 special characters. For example, to redirect all mail for the domain
40612 <emphasis>obsolete.example</emphasis>, retaining the existing local part, you could use this
40613 setting:
40614 </para>
40615 <literallayout class="monospaced">
40616 data = ${quote_local_part:$local_part}@newdomain.example
40617 </literallayout>
40618 </section>
40619 <section id="SECTredlocmai">
40620 <title>Redirecting to a local mailbox</title>
40621 <para>
40622 <indexterm role="concept">
40623 <primary>routing</primary>
40624 <secondary>loops in</secondary>
40625 </indexterm>
40626 <indexterm role="concept">
40627 <primary>loop</primary>
40628 <secondary>while routing, avoidance of</secondary>
40629 </indexterm>
40630 <indexterm role="concept">
40631 <primary>address redirection</primary>
40632 <secondary>to local mailbox</secondary>
40633 </indexterm>
40634 A redirection item may safely be the same as the address currently under
40635 consideration. This does not cause a routing loop, because a router is
40636 automatically skipped if any ancestor of the address that is being processed
40637 is the same as the current address and was processed by the current router.
40638 Such an address is therefore passed to the following routers, so it is handled
40639 as if there were no redirection. When making this loop-avoidance test, the
40640 complete local part, including any prefix or suffix, is used.
40641 </para>
40642 <para>
40643 <indexterm role="concept">
40644 <primary>address redirection</primary>
40645 <secondary>local part without domain</secondary>
40646 </indexterm>
40647 Specifying the same local part without a domain is a common usage in personal
40648 filter files when the user wants to have messages delivered to the local
40649 mailbox and also forwarded elsewhere. For example, the user whose login is
40650 <emphasis>cleo</emphasis> might have a <filename>.forward</filename> file containing this:
40651 </para>
40652 <literallayout class="monospaced">
40653 cleo, cleopatra@egypt.example
40654 </literallayout>
40655 <para>
40656 <indexterm role="concept">
40657 <primary>backslash in alias file</primary>
40658 </indexterm>
40659 <indexterm role="concept">
40660 <primary>alias file</primary>
40661 <secondary>backslash in</secondary>
40662 </indexterm>
40663 For compatibility with other MTAs, such unqualified local parts may be
40664 preceded by <quote>\</quote>, but this is not a requirement for loop prevention. However,
40665 it does make a difference if more than one domain is being handled
40666 synonymously.
40667 </para>
40668 <para>
40669 If an item begins with <quote>\</quote> and the rest of the item parses as a valid RFC
40670 2822 address that does not include a domain, the item is qualified using the
40671 domain of the incoming address. In the absence of a leading <quote>\</quote>, unqualified
40672 addresses are qualified using the value in <option>qualify_recipient</option>, but you can
40673 force the incoming domain to be used by setting <option>qualify_preserve_domain</option>.
40674 </para>
40675 <para>
40676 Care must be taken if there are alias names for local users.
40677 Consider an MTA handling a single local domain where the system alias file
40678 contains:
40679 </para>
40680 <literallayout class="monospaced">
40681 Sam.Reman: spqr
40682 </literallayout>
40683 <para>
40684 Now suppose that Sam (whose login id is <emphasis>spqr</emphasis>) wants to save copies of
40685 messages in the local mailbox, and also forward copies elsewhere. He creates
40686 this forward file:
40687 </para>
40688 <literallayout class="monospaced">
40689 Sam.Reman, spqr@reme.elsewhere.example
40690 </literallayout>
40691 <para>
40692 With these settings, an incoming message addressed to <emphasis>Sam.Reman</emphasis> fails. The
40693 <command>redirect</command> router for system aliases does not process <emphasis>Sam.Reman</emphasis> the
40694 second time round, because it has previously routed it,
40695 and the following routers presumably cannot handle the alias. The forward file
40696 should really contain
40697 </para>
40698 <literallayout class="monospaced">
40699 spqr, spqr@reme.elsewhere.example
40700 </literallayout>
40701 <para>
40702 but because this is such a common error, the <option>check_ancestor</option> option (see
40703 below) exists to provide a way to get round it. This is normally set on a
40704 <command>redirect</command> router that is handling users&#x2019; <filename>.forward</filename> files.
40705 </para>
40706 </section>
40707 <section id="SECTspecitredli">
40708 <title>Special items in redirection lists</title>
40709 <para>
40710 In addition to addresses, the following types of item may appear in redirection
40711 lists (that is, in non-filter redirection data):
40712 </para>
40713 <itemizedlist>
40714 <listitem>
40715 <para>
40716 <indexterm role="concept">
40717 <primary>pipe</primary>
40718 <secondary>in redirection list</secondary>
40719 </indexterm>
40720 <indexterm role="concept">
40721 <primary>address redirection</primary>
40722 <secondary>to pipe</secondary>
40723 </indexterm>
40724 An item is treated as a pipe command if it begins with <quote>|</quote> and does not parse
40725 as a valid RFC 2822 address that includes a domain. A transport for running the
40726 command must be specified by the <option>pipe_transport</option> option.
40727 Normally, either the router or the transport specifies a user and a group under
40728 which to run the delivery. The default is to use the Exim user and group.
40729 </para>
40730 <para>
40731 Single or double quotes can be used for enclosing the individual arguments of
40732 the pipe command; no interpretation of escapes is done for single quotes. If
40733 the command contains a comma character, it is necessary to put the whole item
40734 in double quotes, for example:
40735 </para>
40736 <literallayout class="monospaced">
40737 "|/some/command ready,steady,go"
40738 </literallayout>
40739 <para>
40740 since items in redirection lists are terminated by commas. Do not, however,
40741 quote just the command. An item such as
40742 </para>
40743 <literallayout class="monospaced">
40744 |"/some/command ready,steady,go"
40745 </literallayout>
40746 <para>
40747 is interpreted as a pipe with a rather strange command name, and no arguments.
40748 </para>
40749 <para>
40750 Note that the above example assumes that the text comes from a lookup source
40751 of some sort, so that the quotes are part of the data.  If composing a
40752 redirect router with a <option>data</option> option directly specifying this command, the
40753 quotes will be used by the configuration parser to define the extent of one
40754 string, but will not be passed down into the redirect router itself.  There
40755 are two main approaches to get around this: escape quotes to be part of the
40756 data itself, or avoid using this mechanism and instead create a custom
40757 transport with the <option>command</option> option set and reference that transport from
40758 an <option>accept</option> router.
40759 </para>
40760 </listitem>
40761 <listitem>
40762 <para>
40763 <indexterm role="concept">
40764 <primary>file</primary>
40765 <secondary>in redirection list</secondary>
40766 </indexterm>
40767 <indexterm role="concept">
40768 <primary>address redirection</primary>
40769 <secondary>to file</secondary>
40770 </indexterm>
40771 An item is interpreted as a path name if it begins with <quote>/</quote> and does not
40772 parse as a valid RFC 2822 address that includes a domain. For example,
40773 </para>
40774 <literallayout class="monospaced">
40775 /home/world/minbari
40776 </literallayout>
40777 <para>
40778 is treated as a filename, but
40779 </para>
40780 <literallayout class="monospaced">
40781 /s=molari/o=babylon/@x400gate.way
40782 </literallayout>
40783 <para>
40784 is treated as an address. For a filename, a transport must be specified using
40785 the <option>file_transport</option> option. However, if the generated path name ends with a
40786 forward slash character, it is interpreted as a directory name rather than a
40787 filename, and <option>directory_transport</option> is used instead.
40788 </para>
40789 <para>
40790 Normally, either the router or the transport specifies a user and a group under
40791 which to run the delivery. The default is to use the Exim user and group.
40792 </para>
40793 <para>
40794 <indexterm role="concept">
40795 <primary><filename>/dev/null</filename></primary>
40796 </indexterm>
40797 However, if a redirection item is the path <filename>/dev/null</filename>, delivery to it is
40798 bypassed at a high level, and the log entry shows <quote>**bypassed**</quote>
40799 instead of a transport name. In this case the user and group are not used.
40800 </para>
40801 </listitem>
40802 <listitem>
40803 <para>
40804 <indexterm role="concept">
40805 <primary>included address list</primary>
40806 </indexterm>
40807 <indexterm role="concept">
40808 <primary>address redirection</primary>
40809 <secondary>included external list</secondary>
40810 </indexterm>
40811 If an item is of the form
40812 </para>
40813 <literallayout class="monospaced">
40814 :include:&lt;path name&gt;
40815 </literallayout>
40816 <para>
40817 a list of further items is taken from the given file and included at that
40818 point. <emphasis role="bold">Note</emphasis>: Such a file can not be a filter file; it is just an
40819 out-of-line addition to the list. The items in the included list are separated
40820 by commas or newlines and are not subject to expansion. If this is the first
40821 item in an alias list in an <command>lsearch</command> file, a colon must be used to terminate
40822 the alias name. This example is incorrect:
40823 </para>
40824 <literallayout class="monospaced">
40825 list1    :include:/opt/lists/list1
40826 </literallayout>
40827 <para>
40828 It must be given as
40829 </para>
40830 <literallayout class="monospaced">
40831 list1:   :include:/opt/lists/list1
40832 </literallayout>
40833 <para>
40834 <indexterm role="concept">
40835 <primary>tainted data</primary>
40836 <secondary>in filenames</secondary>
40837 </indexterm>
40838 <indexterm role="concept">
40839 <primary>redirect</primary>
40840 <secondary>tainted data</secondary>
40841 </indexterm>
40842 Tainted data may not be used for a filename.
40843 </para>
40844 </listitem>
40845 <listitem>
40846 <para>
40847 <indexterm role="concept">
40848 <primary>address redirection</primary>
40849 <secondary>to black hole</secondary>
40850 </indexterm>
40851 <indexterm role="concept">
40852 <primary>delivery</primary>
40853 <secondary>discard</secondary>
40854 </indexterm>
40855 <indexterm role="concept">
40856 <primary>delivery</primary>
40857 <secondary>blackhole</secondary>
40858 </indexterm>
40859 <indexterm role="concept">
40860 <primary>black hole</primary>
40861 </indexterm>
40862 <indexterm role="concept">
40863 <primary>abandoning mail</primary>
40864 </indexterm>
40865 Sometimes you want to throw away mail to a particular local part.  Making the
40866 <option>data</option> option expand to an empty string does not work, because that causes
40867 the router to decline. Instead, the alias item
40868 </para>
40869 <literallayout class="monospaced">
40870 :blackhole:
40871 </literallayout>
40872 <para>
40873 can be used. It does what its name implies. No delivery is
40874 done, and no error message is generated. This has the same effect as specifying
40875 <filename>/dev/null</filename> as a destination, but it can be independently disabled.
40876 </para>
40877 <para>
40878 <emphasis role="bold">Warning</emphasis>: If <emphasis>:blackhole:</emphasis> appears anywhere in a redirection list, no
40879 delivery is done for the original local part, even if other redirection items
40880 are present. If you are generating a multi-item list (for example, by reading a
40881 database) and need the ability to provide a no-op item, you must use
40882 <filename>/dev/null</filename>.
40883 </para>
40884 </listitem>
40885 <listitem>
40886 <para>
40887 <indexterm role="concept">
40888 <primary>delivery</primary>
40889 <secondary>forcing failure</secondary>
40890 </indexterm>
40891 <indexterm role="concept">
40892 <primary>delivery</primary>
40893 <secondary>forcing deferral</secondary>
40894 </indexterm>
40895 <indexterm role="concept">
40896 <primary>failing delivery</primary>
40897 <secondary>forcing</secondary>
40898 </indexterm>
40899 <indexterm role="concept">
40900 <primary>deferred delivery, forcing</primary>
40901 </indexterm>
40902 <indexterm role="concept">
40903 <primary>customizing</primary>
40904 <secondary>failure message</secondary>
40905 </indexterm>
40906 An attempt to deliver a particular address can be deferred or forced to fail by
40907 redirection items of the form
40908 </para>
40909 <literallayout class="monospaced">
40910 :defer:
40911 :fail:
40912 </literallayout>
40913 <para>
40914 respectively. When a redirection list contains such an item, it applies
40915 to the entire redirection; any other items in the list are ignored. Any
40916 text following <emphasis>:fail:</emphasis> or <emphasis>:defer:</emphasis> is placed in the error text
40917 associated with the failure. For example, an alias file might contain:
40918 </para>
40919 <literallayout class="monospaced">
40920 X.Employee:  :fail: Gone away, no forwarding address
40921 </literallayout>
40922 <para>
40923 In the case of an address that is being verified from an ACL or as the subject
40924 of a
40925 <indexterm role="concept">
40926 <primary>VRFY</primary>
40927 <secondary>error text, display of</secondary>
40928 </indexterm>
40929 VRFY command, the text is included in the SMTP error response by
40930 default.
40931 <indexterm role="concept">
40932 <primary>EXPN</primary>
40933 <secondary>error text, display of</secondary>
40934 </indexterm>
40935 The text is not included in the response to an EXPN command. In non-SMTP cases
40936 the text is included in the error message that Exim generates.
40937 </para>
40938 <para>
40939 <indexterm role="concept">
40940 <primary>SMTP</primary>
40941 <secondary>error codes</secondary>
40942 </indexterm>
40943 By default for verify, Exim sends a 451 SMTP code for a <emphasis>:defer:</emphasis>, and 550 for
40944 <emphasis>:fail:</emphasis>. However, if the message starts with three digits followed by a
40945 space, optionally followed by an extended code of the form <emphasis>n.n.n</emphasis>, also
40946 followed by a space, and the very first digit is the same as the default error
40947 code, the code from the message is used instead. If the very first digit is
40948 incorrect, a panic error is logged, and the default code is used. You can
40949 suppress the use of the supplied code in a redirect router by setting the
40950 <option>forbid_smtp_code</option> option true. In this case, any SMTP code is quietly
40951 ignored.
40952 </para>
40953 <para>
40954 <indexterm role="variable">
40955 <primary><varname>$acl_verify_message</varname></primary>
40956 </indexterm>
40957 In an ACL, an explicitly provided message overrides the default, but the
40958 default message is available in the variable <varname>$acl_verify_message</varname> and can
40959 therefore be included in a custom message if this is desired.
40960 </para>
40961 <para>
40962 Normally the error text is the rest of the redirection list &ndash; a comma does
40963 not terminate it &ndash; but a newline does act as a terminator. Newlines are not
40964 normally present in alias expansions. In <command>lsearch</command> lookups they are removed
40965 as part of the continuation process, but they may exist in other kinds of
40966 lookup and in <emphasis>:include:</emphasis> files.
40967 </para>
40968 <para>
40969 During routing for message delivery (as opposed to verification), a redirection
40970 containing <emphasis>:fail:</emphasis> causes an immediate failure of the incoming address,
40971 whereas <emphasis>:defer:</emphasis> causes the message to remain in the queue so that a
40972 subsequent delivery attempt can happen at a later time. If an address is
40973 deferred for too long, it will ultimately fail, because the normal retry
40974 rules still apply.
40975 </para>
40976 </listitem>
40977 <listitem>
40978 <para>
40979 <indexterm role="concept">
40980 <primary>alias file</primary>
40981 <secondary>exception to default</secondary>
40982 </indexterm>
40983 Sometimes it is useful to use a single-key search type with a default (see
40984 chapter <xref linkend="CHAPfdlookup"/>) to look up aliases. However, there may be a need
40985 for exceptions to the default. These can be handled by aliasing them to
40986 <emphasis>:unknown:</emphasis>. This differs from <emphasis>:fail:</emphasis> in that it causes the <command>redirect</command>
40987 router to decline, whereas <emphasis>:fail:</emphasis> forces routing to fail. A lookup which
40988 results in an empty redirection list has the same effect.
40989 </para>
40990 </listitem>
40991 </itemizedlist>
40992 </section>
40993 <section id="SECTdupaddr">
40994 <title>Duplicate addresses</title>
40995 <para>
40996 <indexterm role="concept">
40997 <primary>duplicate addresses</primary>
40998 </indexterm>
40999 <indexterm role="concept">
41000 <primary>address duplicate, discarding</primary>
41001 </indexterm>
41002 <indexterm role="concept">
41003 <primary>pipe</primary>
41004 <secondary>duplicated</secondary>
41005 </indexterm>
41006 Exim removes duplicate addresses from the list to which it is delivering, so as
41007 to deliver just one copy to each address. This does not apply to deliveries
41008 routed to pipes by different immediate parent addresses, but an indirect
41009 aliasing scheme of the type
41010 </para>
41011 <literallayout class="monospaced">
41012 pipe:       |/some/command $local_part
41013 localpart1: pipe
41014 localpart2: pipe
41015 </literallayout>
41016 <para>
41017 does not work with a message that is addressed to both local parts, because
41018 when the second is aliased to the intermediate local part <quote>pipe</quote> it gets
41019 discarded as being the same as a previously handled address. However, a scheme
41020 such as
41021 </para>
41022 <literallayout class="monospaced">
41023 localpart1: |/some/command $local_part
41024 localpart2: |/some/command $local_part
41025 </literallayout>
41026 <para>
41027 does result in two different pipe deliveries, because the immediate parents of
41028 the pipes are distinct.
41029 </para>
41030 </section>
41031 <section id="SECID128">
41032 <title>Repeated redirection expansion</title>
41033 <para>
41034 <indexterm role="concept">
41035 <primary>repeated redirection expansion</primary>
41036 </indexterm>
41037 <indexterm role="concept">
41038 <primary>address redirection</primary>
41039 <secondary>repeated for each delivery attempt</secondary>
41040 </indexterm>
41041 When a message cannot be delivered to all of its recipients immediately,
41042 leading to two or more delivery attempts, redirection expansion is carried out
41043 afresh each time for those addresses whose children were not all previously
41044 delivered. If redirection is being used as a mailing list, this can lead to new
41045 members of the list receiving copies of old messages. The <option>one_time</option> option
41046 can be used to avoid this.
41047 </para>
41048 </section>
41049 <section id="SECID129">
41050 <title>Errors in redirection lists</title>
41051 <para>
41052 <indexterm role="concept">
41053 <primary>address redirection</primary>
41054 <secondary>errors</secondary>
41055 </indexterm>
41056 If <option>skip_syntax_errors</option> is set, a malformed address that causes a parsing
41057 error is skipped, and an entry is written to the main log. This may be useful
41058 for mailing lists that are automatically managed. Otherwise, if an error is
41059 detected while generating the list of new addresses, the original address is
41060 deferred. See also <option>syntax_errors_to</option>.
41061 </para>
41062 </section>
41063 <section id="SECID130">
41064 <title>Private options for the redirect router</title>
41065 <para>
41066 <indexterm role="concept">
41067 <primary>options</primary>
41068 <secondary><command>redirect</command> router</secondary>
41069 </indexterm>
41070 The private options for the <command>redirect</command> router are as follows:
41071 </para>
41072 <para>
41073 <indexterm role="option">
41074 <primary><option>allow_defer</option></primary>
41075 </indexterm>
41076 </para>
41077 <informaltable frame="all">
41078 <tgroup cols="4" colsep="0" rowsep="0">
41079 <colspec colwidth="8*" align="left"/>
41080 <colspec colwidth="6*" align="center"/>
41081 <colspec colwidth="6*" align="center"/>
41082 <colspec colwidth="6*" align="right"/>
41083 <tbody>
41084 <row>
41085 <entry><option>allow_defer</option></entry>
41086 <entry>Use: <emphasis>redirect</emphasis></entry>
41087 <entry>Type: <emphasis>boolean</emphasis></entry>
41088 <entry>Default: <emphasis>false</emphasis></entry>
41089 </row>
41090 </tbody>
41091 </tgroup>
41092 </informaltable>
41093 <para>
41094 Setting this option allows the use of <emphasis>:defer:</emphasis> in non-filter redirection
41095 data, or the <option>defer</option> command in an Exim filter file.
41096 </para>
41097 <para>
41098 <indexterm role="option">
41099 <primary><option>allow_fail</option></primary>
41100 </indexterm>
41101 </para>
41102 <informaltable frame="all">
41103 <tgroup cols="4" colsep="0" rowsep="0">
41104 <colspec colwidth="8*" align="left"/>
41105 <colspec colwidth="6*" align="center"/>
41106 <colspec colwidth="6*" align="center"/>
41107 <colspec colwidth="6*" align="right"/>
41108 <tbody>
41109 <row>
41110 <entry><option>allow_fail</option></entry>
41111 <entry>Use: <emphasis>redirect</emphasis></entry>
41112 <entry>Type: <emphasis>boolean</emphasis></entry>
41113 <entry>Default: <emphasis>false</emphasis></entry>
41114 </row>
41115 </tbody>
41116 </tgroup>
41117 </informaltable>
41118 <para>
41119 <indexterm role="concept">
41120 <primary>failing delivery</primary>
41121 <secondary>from filter</secondary>
41122 </indexterm>
41123 If this option is true, the <emphasis>:fail:</emphasis> item can be used in a redirection list,
41124 and the <option>fail</option> command may be used in an Exim filter file.
41125 </para>
41126 <para>
41127 <indexterm role="option">
41128 <primary><option>allow_filter</option></primary>
41129 </indexterm>
41130 </para>
41131 <informaltable frame="all">
41132 <tgroup cols="4" colsep="0" rowsep="0">
41133 <colspec colwidth="8*" align="left"/>
41134 <colspec colwidth="6*" align="center"/>
41135 <colspec colwidth="6*" align="center"/>
41136 <colspec colwidth="6*" align="right"/>
41137 <tbody>
41138 <row>
41139 <entry><option>allow_filter</option></entry>
41140 <entry>Use: <emphasis>redirect</emphasis></entry>
41141 <entry>Type: <emphasis>boolean</emphasis></entry>
41142 <entry>Default: <emphasis>false</emphasis></entry>
41143 </row>
41144 </tbody>
41145 </tgroup>
41146 </informaltable>
41147 <para>
41148 <indexterm role="concept">
41149 <primary>filter</primary>
41150 <secondary>enabling use of</secondary>
41151 </indexterm>
41152 <indexterm role="concept">
41153 <primary>Sieve filter</primary>
41154 <secondary>enabling use of</secondary>
41155 </indexterm>
41156 Setting this option allows Exim to interpret redirection data that starts with
41157 <quote>#Exim filter</quote> or <quote>#Sieve filter</quote> as a set of filtering instructions. There
41158 are some features of Exim filter files that some administrators may wish to
41159 lock out; see the <option>forbid_filter_</option><emphasis>xxx</emphasis> options below.
41160 </para>
41161 <para>
41162 It is also possible to lock out Exim filters or Sieve filters while allowing
41163 the other type; see <option>forbid_exim_filter</option> and <option>forbid_sieve_filter</option>.
41164 </para>
41165 <para>
41166 The filter is run using the uid and gid set by the generic <option>user</option> and
41167 <option>group</option> options. These take their defaults from the password data if
41168 <option>check_local_user</option> is set, so in the normal case of users&#x2019; personal filter
41169 files, the filter is run as the relevant user. When <option>allow_filter</option> is set
41170 true, Exim insists that either <option>check_local_user</option> or <option>user</option> is set.
41171 </para>
41172 <para>
41173 <indexterm role="option">
41174 <primary><option>allow_freeze</option></primary>
41175 </indexterm>
41176 </para>
41177 <informaltable frame="all">
41178 <tgroup cols="4" colsep="0" rowsep="0">
41179 <colspec colwidth="8*" align="left"/>
41180 <colspec colwidth="6*" align="center"/>
41181 <colspec colwidth="6*" align="center"/>
41182 <colspec colwidth="6*" align="right"/>
41183 <tbody>
41184 <row>
41185 <entry><option>allow_freeze</option></entry>
41186 <entry>Use: <emphasis>redirect</emphasis></entry>
41187 <entry>Type: <emphasis>boolean</emphasis></entry>
41188 <entry>Default: <emphasis>false</emphasis></entry>
41189 </row>
41190 </tbody>
41191 </tgroup>
41192 </informaltable>
41193 <para>
41194 <indexterm role="concept">
41195 <primary>freezing messages</primary>
41196 <secondary>allowing in filter</secondary>
41197 </indexterm>
41198 Setting this option allows the use of the <option>freeze</option> command in an Exim filter.
41199 This command is more normally encountered in system filters, and is disabled by
41200 default for redirection filters because it isn&#x2019;t something you usually want to
41201 let ordinary users do.
41202 </para>
41203 <para>
41204 <indexterm role="option">
41205 <primary><option>check_ancestor</option></primary>
41206 </indexterm>
41207 </para>
41208 <informaltable frame="all">
41209 <tgroup cols="4" colsep="0" rowsep="0">
41210 <colspec colwidth="8*" align="left"/>
41211 <colspec colwidth="6*" align="center"/>
41212 <colspec colwidth="6*" align="center"/>
41213 <colspec colwidth="6*" align="right"/>
41214 <tbody>
41215 <row>
41216 <entry><option>check_ancestor</option></entry>
41217 <entry>Use: <emphasis>redirect</emphasis></entry>
41218 <entry>Type: <emphasis>boolean</emphasis></entry>
41219 <entry>Default: <emphasis>false</emphasis></entry>
41220 </row>
41221 </tbody>
41222 </tgroup>
41223 </informaltable>
41224 <para>
41225 This option is concerned with handling generated addresses that are the same
41226 as some address in the list of redirection ancestors of the current address.
41227 Although it is turned off by default in the code, it is set in the default
41228 configuration file for handling users&#x2019; <filename>.forward</filename> files. It is recommended
41229 for this use of the <command>redirect</command> router.
41230 </para>
41231 <para>
41232 When <option>check_ancestor</option> is set, if a generated address (including the domain)
41233 is the same as any ancestor of the current address, it is replaced by a copy of
41234 the current address. This helps in the case where local part A is aliased to B,
41235 and B has a <filename>.forward</filename> file pointing back to A. For example, within a single
41236 domain, the local part <quote>Joe.Bloggs</quote> is aliased to <quote>jb</quote> and
41237 <filename>&nbsp;jb/.forward</filename> contains:
41238 </para>
41239 <literallayout class="monospaced">
41240 \Joe.Bloggs, &lt;other item(s)&gt;
41241 </literallayout>
41242 <para>
41243 Without the <option>check_ancestor</option> setting, either local part (<quote>jb</quote> or
41244 <quote>joe.bloggs</quote>) gets processed once by each router and so ends up as it was
41245 originally. If <quote>jb</quote> is the real mailbox name, mail to <quote>jb</quote> gets delivered
41246 (having been turned into <quote>joe.bloggs</quote> by the <filename>.forward</filename> file and back to
41247 <quote>jb</quote> by the alias), but mail to <quote>joe.bloggs</quote> fails. Setting
41248 <option>check_ancestor</option> on the <command>redirect</command> router that handles the <filename>.forward</filename>
41249 file prevents it from turning <quote>jb</quote> back into <quote>joe.bloggs</quote> when that was the
41250 original address. See also the <option>repeat_use</option> option below.
41251 </para>
41252 <para>
41253 <indexterm role="option">
41254 <primary><option>check_group</option></primary>
41255 </indexterm>
41256 </para>
41257 <informaltable frame="all">
41258 <tgroup cols="4" colsep="0" rowsep="0">
41259 <colspec colwidth="8*" align="left"/>
41260 <colspec colwidth="6*" align="center"/>
41261 <colspec colwidth="6*" align="center"/>
41262 <colspec colwidth="6*" align="right"/>
41263 <tbody>
41264 <row>
41265 <entry><option>check_group</option></entry>
41266 <entry>Use: <emphasis>redirect</emphasis></entry>
41267 <entry>Type: <emphasis>boolean</emphasis></entry>
41268 <entry>Default: <emphasis>see below</emphasis></entry>
41269 </row>
41270 </tbody>
41271 </tgroup>
41272 </informaltable>
41273 <para>
41274 When the <option>file</option> option is used, the group owner of the file is checked only
41275 when this option is set. The permitted groups are those listed in the
41276 <option>owngroups</option> option, together with the user&#x2019;s default group if
41277 <option>check_local_user</option> is set. If the file has the wrong group, routing is
41278 deferred. The default setting for this option is true if <option>check_local_user</option>
41279 is set and the <option>modemask</option> option permits the group write bit, or if the
41280 <option>owngroups</option> option is set. Otherwise it is false, and no group check occurs.
41281 </para>
41282 <para>
41283 <indexterm role="option">
41284 <primary><option>check_owner</option></primary>
41285 </indexterm>
41286 </para>
41287 <informaltable frame="all">
41288 <tgroup cols="4" colsep="0" rowsep="0">
41289 <colspec colwidth="8*" align="left"/>
41290 <colspec colwidth="6*" align="center"/>
41291 <colspec colwidth="6*" align="center"/>
41292 <colspec colwidth="6*" align="right"/>
41293 <tbody>
41294 <row>
41295 <entry><option>check_owner</option></entry>
41296 <entry>Use: <emphasis>redirect</emphasis></entry>
41297 <entry>Type: <emphasis>boolean</emphasis></entry>
41298 <entry>Default: <emphasis>see below</emphasis></entry>
41299 </row>
41300 </tbody>
41301 </tgroup>
41302 </informaltable>
41303 <para>
41304 When the <option>file</option> option is used, the owner of the file is checked only when
41305 this option is set. If <option>check_local_user</option> is set, the local user is
41306 permitted; otherwise the owner must be one of those listed in the <option>owners</option>
41307 option. The default value for this option is true if <option>check_local_user</option> or
41308 <option>owners</option> is set. Otherwise the default is false, and no owner check occurs.
41309 </para>
41310 <para>
41311 <indexterm role="option">
41312 <primary><option>data</option></primary>
41313 </indexterm>
41314 </para>
41315 <informaltable frame="all">
41316 <tgroup cols="4" colsep="0" rowsep="0">
41317 <colspec colwidth="8*" align="left"/>
41318 <colspec colwidth="6*" align="center"/>
41319 <colspec colwidth="6*" align="center"/>
41320 <colspec colwidth="6*" align="right"/>
41321 <tbody>
41322 <row>
41323 <entry><option>data</option></entry>
41324 <entry>Use: <emphasis>redirect</emphasis></entry>
41325 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41326 <entry>Default: <emphasis>unset</emphasis></entry>
41327 </row>
41328 </tbody>
41329 </tgroup>
41330 </informaltable>
41331 <para>
41332 This option is mutually exclusive with <option>file</option>. One or other of them must be
41333 set, but not both. The contents of <option>data</option> are expanded, and then used as the
41334 list of forwarding items, or as a set of filtering instructions. If the
41335 expansion is forced to fail, or the result is an empty string or a string that
41336 has no effect (consists entirely of comments), the router declines.
41337 </para>
41338 <para>
41339 When filtering instructions are used, the string must begin with <quote>#Exim
41340 filter</quote>, and all comments in the string, including this initial one, must be
41341 terminated with newline characters. For example:
41342 </para>
41343 <literallayout class="monospaced">
41344 data = #Exim filter\n\
41345        if $h_to: contains Exim then save $home/mail/exim endif
41346 </literallayout>
41347 <para>
41348 If you are reading the data from a database where newlines cannot be included,
41349 you can use the <varname>${sg}</varname> expansion item to turn the escape string of your
41350 choice into a newline.
41351 </para>
41352 <para>
41353 <indexterm role="option">
41354 <primary><option>directory_transport</option></primary>
41355 </indexterm>
41356 </para>
41357 <informaltable frame="all">
41358 <tgroup cols="4" colsep="0" rowsep="0">
41359 <colspec colwidth="8*" align="left"/>
41360 <colspec colwidth="6*" align="center"/>
41361 <colspec colwidth="6*" align="center"/>
41362 <colspec colwidth="6*" align="right"/>
41363 <tbody>
41364 <row>
41365 <entry><option>directory_transport</option></entry>
41366 <entry>Use: <emphasis>redirect</emphasis></entry>
41367 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41368 <entry>Default: <emphasis>unset</emphasis></entry>
41369 </row>
41370 </tbody>
41371 </tgroup>
41372 </informaltable>
41373 <para>
41374 A <command>redirect</command> router sets up a direct delivery to a directory when a path name
41375 ending with a slash is specified as a new <quote>address</quote>. The transport used is
41376 specified by this option, which, after expansion, must be the name of a
41377 configured transport. This should normally be an <command>appendfile</command> transport.
41378 </para>
41379 <para>
41380 <indexterm role="option">
41381 <primary><option>file</option></primary>
41382 </indexterm>
41383 </para>
41384 <informaltable frame="all">
41385 <tgroup cols="4" colsep="0" rowsep="0">
41386 <colspec colwidth="8*" align="left"/>
41387 <colspec colwidth="6*" align="center"/>
41388 <colspec colwidth="6*" align="center"/>
41389 <colspec colwidth="6*" align="right"/>
41390 <tbody>
41391 <row>
41392 <entry><option>file</option></entry>
41393 <entry>Use: <emphasis>redirect</emphasis></entry>
41394 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41395 <entry>Default: <emphasis>unset</emphasis></entry>
41396 </row>
41397 </tbody>
41398 </tgroup>
41399 </informaltable>
41400 <para>
41401 This option specifies the name of a file that contains the redirection data. It
41402 is mutually exclusive with the <option>data</option> option. The string is expanded before
41403 use; if the expansion is forced to fail, the router declines. Other expansion
41404 failures cause delivery to be deferred. The result of a successful expansion
41405 must be an absolute path. The entire file is read and used as the redirection
41406 data. If the data is an empty string or a string that has no effect (consists
41407 entirely of comments), the router declines.
41408 </para>
41409 <para>
41410 <indexterm role="concept">
41411 <primary>NFS</primary>
41412 <secondary>checking for file existence</secondary>
41413 </indexterm>
41414 If the attempt to open the file fails with a <quote>does not exist</quote> error, Exim
41415 runs a check on the containing directory,
41416 unless <option>ignore_enotdir</option> is true (see below).
41417 If the directory does not appear to exist, delivery is deferred. This can
41418 happen when users&#x2019; <filename>.forward</filename> files are in NFS-mounted directories, and there
41419 is a mount problem. If the containing directory does exist, but the file does
41420 not, the router declines.
41421 </para>
41422 <para>
41423 <indexterm role="option">
41424 <primary><option>file_transport</option></primary>
41425 </indexterm>
41426 </para>
41427 <informaltable frame="all">
41428 <tgroup cols="4" colsep="0" rowsep="0">
41429 <colspec colwidth="8*" align="left"/>
41430 <colspec colwidth="6*" align="center"/>
41431 <colspec colwidth="6*" align="center"/>
41432 <colspec colwidth="6*" align="right"/>
41433 <tbody>
41434 <row>
41435 <entry><option>file_transport</option></entry>
41436 <entry>Use: <emphasis>redirect</emphasis></entry>
41437 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
41438 <entry>Default: <emphasis>unset</emphasis></entry>
41439 </row>
41440 </tbody>
41441 </tgroup>
41442 </informaltable>
41443 <para>
41444 <indexterm role="variable">
41445 <primary><varname>$address_file</varname></primary>
41446 </indexterm>
41447 A <command>redirect</command> router sets up a direct delivery to a file when a path name not
41448 ending in a slash is specified as a new <quote>address</quote>. The transport used is
41449 specified by this option, which, after expansion, must be the name of a
41450 configured transport. This should normally be an <command>appendfile</command> transport. When
41451 it is running, the filename is in <varname>$address_file</varname>.
41452 </para>
41453 <para>
41454 <indexterm role="option">
41455 <primary><option>filter_prepend_home</option></primary>
41456 </indexterm>
41457 </para>
41458 <informaltable frame="all">
41459 <tgroup cols="4" colsep="0" rowsep="0">
41460 <colspec colwidth="8*" align="left"/>
41461 <colspec colwidth="6*" align="center"/>
41462 <colspec colwidth="6*" align="center"/>
41463 <colspec colwidth="6*" align="right"/>
41464 <tbody>
41465 <row>
41466 <entry><option>filter_prepend_home</option></entry>
41467 <entry>Use: <emphasis>redirect</emphasis></entry>
41468 <entry>Type: <emphasis>boolean</emphasis></entry>
41469 <entry>Default: <emphasis>true</emphasis></entry>
41470 </row>
41471 </tbody>
41472 </tgroup>
41473 </informaltable>
41474 <para>
41475 When this option is true, if a <command>save</command> command in an Exim filter specifies a
41476 relative path, and <varname>$home</varname> is defined, it is automatically prepended to the
41477 relative path. If this option is set false, this action does not happen. The
41478 relative path is then passed to the transport unmodified.
41479 </para>
41480 <para>
41481 <indexterm role="option">
41482 <primary><option>forbid_blackhole</option></primary>
41483 </indexterm>
41484 </para>
41485 <informaltable frame="all">
41486 <tgroup cols="4" colsep="0" rowsep="0">
41487 <colspec colwidth="8*" align="left"/>
41488 <colspec colwidth="6*" align="center"/>
41489 <colspec colwidth="6*" align="center"/>
41490 <colspec colwidth="6*" align="right"/>
41491 <tbody>
41492 <row>
41493 <entry><option>forbid_blackhole</option></entry>
41494 <entry>Use: <emphasis>redirect</emphasis></entry>
41495 <entry>Type: <emphasis>boolean</emphasis></entry>
41496 <entry>Default: <emphasis>false</emphasis></entry>
41497 </row>
41498 </tbody>
41499 </tgroup>
41500 </informaltable>
41501 <para>
41502 <indexterm role="concept">
41503 <primary>restricting access to features</primary>
41504 </indexterm>
41505 <indexterm role="concept">
41506 <primary>filter</primary>
41507 <secondary>locking out certain features</secondary>
41508 </indexterm>
41509 If this option is true, the <emphasis>:blackhole:</emphasis> item may not appear in a
41510 redirection list.
41511 </para>
41512 <para>
41513 <indexterm role="option">
41514 <primary><option>forbid_exim_filter</option></primary>
41515 </indexterm>
41516 </para>
41517 <informaltable frame="all">
41518 <tgroup cols="4" colsep="0" rowsep="0">
41519 <colspec colwidth="8*" align="left"/>
41520 <colspec colwidth="6*" align="center"/>
41521 <colspec colwidth="6*" align="center"/>
41522 <colspec colwidth="6*" align="right"/>
41523 <tbody>
41524 <row>
41525 <entry><option>forbid_exim_filter</option></entry>
41526 <entry>Use: <emphasis>redirect</emphasis></entry>
41527 <entry>Type: <emphasis>boolean</emphasis></entry>
41528 <entry>Default: <emphasis>false</emphasis></entry>
41529 </row>
41530 </tbody>
41531 </tgroup>
41532 </informaltable>
41533 <para>
41534 <indexterm role="concept">
41535 <primary>restricting access to features</primary>
41536 </indexterm>
41537 <indexterm role="concept">
41538 <primary>filter</primary>
41539 <secondary>locking out certain features</secondary>
41540 </indexterm>
41541 If this option is set true, only Sieve filters are permitted when
41542 <option>allow_filter</option> is true.
41543 </para>
41544 <para>
41545 <indexterm role="option">
41546 <primary><option>forbid_file</option></primary>
41547 </indexterm>
41548 </para>
41549 <informaltable frame="all">
41550 <tgroup cols="4" colsep="0" rowsep="0">
41551 <colspec colwidth="8*" align="left"/>
41552 <colspec colwidth="6*" align="center"/>
41553 <colspec colwidth="6*" align="center"/>
41554 <colspec colwidth="6*" align="right"/>
41555 <tbody>
41556 <row>
41557 <entry><option>forbid_file</option></entry>
41558 <entry>Use: <emphasis>redirect</emphasis></entry>
41559 <entry>Type: <emphasis>boolean</emphasis></entry>
41560 <entry>Default: <emphasis>false</emphasis></entry>
41561 </row>
41562 </tbody>
41563 </tgroup>
41564 </informaltable>
41565 <para>
41566 <indexterm role="concept">
41567 <primary>restricting access to features</primary>
41568 </indexterm>
41569 <indexterm role="concept">
41570 <primary>delivery</primary>
41571 <secondary>to file; forbidding</secondary>
41572 </indexterm>
41573 <indexterm role="concept">
41574 <primary>filter</primary>
41575 <secondary>locking out certain features</secondary>
41576 </indexterm>
41577 <indexterm role="concept">
41578 <primary>Sieve filter</primary>
41579 <secondary>forbidding delivery to a file</secondary>
41580 </indexterm>
41581 <indexterm role="concept">
41582 <primary>Sieve filter</primary>
41583 <secondary><quote>keep</quote> facility; disabling</secondary>
41584 </indexterm>
41585 If this option is true, this router may not generate a new address that
41586 specifies delivery to a local file or directory, either from a filter or from a
41587 conventional forward file. This option is forced to be true if <option>one_time</option> is
41588 set. It applies to Sieve filters as well as to Exim filters, but if true, it
41589 locks out the Sieve&#x2019;s <quote>keep</quote> facility.
41590 </para>
41591 <para>
41592 <indexterm role="option">
41593 <primary><option>forbid_filter_dlfunc</option></primary>
41594 </indexterm>
41595 </para>
41596 <informaltable frame="all">
41597 <tgroup cols="4" colsep="0" rowsep="0">
41598 <colspec colwidth="8*" align="left"/>
41599 <colspec colwidth="6*" align="center"/>
41600 <colspec colwidth="6*" align="center"/>
41601 <colspec colwidth="6*" align="right"/>
41602 <tbody>
41603 <row>
41604 <entry><option>forbid_filter_dlfunc</option></entry>
41605 <entry>Use: <emphasis>redirect</emphasis></entry>
41606 <entry>Type: <emphasis>boolean</emphasis></entry>
41607 <entry>Default: <emphasis>false</emphasis></entry>
41608 </row>
41609 </tbody>
41610 </tgroup>
41611 </informaltable>
41612 <para>
41613 <indexterm role="concept">
41614 <primary>restricting access to features</primary>
41615 </indexterm>
41616 <indexterm role="concept">
41617 <primary>filter</primary>
41618 <secondary>locking out certain features</secondary>
41619 </indexterm>
41620 If this option is true, string expansions in Exim filters are not allowed to
41621 make use of the <option>dlfunc</option> expansion facility to run dynamically loaded
41622 functions.
41623 </para>
41624 <para>
41625 <indexterm role="option">
41626 <primary><option>forbid_filter_existstest</option></primary>
41627 </indexterm>
41628 </para>
41629 <informaltable frame="all">
41630 <tgroup cols="4" colsep="0" rowsep="0">
41631 <colspec colwidth="8*" align="left"/>
41632 <colspec colwidth="6*" align="center"/>
41633 <colspec colwidth="6*" align="center"/>
41634 <colspec colwidth="6*" align="right"/>
41635 <tbody>
41636 <row>
41637 <entry><option>forbid_filter_existstest</option></entry>
41638 <entry>Use: <emphasis>redirect</emphasis></entry>
41639 <entry>Type: <emphasis>boolean</emphasis></entry>
41640 <entry>Default: <emphasis>false</emphasis></entry>
41641 </row>
41642 </tbody>
41643 </tgroup>
41644 </informaltable>
41645 <para>
41646 <indexterm role="concept">
41647 <primary>restricting access to features</primary>
41648 </indexterm>
41649 <indexterm role="concept">
41650 <primary>filter</primary>
41651 <secondary>locking out certain features</secondary>
41652 </indexterm>
41653 <indexterm role="concept">
41654 <primary>expansion</primary>
41655 <secondary>statting a file</secondary>
41656 </indexterm>
41657 If this option is true, string expansions in Exim filters are not allowed to
41658 make use of the <option>exists</option> condition or the <option>stat</option> expansion item.
41659 </para>
41660 <para>
41661 <indexterm role="option">
41662 <primary><option>forbid_filter_logwrite</option></primary>
41663 </indexterm>
41664 </para>
41665 <informaltable frame="all">
41666 <tgroup cols="4" colsep="0" rowsep="0">
41667 <colspec colwidth="8*" align="left"/>
41668 <colspec colwidth="6*" align="center"/>
41669 <colspec colwidth="6*" align="center"/>
41670 <colspec colwidth="6*" align="right"/>
41671 <tbody>
41672 <row>
41673 <entry><option>forbid_filter_logwrite</option></entry>
41674 <entry>Use: <emphasis>redirect</emphasis></entry>
41675 <entry>Type: <emphasis>boolean</emphasis></entry>
41676 <entry>Default: <emphasis>false</emphasis></entry>
41677 </row>
41678 </tbody>
41679 </tgroup>
41680 </informaltable>
41681 <para>
41682 <indexterm role="concept">
41683 <primary>restricting access to features</primary>
41684 </indexterm>
41685 <indexterm role="concept">
41686 <primary>filter</primary>
41687 <secondary>locking out certain features</secondary>
41688 </indexterm>
41689 If this option is true, use of the logging facility in Exim filters is not
41690 permitted. Logging is in any case available only if the filter is being run
41691 under some unprivileged uid (which is normally the case for ordinary users&#x2019;
41692 <filename>.forward</filename> files).
41693 </para>
41694 <para>
41695 <indexterm role="option">
41696 <primary><option>forbid_filter_lookup</option></primary>
41697 </indexterm>
41698 </para>
41699 <informaltable frame="all">
41700 <tgroup cols="4" colsep="0" rowsep="0">
41701 <colspec colwidth="8*" align="left"/>
41702 <colspec colwidth="6*" align="center"/>
41703 <colspec colwidth="6*" align="center"/>
41704 <colspec colwidth="6*" align="right"/>
41705 <tbody>
41706 <row>
41707 <entry><option>forbid_filter_lookup</option></entry>
41708 <entry>Use: <emphasis>redirect</emphasis></entry>
41709 <entry>Type: <emphasis>boolean</emphasis></entry>
41710 <entry>Default: <emphasis>false</emphasis></entry>
41711 </row>
41712 </tbody>
41713 </tgroup>
41714 </informaltable>
41715 <para>
41716 <indexterm role="concept">
41717 <primary>restricting access to features</primary>
41718 </indexterm>
41719 <indexterm role="concept">
41720 <primary>filter</primary>
41721 <secondary>locking out certain features</secondary>
41722 </indexterm>
41723 If this option is true, string expansions in Exim filter files are not allowed
41724 to make use of <option>lookup</option> items.
41725 </para>
41726 <para>
41727 <indexterm role="option">
41728 <primary><option>forbid_filter_perl</option></primary>
41729 </indexterm>
41730 </para>
41731 <informaltable frame="all">
41732 <tgroup cols="4" colsep="0" rowsep="0">
41733 <colspec colwidth="8*" align="left"/>
41734 <colspec colwidth="6*" align="center"/>
41735 <colspec colwidth="6*" align="center"/>
41736 <colspec colwidth="6*" align="right"/>
41737 <tbody>
41738 <row>
41739 <entry><option>forbid_filter_perl</option></entry>
41740 <entry>Use: <emphasis>redirect</emphasis></entry>
41741 <entry>Type: <emphasis>boolean</emphasis></entry>
41742 <entry>Default: <emphasis>false</emphasis></entry>
41743 </row>
41744 </tbody>
41745 </tgroup>
41746 </informaltable>
41747 <para>
41748 <indexterm role="concept">
41749 <primary>restricting access to features</primary>
41750 </indexterm>
41751 <indexterm role="concept">
41752 <primary>filter</primary>
41753 <secondary>locking out certain features</secondary>
41754 </indexterm>
41755 This option has an effect only if Exim is built with embedded Perl support. If
41756 it is true, string expansions in Exim filter files are not allowed to make use
41757 of the embedded Perl support.
41758 </para>
41759 <para>
41760 <indexterm role="option">
41761 <primary><option>forbid_filter_readfile</option></primary>
41762 </indexterm>
41763 </para>
41764 <informaltable frame="all">
41765 <tgroup cols="4" colsep="0" rowsep="0">
41766 <colspec colwidth="8*" align="left"/>
41767 <colspec colwidth="6*" align="center"/>
41768 <colspec colwidth="6*" align="center"/>
41769 <colspec colwidth="6*" align="right"/>
41770 <tbody>
41771 <row>
41772 <entry><option>forbid_filter_readfile</option></entry>
41773 <entry>Use: <emphasis>redirect</emphasis></entry>
41774 <entry>Type: <emphasis>boolean</emphasis></entry>
41775 <entry>Default: <emphasis>false</emphasis></entry>
41776 </row>
41777 </tbody>
41778 </tgroup>
41779 </informaltable>
41780 <para>
41781 <indexterm role="concept">
41782 <primary>restricting access to features</primary>
41783 </indexterm>
41784 <indexterm role="concept">
41785 <primary>filter</primary>
41786 <secondary>locking out certain features</secondary>
41787 </indexterm>
41788 If this option is true, string expansions in Exim filter files are not allowed
41789 to make use of <option>readfile</option> items.
41790 </para>
41791 <para>
41792 <indexterm role="option">
41793 <primary><option>forbid_filter_readsocket</option></primary>
41794 </indexterm>
41795 </para>
41796 <informaltable frame="all">
41797 <tgroup cols="4" colsep="0" rowsep="0">
41798 <colspec colwidth="8*" align="left"/>
41799 <colspec colwidth="6*" align="center"/>
41800 <colspec colwidth="6*" align="center"/>
41801 <colspec colwidth="6*" align="right"/>
41802 <tbody>
41803 <row>
41804 <entry><option>forbid_filter_readsocket</option></entry>
41805 <entry>Use: <emphasis>redirect</emphasis></entry>
41806 <entry>Type: <emphasis>boolean</emphasis></entry>
41807 <entry>Default: <emphasis>false</emphasis></entry>
41808 </row>
41809 </tbody>
41810 </tgroup>
41811 </informaltable>
41812 <para>
41813 <indexterm role="concept">
41814 <primary>restricting access to features</primary>
41815 </indexterm>
41816 <indexterm role="concept">
41817 <primary>filter</primary>
41818 <secondary>locking out certain features</secondary>
41819 </indexterm>
41820 If this option is true, string expansions in Exim filter files are not allowed
41821 to make use of <option>readsocket</option> items.
41822 </para>
41823 <para>
41824 <indexterm role="option">
41825 <primary><option>forbid_filter_reply</option></primary>
41826 </indexterm>
41827 </para>
41828 <informaltable frame="all">
41829 <tgroup cols="4" colsep="0" rowsep="0">
41830 <colspec colwidth="8*" align="left"/>
41831 <colspec colwidth="6*" align="center"/>
41832 <colspec colwidth="6*" align="center"/>
41833 <colspec colwidth="6*" align="right"/>
41834 <tbody>
41835 <row>
41836 <entry><option>forbid_filter_reply</option></entry>
41837 <entry>Use: <emphasis>redirect</emphasis></entry>
41838 <entry>Type: <emphasis>boolean</emphasis></entry>
41839 <entry>Default: <emphasis>false</emphasis></entry>
41840 </row>
41841 </tbody>
41842 </tgroup>
41843 </informaltable>
41844 <para>
41845 <indexterm role="concept">
41846 <primary>restricting access to features</primary>
41847 </indexterm>
41848 <indexterm role="concept">
41849 <primary>filter</primary>
41850 <secondary>locking out certain features</secondary>
41851 </indexterm>
41852 If this option is true, this router may not generate an automatic reply
41853 message. Automatic replies can be generated only from Exim or Sieve filter
41854 files, not from traditional forward files. This option is forced to be true if
41855 <option>one_time</option> is set.
41856 </para>
41857 <para>
41858 <indexterm role="option">
41859 <primary><option>forbid_filter_run</option></primary>
41860 </indexterm>
41861 </para>
41862 <informaltable frame="all">
41863 <tgroup cols="4" colsep="0" rowsep="0">
41864 <colspec colwidth="8*" align="left"/>
41865 <colspec colwidth="6*" align="center"/>
41866 <colspec colwidth="6*" align="center"/>
41867 <colspec colwidth="6*" align="right"/>
41868 <tbody>
41869 <row>
41870 <entry><option>forbid_filter_run</option></entry>
41871 <entry>Use: <emphasis>redirect</emphasis></entry>
41872 <entry>Type: <emphasis>boolean</emphasis></entry>
41873 <entry>Default: <emphasis>false</emphasis></entry>
41874 </row>
41875 </tbody>
41876 </tgroup>
41877 </informaltable>
41878 <para>
41879 <indexterm role="concept">
41880 <primary>restricting access to features</primary>
41881 </indexterm>
41882 <indexterm role="concept">
41883 <primary>filter</primary>
41884 <secondary>locking out certain features</secondary>
41885 </indexterm>
41886 If this option is true, string expansions in Exim filter files are not allowed
41887 to make use of <option>run</option> items.
41888 </para>
41889 <para>
41890 <indexterm role="option">
41891 <primary><option>forbid_include</option></primary>
41892 </indexterm>
41893 </para>
41894 <informaltable frame="all">
41895 <tgroup cols="4" colsep="0" rowsep="0">
41896 <colspec colwidth="8*" align="left"/>
41897 <colspec colwidth="6*" align="center"/>
41898 <colspec colwidth="6*" align="center"/>
41899 <colspec colwidth="6*" align="right"/>
41900 <tbody>
41901 <row>
41902 <entry><option>forbid_include</option></entry>
41903 <entry>Use: <emphasis>redirect</emphasis></entry>
41904 <entry>Type: <emphasis>boolean</emphasis></entry>
41905 <entry>Default: <emphasis>false</emphasis></entry>
41906 </row>
41907 </tbody>
41908 </tgroup>
41909 </informaltable>
41910 <para>
41911 <indexterm role="concept">
41912 <primary>restricting access to features</primary>
41913 </indexterm>
41914 <indexterm role="concept">
41915 <primary>filter</primary>
41916 <secondary>locking out certain features</secondary>
41917 </indexterm>
41918 If this option is true, items of the form
41919 </para>
41920 <literallayout class="monospaced">
41921 :include:&lt;path name&gt;
41922 </literallayout>
41923 <para>
41924 are not permitted in non-filter redirection lists.
41925 </para>
41926 <para>
41927 <indexterm role="option">
41928 <primary><option>forbid_pipe</option></primary>
41929 </indexterm>
41930 </para>
41931 <informaltable frame="all">
41932 <tgroup cols="4" colsep="0" rowsep="0">
41933 <colspec colwidth="8*" align="left"/>
41934 <colspec colwidth="6*" align="center"/>
41935 <colspec colwidth="6*" align="center"/>
41936 <colspec colwidth="6*" align="right"/>
41937 <tbody>
41938 <row>
41939 <entry><option>forbid_pipe</option></entry>
41940 <entry>Use: <emphasis>redirect</emphasis></entry>
41941 <entry>Type: <emphasis>boolean</emphasis></entry>
41942 <entry>Default: <emphasis>false</emphasis></entry>
41943 </row>
41944 </tbody>
41945 </tgroup>
41946 </informaltable>
41947 <para>
41948 <indexterm role="concept">
41949 <primary>restricting access to features</primary>
41950 </indexterm>
41951 <indexterm role="concept">
41952 <primary>filter</primary>
41953 <secondary>locking out certain features</secondary>
41954 </indexterm>
41955 <indexterm role="concept">
41956 <primary>delivery</primary>
41957 <secondary>to pipe; forbidding</secondary>
41958 </indexterm>
41959 If this option is true, this router may not generate a new address which
41960 specifies delivery to a pipe, either from an Exim filter or from a conventional
41961 forward file. This option is forced to be true if <option>one_time</option> is set.
41962 </para>
41963 <para>
41964 <indexterm role="option">
41965 <primary><option>forbid_sieve_filter</option></primary>
41966 </indexterm>
41967 </para>
41968 <informaltable frame="all">
41969 <tgroup cols="4" colsep="0" rowsep="0">
41970 <colspec colwidth="8*" align="left"/>
41971 <colspec colwidth="6*" align="center"/>
41972 <colspec colwidth="6*" align="center"/>
41973 <colspec colwidth="6*" align="right"/>
41974 <tbody>
41975 <row>
41976 <entry><option>forbid_sieve_filter</option></entry>
41977 <entry>Use: <emphasis>redirect</emphasis></entry>
41978 <entry>Type: <emphasis>boolean</emphasis></entry>
41979 <entry>Default: <emphasis>false</emphasis></entry>
41980 </row>
41981 </tbody>
41982 </tgroup>
41983 </informaltable>
41984 <para>
41985 <indexterm role="concept">
41986 <primary>restricting access to features</primary>
41987 </indexterm>
41988 <indexterm role="concept">
41989 <primary>filter</primary>
41990 <secondary>locking out certain features</secondary>
41991 </indexterm>
41992 If this option is set true, only Exim filters are permitted when
41993 <option>allow_filter</option> is true.
41994 </para>
41995 <para>
41996 <indexterm role="concept">
41997 <primary>SMTP</primary>
41998 <secondary>error codes</secondary>
41999 </indexterm>
42000 <indexterm role="option">
42001 <primary><option>forbid_smtp_code</option></primary>
42002 </indexterm>
42003 </para>
42004 <informaltable frame="all">
42005 <tgroup cols="4" colsep="0" rowsep="0">
42006 <colspec colwidth="8*" align="left"/>
42007 <colspec colwidth="6*" align="center"/>
42008 <colspec colwidth="6*" align="center"/>
42009 <colspec colwidth="6*" align="right"/>
42010 <tbody>
42011 <row>
42012 <entry><option>forbid_smtp_code</option></entry>
42013 <entry>Use: <emphasis>redirect</emphasis></entry>
42014 <entry>Type: <emphasis>boolean</emphasis></entry>
42015 <entry>Default: <emphasis>false</emphasis></entry>
42016 </row>
42017 </tbody>
42018 </tgroup>
42019 </informaltable>
42020 <para>
42021 If this option is set true, any SMTP error codes that are present at the start
42022 of messages specified for <literal>:defer:</literal> or <literal>:fail:</literal> are quietly ignored, and
42023 the default codes (451 and 550, respectively) are always used.
42024 </para>
42025 <para>
42026 <indexterm role="option">
42027 <primary><option>hide_child_in_errmsg</option></primary>
42028 </indexterm>
42029 </para>
42030 <informaltable frame="all">
42031 <tgroup cols="4" colsep="0" rowsep="0">
42032 <colspec colwidth="8*" align="left"/>
42033 <colspec colwidth="6*" align="center"/>
42034 <colspec colwidth="6*" align="center"/>
42035 <colspec colwidth="6*" align="right"/>
42036 <tbody>
42037 <row>
42038 <entry><option>hide_child_in_errmsg</option></entry>
42039 <entry>Use: <emphasis>redirect</emphasis></entry>
42040 <entry>Type: <emphasis>boolean</emphasis></entry>
42041 <entry>Default: <emphasis>false</emphasis></entry>
42042 </row>
42043 </tbody>
42044 </tgroup>
42045 </informaltable>
42046 <para>
42047 <indexterm role="concept">
42048 <primary>bounce message</primary>
42049 <secondary>redirection details; suppressing</secondary>
42050 </indexterm>
42051 If this option is true, it prevents Exim from quoting a child address if it
42052 generates a bounce or delay message for it. Instead it says <quote>an address
42053 generated from &lt;<emphasis>the top level address</emphasis>&gt;</quote>. Of course, this applies only to
42054 bounces generated locally. If a message is forwarded to another host, <emphasis>its</emphasis>
42055 bounce may well quote the generated address.
42056 </para>
42057 <para>
42058 <indexterm role="option">
42059 <primary><option>ignore_eacces</option></primary>
42060 </indexterm>
42061 </para>
42062 <informaltable frame="all">
42063 <tgroup cols="4" colsep="0" rowsep="0">
42064 <colspec colwidth="8*" align="left"/>
42065 <colspec colwidth="6*" align="center"/>
42066 <colspec colwidth="6*" align="center"/>
42067 <colspec colwidth="6*" align="right"/>
42068 <tbody>
42069 <row>
42070 <entry><option>ignore_eacces</option></entry>
42071 <entry>Use: <emphasis>redirect</emphasis></entry>
42072 <entry>Type: <emphasis>boolean</emphasis></entry>
42073 <entry>Default: <emphasis>false</emphasis></entry>
42074 </row>
42075 </tbody>
42076 </tgroup>
42077 </informaltable>
42078 <para>
42079 <indexterm role="concept">
42080 <primary>EACCES</primary>
42081 </indexterm>
42082 If this option is set and an attempt to open a redirection file yields the
42083 EACCES error (permission denied), the <command>redirect</command> router behaves as if the
42084 file did not exist.
42085 </para>
42086 <para>
42087 <indexterm role="option">
42088 <primary><option>ignore_enotdir</option></primary>
42089 </indexterm>
42090 </para>
42091 <informaltable frame="all">
42092 <tgroup cols="4" colsep="0" rowsep="0">
42093 <colspec colwidth="8*" align="left"/>
42094 <colspec colwidth="6*" align="center"/>
42095 <colspec colwidth="6*" align="center"/>
42096 <colspec colwidth="6*" align="right"/>
42097 <tbody>
42098 <row>
42099 <entry><option>ignore_enotdir</option></entry>
42100 <entry>Use: <emphasis>redirect</emphasis></entry>
42101 <entry>Type: <emphasis>boolean</emphasis></entry>
42102 <entry>Default: <emphasis>false</emphasis></entry>
42103 </row>
42104 </tbody>
42105 </tgroup>
42106 </informaltable>
42107 <para>
42108 <indexterm role="concept">
42109 <primary>ENOTDIR</primary>
42110 </indexterm>
42111 If this option is set and an attempt to open a redirection file yields the
42112 ENOTDIR error (something on the path is not a directory), the <command>redirect</command>
42113 router behaves as if the file did not exist.
42114 </para>
42115 <para>
42116 Setting <option>ignore_enotdir</option> has another effect as well: When a <command>redirect</command>
42117 router that has the <option>file</option> option set discovers that the file does not exist
42118 (the ENOENT error), it tries to <function>stat()</function> the parent directory, as a check
42119 against unmounted NFS directories. If the parent can not be statted, delivery
42120 is deferred. However, it seems wrong to do this check when <option>ignore_enotdir</option>
42121 is set, because that option tells Exim to ignore <quote>something on the path is not
42122 a directory</quote> (the ENOTDIR error). This is a confusing area, because it seems
42123 that some operating systems give ENOENT where others give ENOTDIR.
42124 </para>
42125 <para>
42126 <indexterm role="option">
42127 <primary><option>include_directory</option></primary>
42128 </indexterm>
42129 </para>
42130 <informaltable frame="all">
42131 <tgroup cols="4" colsep="0" rowsep="0">
42132 <colspec colwidth="8*" align="left"/>
42133 <colspec colwidth="6*" align="center"/>
42134 <colspec colwidth="6*" align="center"/>
42135 <colspec colwidth="6*" align="right"/>
42136 <tbody>
42137 <row>
42138 <entry><option>include_directory</option></entry>
42139 <entry>Use: <emphasis>redirect</emphasis></entry>
42140 <entry>Type: <emphasis>string</emphasis></entry>
42141 <entry>Default: <emphasis>unset</emphasis></entry>
42142 </row>
42143 </tbody>
42144 </tgroup>
42145 </informaltable>
42146 <para>
42147 If this option is set, the path names of any <emphasis>:include:</emphasis> items in a
42148 redirection list must start with this directory.
42149 </para>
42150 <para>
42151 <indexterm role="option">
42152 <primary><option>modemask</option></primary>
42153 </indexterm>
42154 </para>
42155 <informaltable frame="all">
42156 <tgroup cols="4" colsep="0" rowsep="0">
42157 <colspec colwidth="8*" align="left"/>
42158 <colspec colwidth="6*" align="center"/>
42159 <colspec colwidth="6*" align="center"/>
42160 <colspec colwidth="6*" align="right"/>
42161 <tbody>
42162 <row>
42163 <entry><option>modemask</option></entry>
42164 <entry>Use: <emphasis>redirect</emphasis></entry>
42165 <entry>Type: <emphasis>octal integer</emphasis></entry>
42166 <entry>Default: <emphasis>022</emphasis></entry>
42167 </row>
42168 </tbody>
42169 </tgroup>
42170 </informaltable>
42171 <para>
42172 This specifies mode bits which must not be set for a file specified by the
42173 <option>file</option> option. If any of the forbidden bits are set, delivery is deferred.
42174 </para>
42175 <para>
42176 <indexterm role="option">
42177 <primary><option>one_time</option></primary>
42178 </indexterm>
42179 </para>
42180 <informaltable frame="all">
42181 <tgroup cols="4" colsep="0" rowsep="0">
42182 <colspec colwidth="8*" align="left"/>
42183 <colspec colwidth="6*" align="center"/>
42184 <colspec colwidth="6*" align="center"/>
42185 <colspec colwidth="6*" align="right"/>
42186 <tbody>
42187 <row>
42188 <entry><option>one_time</option></entry>
42189 <entry>Use: <emphasis>redirect</emphasis></entry>
42190 <entry>Type: <emphasis>boolean</emphasis></entry>
42191 <entry>Default: <emphasis>false</emphasis></entry>
42192 </row>
42193 </tbody>
42194 </tgroup>
42195 </informaltable>
42196 <para>
42197 <indexterm role="concept">
42198 <primary>one-time aliasing/forwarding expansion</primary>
42199 </indexterm>
42200 <indexterm role="concept">
42201 <primary>alias file</primary>
42202 <secondary>one-time expansion</secondary>
42203 </indexterm>
42204 <indexterm role="concept">
42205 <primary>forward file</primary>
42206 <secondary>one-time expansion</secondary>
42207 </indexterm>
42208 <indexterm role="concept">
42209 <primary>mailing lists</primary>
42210 <secondary>one-time expansion</secondary>
42211 </indexterm>
42212 <indexterm role="concept">
42213 <primary>address redirection</primary>
42214 <secondary>one-time expansion</secondary>
42215 </indexterm>
42216 Sometimes the fact that Exim re-evaluates aliases and reprocesses redirection
42217 files each time it tries to deliver a message causes a problem when one or more
42218 of the generated addresses fails be delivered at the first attempt. The problem
42219 is not one of duplicate delivery &ndash; Exim is clever enough to handle that &ndash;
42220 but of what happens when the redirection list changes during the time that the
42221 message is on Exim&#x2019;s queue. This is particularly true in the case of mailing
42222 lists, where new subscribers might receive copies of messages that were posted
42223 before they subscribed.
42224 </para>
42225 <para>
42226 If <option>one_time</option> is set and any addresses generated by the router fail to
42227 deliver at the first attempt, the failing addresses are added to the message as
42228 <quote>top level</quote> addresses, and the parent address that generated them is marked
42229 <quote>delivered</quote>. Thus, redirection does not happen again at the next delivery
42230 attempt.
42231 </para>
42232 <para>
42233 <emphasis role="bold">Warning 1</emphasis>: Any header line addition or removal that is specified by this
42234 router would be lost if delivery did not succeed at the first attempt. For this
42235 reason, the <option>headers_add</option> and <option>headers_remove</option> generic options are not
42236 permitted when <option>one_time</option> is set.
42237 </para>
42238 <para>
42239 <emphasis role="bold">Warning 2</emphasis>: To ensure that the router generates only addresses (as opposed
42240 to pipe or file deliveries or auto-replies) <option>forbid_file</option>, <option>forbid_pipe</option>,
42241 and <option>forbid_filter_reply</option> are forced to be true when <option>one_time</option> is set.
42242 </para>
42243 <para>
42244 <emphasis role="bold">Warning 3</emphasis>: The <option>unseen</option> generic router option may not be set with
42245 <option>one_time</option>.
42246 </para>
42247 <para>
42248 The original top-level address is remembered with each of the generated
42249 addresses, and is output in any log messages. However, any intermediate parent
42250 addresses are not recorded. This makes a difference to the log only if
42251 <option>all_parents</option> log selector is set. It is expected that <option>one_time</option> will
42252 typically be used for mailing lists, where there is normally just one level of
42253 expansion.
42254 </para>
42255 <para>
42256 <indexterm role="option">
42257 <primary><option>owners</option></primary>
42258 </indexterm>
42259 </para>
42260 <informaltable frame="all">
42261 <tgroup cols="4" colsep="0" rowsep="0">
42262 <colspec colwidth="8*" align="left"/>
42263 <colspec colwidth="6*" align="center"/>
42264 <colspec colwidth="6*" align="center"/>
42265 <colspec colwidth="6*" align="right"/>
42266 <tbody>
42267 <row>
42268 <entry><option>owners</option></entry>
42269 <entry>Use: <emphasis>redirect</emphasis></entry>
42270 <entry>Type: <emphasis>string list</emphasis></entry>
42271 <entry>Default: <emphasis>unset</emphasis></entry>
42272 </row>
42273 </tbody>
42274 </tgroup>
42275 </informaltable>
42276 <para>
42277 <indexterm role="concept">
42278 <primary>ownership</primary>
42279 <secondary>alias file</secondary>
42280 </indexterm>
42281 <indexterm role="concept">
42282 <primary>ownership</primary>
42283 <secondary>forward file</secondary>
42284 </indexterm>
42285 <indexterm role="concept">
42286 <primary>alias file</primary>
42287 <secondary>ownership</secondary>
42288 </indexterm>
42289 <indexterm role="concept">
42290 <primary>forward file</primary>
42291 <secondary>ownership</secondary>
42292 </indexterm>
42293 This specifies a list of permitted owners for the file specified by <option>file</option>.
42294 This list is in addition to the local user when <option>check_local_user</option> is set.
42295 See <option>check_owner</option> above.
42296 </para>
42297 <para>
42298 <indexterm role="option">
42299 <primary><option>owngroups</option></primary>
42300 </indexterm>
42301 </para>
42302 <informaltable frame="all">
42303 <tgroup cols="4" colsep="0" rowsep="0">
42304 <colspec colwidth="8*" align="left"/>
42305 <colspec colwidth="6*" align="center"/>
42306 <colspec colwidth="6*" align="center"/>
42307 <colspec colwidth="6*" align="right"/>
42308 <tbody>
42309 <row>
42310 <entry><option>owngroups</option></entry>
42311 <entry>Use: <emphasis>redirect</emphasis></entry>
42312 <entry>Type: <emphasis>string list</emphasis></entry>
42313 <entry>Default: <emphasis>unset</emphasis></entry>
42314 </row>
42315 </tbody>
42316 </tgroup>
42317 </informaltable>
42318 <para>
42319 This specifies a list of permitted groups for the file specified by <option>file</option>.
42320 The list is in addition to the local user&#x2019;s primary group when
42321 <option>check_local_user</option> is set. See <option>check_group</option> above.
42322 </para>
42323 <para>
42324 <indexterm role="option">
42325 <primary><option>pipe_transport</option></primary>
42326 </indexterm>
42327 </para>
42328 <informaltable frame="all">
42329 <tgroup cols="4" colsep="0" rowsep="0">
42330 <colspec colwidth="8*" align="left"/>
42331 <colspec colwidth="6*" align="center"/>
42332 <colspec colwidth="6*" align="center"/>
42333 <colspec colwidth="6*" align="right"/>
42334 <tbody>
42335 <row>
42336 <entry><option>pipe_transport</option></entry>
42337 <entry>Use: <emphasis>redirect</emphasis></entry>
42338 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42339 <entry>Default: <emphasis>unset</emphasis></entry>
42340 </row>
42341 </tbody>
42342 </tgroup>
42343 </informaltable>
42344 <para>
42345 <indexterm role="variable">
42346 <primary><varname>$address_pipe</varname></primary>
42347 </indexterm>
42348 A <command>redirect</command> router sets up a direct delivery to a pipe when a string
42349 starting with a vertical bar character is specified as a new <quote>address</quote>. The
42350 transport used is specified by this option, which, after expansion, must be the
42351 name of a configured transport. This should normally be a <command>pipe</command> transport.
42352 When the transport is run, the pipe command is in <varname>$address_pipe</varname>.
42353 </para>
42354 <para>
42355 <indexterm role="option">
42356 <primary><option>qualify_domain</option></primary>
42357 </indexterm>
42358 </para>
42359 <informaltable frame="all">
42360 <tgroup cols="4" colsep="0" rowsep="0">
42361 <colspec colwidth="8*" align="left"/>
42362 <colspec colwidth="6*" align="center"/>
42363 <colspec colwidth="6*" align="center"/>
42364 <colspec colwidth="6*" align="right"/>
42365 <tbody>
42366 <row>
42367 <entry><option>qualify_domain</option></entry>
42368 <entry>Use: <emphasis>redirect</emphasis></entry>
42369 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42370 <entry>Default: <emphasis>unset</emphasis></entry>
42371 </row>
42372 </tbody>
42373 </tgroup>
42374 </informaltable>
42375 <para>
42376 <indexterm role="variable">
42377 <primary><varname>$qualify_recipient</varname></primary>
42378 </indexterm>
42379 If this option is set, and an unqualified address (one without a domain) is
42380 generated, and that address would normally be qualified by the global setting
42381 in <option>qualify_recipient</option>, it is instead qualified with the domain specified by
42382 expanding this string. If the expansion fails, the router declines. If you want
42383 to revert to the default, you can have the expansion generate
42384 <varname>$qualify_recipient</varname>.
42385 </para>
42386 <para>
42387 This option applies to all unqualified addresses generated by Exim filters,
42388 but for traditional <filename>.forward</filename> files, it applies only to addresses that are
42389 not preceded by a backslash. Sieve filters cannot generate unqualified
42390 addresses.
42391 </para>
42392 <para>
42393 <indexterm role="option">
42394 <primary><option>qualify_preserve_domain</option></primary>
42395 </indexterm>
42396 </para>
42397 <informaltable frame="all">
42398 <tgroup cols="4" colsep="0" rowsep="0">
42399 <colspec colwidth="8*" align="left"/>
42400 <colspec colwidth="6*" align="center"/>
42401 <colspec colwidth="6*" align="center"/>
42402 <colspec colwidth="6*" align="right"/>
42403 <tbody>
42404 <row>
42405 <entry><option>qualify_preserve_domain</option></entry>
42406 <entry>Use: <emphasis>redirect</emphasis></entry>
42407 <entry>Type: <emphasis>boolean</emphasis></entry>
42408 <entry>Default: <emphasis>false</emphasis></entry>
42409 </row>
42410 </tbody>
42411 </tgroup>
42412 </informaltable>
42413 <para>
42414 <indexterm role="concept">
42415 <primary>domain</primary>
42416 <secondary>in redirection; preserving</secondary>
42417 </indexterm>
42418 <indexterm role="concept">
42419 <primary>preserving domain in redirection</primary>
42420 </indexterm>
42421 <indexterm role="concept">
42422 <primary>address redirection</primary>
42423 <secondary>domain; preserving</secondary>
42424 </indexterm>
42425 If this option is set, the router&#x2019;s local <option>qualify_domain</option> option must not be
42426 set (a configuration error occurs if it is). If an unqualified address (one
42427 without a domain) is generated, it is qualified with the domain of the parent
42428 address (the immediately preceding ancestor) instead of the global
42429 <option>qualify_recipient</option> value. In the case of a traditional <filename>.forward</filename> file,
42430 this applies whether or not the address is preceded by a backslash.
42431 </para>
42432 <para>
42433 <indexterm role="option">
42434 <primary><option>repeat_use</option></primary>
42435 </indexterm>
42436 </para>
42437 <informaltable frame="all">
42438 <tgroup cols="4" colsep="0" rowsep="0">
42439 <colspec colwidth="8*" align="left"/>
42440 <colspec colwidth="6*" align="center"/>
42441 <colspec colwidth="6*" align="center"/>
42442 <colspec colwidth="6*" align="right"/>
42443 <tbody>
42444 <row>
42445 <entry><option>repeat_use</option></entry>
42446 <entry>Use: <emphasis>redirect</emphasis></entry>
42447 <entry>Type: <emphasis>boolean</emphasis></entry>
42448 <entry>Default: <emphasis>true</emphasis></entry>
42449 </row>
42450 </tbody>
42451 </tgroup>
42452 </informaltable>
42453 <para>
42454 If this option is set false, the router is skipped for a child address that has
42455 any ancestor that was routed by this router. This test happens before any of
42456 the other preconditions are tested. Exim&#x2019;s default anti-looping rules skip
42457 only when the ancestor is the same as the current address. See also
42458 <option>check_ancestor</option> above and the generic <option>redirect_router</option> option.
42459 </para>
42460 <para>
42461 <indexterm role="option">
42462 <primary><option>reply_transport</option></primary>
42463 </indexterm>
42464 </para>
42465 <informaltable frame="all">
42466 <tgroup cols="4" colsep="0" rowsep="0">
42467 <colspec colwidth="8*" align="left"/>
42468 <colspec colwidth="6*" align="center"/>
42469 <colspec colwidth="6*" align="center"/>
42470 <colspec colwidth="6*" align="right"/>
42471 <tbody>
42472 <row>
42473 <entry><option>reply_transport</option></entry>
42474 <entry>Use: <emphasis>redirect</emphasis></entry>
42475 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42476 <entry>Default: <emphasis>unset</emphasis></entry>
42477 </row>
42478 </tbody>
42479 </tgroup>
42480 </informaltable>
42481 <para>
42482 A <command>redirect</command> router sets up an automatic reply when a <option>mail</option> or
42483 <option>vacation</option> command is used in a filter file. The transport used is specified
42484 by this option, which, after expansion, must be the name of a configured
42485 transport. This should normally be an <command>autoreply</command> transport. Other transports
42486 are unlikely to do anything sensible or useful.
42487 </para>
42488 <para>
42489 <indexterm role="option">
42490 <primary><option>rewrite</option></primary>
42491 </indexterm>
42492 </para>
42493 <informaltable frame="all">
42494 <tgroup cols="4" colsep="0" rowsep="0">
42495 <colspec colwidth="8*" align="left"/>
42496 <colspec colwidth="6*" align="center"/>
42497 <colspec colwidth="6*" align="center"/>
42498 <colspec colwidth="6*" align="right"/>
42499 <tbody>
42500 <row>
42501 <entry><option>rewrite</option></entry>
42502 <entry>Use: <emphasis>redirect</emphasis></entry>
42503 <entry>Type: <emphasis>boolean</emphasis></entry>
42504 <entry>Default: <emphasis>true</emphasis></entry>
42505 </row>
42506 </tbody>
42507 </tgroup>
42508 </informaltable>
42509 <para>
42510 <indexterm role="concept">
42511 <primary>address redirection</primary>
42512 <secondary>disabling rewriting</secondary>
42513 </indexterm>
42514 If this option is set false, addresses generated by the router are not
42515 subject to address rewriting. Otherwise, they are treated like new addresses
42516 and are rewritten according to the global rewriting rules.
42517 </para>
42518 <para>
42519 <indexterm role="option">
42520 <primary><option>sieve_subaddress</option></primary>
42521 </indexterm>
42522 </para>
42523 <informaltable frame="all">
42524 <tgroup cols="4" colsep="0" rowsep="0">
42525 <colspec colwidth="8*" align="left"/>
42526 <colspec colwidth="6*" align="center"/>
42527 <colspec colwidth="6*" align="center"/>
42528 <colspec colwidth="6*" align="right"/>
42529 <tbody>
42530 <row>
42531 <entry><option>sieve_subaddress</option></entry>
42532 <entry>Use: <emphasis>redirect</emphasis></entry>
42533 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42534 <entry>Default: <emphasis>unset</emphasis></entry>
42535 </row>
42536 </tbody>
42537 </tgroup>
42538 </informaltable>
42539 <para>
42540 The value of this option is passed to a Sieve filter to specify the
42541 :subaddress part of an address.
42542 </para>
42543 <para>
42544 <indexterm role="option">
42545 <primary><option>sieve_useraddress</option></primary>
42546 </indexterm>
42547 </para>
42548 <informaltable frame="all">
42549 <tgroup cols="4" colsep="0" rowsep="0">
42550 <colspec colwidth="8*" align="left"/>
42551 <colspec colwidth="6*" align="center"/>
42552 <colspec colwidth="6*" align="center"/>
42553 <colspec colwidth="6*" align="right"/>
42554 <tbody>
42555 <row>
42556 <entry><option>sieve_useraddress</option></entry>
42557 <entry>Use: <emphasis>redirect</emphasis></entry>
42558 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42559 <entry>Default: <emphasis>unset</emphasis></entry>
42560 </row>
42561 </tbody>
42562 </tgroup>
42563 </informaltable>
42564 <para>
42565 The value of this option is passed to a Sieve filter to specify the :user part
42566 of an address. However, if it is unset, the entire original local part
42567 (including any prefix or suffix) is used for :user.
42568 </para>
42569 <para>
42570 <indexterm role="option">
42571 <primary><option>sieve_vacation_directory</option></primary>
42572 </indexterm>
42573 </para>
42574 <informaltable frame="all">
42575 <tgroup cols="4" colsep="0" rowsep="0">
42576 <colspec colwidth="8*" align="left"/>
42577 <colspec colwidth="6*" align="center"/>
42578 <colspec colwidth="6*" align="center"/>
42579 <colspec colwidth="6*" align="right"/>
42580 <tbody>
42581 <row>
42582 <entry><option>sieve_vacation_directory</option></entry>
42583 <entry>Use: <emphasis>redirect</emphasis></entry>
42584 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42585 <entry>Default: <emphasis>unset</emphasis></entry>
42586 </row>
42587 </tbody>
42588 </tgroup>
42589 </informaltable>
42590 <para>
42591 <indexterm role="concept">
42592 <primary>Sieve filter</primary>
42593 <secondary>vacation directory</secondary>
42594 </indexterm>
42595 To enable the <quote>vacation</quote> extension for Sieve filters, you must set
42596 <option>sieve_vacation_directory</option> to the directory where vacation databases are held
42597 (do not put anything else in that directory), and ensure that the
42598 <option>reply_transport</option> option refers to an <command>autoreply</command> transport. Each user
42599 needs their own directory; Exim will create it if necessary.
42600 </para>
42601 <para>
42602 <indexterm role="option">
42603 <primary><option>skip_syntax_errors</option></primary>
42604 </indexterm>
42605 </para>
42606 <informaltable frame="all">
42607 <tgroup cols="4" colsep="0" rowsep="0">
42608 <colspec colwidth="8*" align="left"/>
42609 <colspec colwidth="6*" align="center"/>
42610 <colspec colwidth="6*" align="center"/>
42611 <colspec colwidth="6*" align="right"/>
42612 <tbody>
42613 <row>
42614 <entry><option>skip_syntax_errors</option></entry>
42615 <entry>Use: <emphasis>redirect</emphasis></entry>
42616 <entry>Type: <emphasis>boolean</emphasis></entry>
42617 <entry>Default: <emphasis>false</emphasis></entry>
42618 </row>
42619 </tbody>
42620 </tgroup>
42621 </informaltable>
42622 <para>
42623 <indexterm role="concept">
42624 <primary>forward file</primary>
42625 <secondary>broken</secondary>
42626 </indexterm>
42627 <indexterm role="concept">
42628 <primary>address redirection</primary>
42629 <secondary>broken files</secondary>
42630 </indexterm>
42631 <indexterm role="concept">
42632 <primary>alias file</primary>
42633 <secondary>broken</secondary>
42634 </indexterm>
42635 <indexterm role="concept">
42636 <primary>broken alias or forward files</primary>
42637 </indexterm>
42638 <indexterm role="concept">
42639 <primary>ignoring faulty addresses</primary>
42640 </indexterm>
42641 <indexterm role="concept">
42642 <primary>skipping faulty addresses</primary>
42643 </indexterm>
42644 <indexterm role="concept">
42645 <primary>error</primary>
42646 <secondary>skipping bad syntax</secondary>
42647 </indexterm>
42648 If <option>skip_syntax_errors</option> is set, syntactically malformed addresses in
42649 non-filter redirection data are skipped, and each failing address is logged. If
42650 <option>syntax_errors_to</option> is set, a message is sent to the address it defines,
42651 giving details of the failures. If <option>syntax_errors_text</option> is set, its contents
42652 are expanded and placed at the head of the error message generated by
42653 <option>syntax_errors_to</option>. Usually it is appropriate to set <option>syntax_errors_to</option> to
42654 be the same address as the generic <option>errors_to</option> option. The
42655 <option>skip_syntax_errors</option> option is often used when handling mailing lists.
42656 </para>
42657 <para>
42658 If all the addresses in a redirection list are skipped because of syntax
42659 errors, the router declines to handle the original address, and it is passed to
42660 the following routers.
42661 </para>
42662 <para>
42663 If <option>skip_syntax_errors</option> is set when an Exim filter is interpreted, any syntax
42664 error in the filter causes filtering to be abandoned without any action being
42665 taken. The incident is logged, and the router declines to handle the address,
42666 so it is passed to the following routers.
42667 </para>
42668 <para>
42669 <indexterm role="concept">
42670 <primary>Sieve filter</primary>
42671 <secondary>syntax errors in</secondary>
42672 </indexterm>
42673 Syntax errors in a Sieve filter file cause the <quote>keep</quote> action to occur. This
42674 action is specified by RFC 3028. The values of <option>skip_syntax_errors</option>,
42675 <option>syntax_errors_to</option>, and <option>syntax_errors_text</option> are not used.
42676 </para>
42677 <para>
42678 <option>skip_syntax_errors</option> can be used to specify that errors in users&#x2019; forward
42679 lists or filter files should not prevent delivery. The <option>syntax_errors_to</option>
42680 option, used with an address that does not get redirected, can be used to
42681 notify users of these errors, by means of a router like this:
42682 </para>
42683 <literallayout class="monospaced">
42684 userforward:
42685   driver = redirect
42686   allow_filter
42687   check_local_user
42688   file = $home/.forward
42689   file_transport = address_file
42690   pipe_transport = address_pipe
42691   reply_transport = address_reply
42692   no_verify
42693   skip_syntax_errors
42694   syntax_errors_to = real-$local_part@$domain
42695   syntax_errors_text = \
42696    This is an automatically generated message. An error has\n\
42697    been found in your .forward file. Details of the error are\n\
42698    reported below. While this error persists, you will receive\n\
42699    a copy of this message for every message that is addressed\n\
42700    to you. If your .forward file is a filter file, or if it is\n\
42701    a non-filter file containing no valid forwarding addresses,\n\
42702    a copy of each incoming message will be put in your normal\n\
42703    mailbox. If a non-filter file contains at least one valid\n\
42704    forwarding address, forwarding to the valid addresses will\n\
42705    happen, and those will be the only deliveries that occur.
42706 </literallayout>
42707 <para>
42708 You also need a router to ensure that local addresses that are prefixed by
42709 <literal>real-</literal> are recognized, but not forwarded or filtered. For example, you could
42710 put this immediately before the <command>userforward</command> router:
42711 </para>
42712 <literallayout class="monospaced">
42713 real_localuser:
42714   driver = accept
42715   check_local_user
42716   local_part_prefix = real-
42717   transport = local_delivery
42718 </literallayout>
42719 <para>
42720 For security, it would probably be a good idea to restrict the use of this
42721 router to locally-generated messages, using a condition such as this:
42722 </para>
42723 <literallayout class="monospaced">
42724   condition = ${if match {$sender_host_address}\
42725                          {\N^(|127\.0\.0\.1)$\N}}
42726 </literallayout>
42727 <para>
42728 <indexterm role="option">
42729 <primary><option>syntax_errors_text</option></primary>
42730 </indexterm>
42731 </para>
42732 <informaltable frame="all">
42733 <tgroup cols="4" colsep="0" rowsep="0">
42734 <colspec colwidth="8*" align="left"/>
42735 <colspec colwidth="6*" align="center"/>
42736 <colspec colwidth="6*" align="center"/>
42737 <colspec colwidth="6*" align="right"/>
42738 <tbody>
42739 <row>
42740 <entry><option>syntax_errors_text</option></entry>
42741 <entry>Use: <emphasis>redirect</emphasis></entry>
42742 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
42743 <entry>Default: <emphasis>unset</emphasis></entry>
42744 </row>
42745 </tbody>
42746 </tgroup>
42747 </informaltable>
42748 <para>
42749 See <option>skip_syntax_errors</option> above.
42750 </para>
42751 <para>
42752 <indexterm role="option">
42753 <primary><option>syntax_errors_to</option></primary>
42754 </indexterm>
42755 </para>
42756 <informaltable frame="all">
42757 <tgroup cols="4" colsep="0" rowsep="0">
42758 <colspec colwidth="8*" align="left"/>
42759 <colspec colwidth="6*" align="center"/>
42760 <colspec colwidth="6*" align="center"/>
42761 <colspec colwidth="6*" align="right"/>
42762 <tbody>
42763 <row>
42764 <entry><option>syntax_errors_to</option></entry>
42765 <entry>Use: <emphasis>redirect</emphasis></entry>
42766 <entry>Type: <emphasis>string</emphasis></entry>
42767 <entry>Default: <emphasis>unset</emphasis></entry>
42768 </row>
42769 </tbody>
42770 </tgroup>
42771 </informaltable>
42772 <para>
42773 See <option>skip_syntax_errors</option> above.
42774 <indexterm role="concept" startref="IIDredrou1" class="endofrange"/>
42775 <indexterm role="concept" startref="IIDredrou2" class="endofrange"/>
42776 </para>
42777 </section>
42778 </chapter>
42779
42780 <chapter id="CHAPenvironment">
42781 <title>Environment for running local transports</title>
42782 <titleabbrev>Environment for local transports</titleabbrev>
42783 <para>
42784 <indexterm role="concept" id="IIDenvlotra1" class="startofrange">
42785 <primary>local transports</primary>
42786 <secondary>environment for</secondary>
42787 </indexterm>
42788 <indexterm role="concept" id="IIDenvlotra2" class="startofrange">
42789 <primary>environment</primary>
42790 <secondary>local transports</secondary>
42791 </indexterm>
42792 <indexterm role="concept" id="IIDenvlotra3" class="startofrange">
42793 <primary>transport</primary>
42794 <secondary>local; environment for</secondary>
42795 </indexterm>
42796 Local transports handle deliveries to files and pipes. (The <command>autoreply</command>
42797 transport can be thought of as similar to a pipe.) Exim always runs transports
42798 in subprocesses, under specified uids and gids. Typical deliveries to local
42799 mailboxes run under the uid and gid of the local user.
42800 </para>
42801 <para>
42802 Exim also sets a specific current directory while running the transport; for
42803 some transports a home directory setting is also relevant. The <command>pipe</command>
42804 transport is the only one that sets up environment variables; see section
42805 <xref linkend="SECTpipeenv"/> for details.
42806 </para>
42807 <para>
42808 The values used for the uid, gid, and the directories may come from several
42809 different places. In many cases, the router that handles the address associates
42810 settings with that address as a result of its <option>check_local_user</option>, <option>group</option>,
42811 or <option>user</option> options. However, values may also be given in the transport&#x2019;s own
42812 configuration, and these override anything that comes from the router.
42813 </para>
42814 <section id="SECID131">
42815 <title>Concurrent deliveries</title>
42816 <para>
42817 <indexterm role="concept">
42818 <primary>concurrent deliveries</primary>
42819 </indexterm>
42820 <indexterm role="concept">
42821 <primary>simultaneous deliveries</primary>
42822 </indexterm>
42823 If two different messages for the same local recipient arrive more or less
42824 simultaneously, the two delivery processes are likely to run concurrently. When
42825 the <command>appendfile</command> transport is used to write to a file, Exim applies locking
42826 rules to stop concurrent processes from writing to the same file at the same
42827 time.
42828 </para>
42829 <para>
42830 However, when you use a <command>pipe</command> transport, it is up to you to arrange any
42831 locking that is needed. Here is a silly example:
42832 </para>
42833 <literallayout class="monospaced">
42834 my_transport:
42835   driver = pipe
42836   command = /bin/sh -c 'cat &gt;&gt;/some/file'
42837 </literallayout>
42838 <para>
42839 This is supposed to write the message at the end of the file. However, if two
42840 messages arrive at the same time, the file will be scrambled. You can use the
42841 <option>exim_lock</option> utility program (see section <xref linkend="SECTmailboxmaint"/>) to lock a
42842 file using the same algorithm that Exim itself uses.
42843 </para>
42844 </section>
42845 <section id="SECTenvuidgid">
42846 <title>Uids and gids</title>
42847 <para>
42848 <indexterm role="concept">
42849 <primary>local transports</primary>
42850 <secondary>uid and gid</secondary>
42851 </indexterm>
42852 <indexterm role="concept">
42853 <primary>transport</primary>
42854 <secondary>local; uid and gid</secondary>
42855 </indexterm>
42856 All transports have the options <option>group</option> and <option>user</option>. If <option>group</option> is set, it
42857 overrides any group that the router set in the address, even if <option>user</option> is not
42858 set for the transport. This makes it possible, for example, to run local mail
42859 delivery under the uid of the recipient (set by the router), but in a special
42860 group (set by the transport). For example:
42861 </para>
42862 <literallayout class="monospaced">
42863 # Routers ...
42864 # User/group are set by check_local_user in this router
42865 local_users:
42866   driver = accept
42867   check_local_user
42868   transport = group_delivery
42869
42870 # Transports ...
42871 # This transport overrides the group
42872 group_delivery:
42873   driver = appendfile
42874   file = /var/spool/mail/$local_part_data
42875   group = mail
42876 </literallayout>
42877 <para>
42878 If <option>user</option> is set for a transport, its value overrides what is set in the
42879 address by the router. If <option>user</option> is non-numeric and <option>group</option> is not set, the
42880 gid associated with the user is used. If <option>user</option> is numeric, <option>group</option> must be
42881 set.
42882 </para>
42883 <para>
42884 <indexterm role="option">
42885 <primary><option>initgroups</option></primary>
42886 </indexterm>
42887 When the uid is taken from the transport&#x2019;s configuration, the <function>initgroups()</function>
42888 function is called for the groups associated with that uid if the
42889 <option>initgroups</option> option is set for the transport. When the uid is not specified
42890 by the transport, but is associated with the address by a router, the option
42891 for calling <function>initgroups()</function> is taken from the router configuration.
42892 </para>
42893 <para>
42894 <indexterm role="concept">
42895 <primary><command>pipe</command> transport</primary>
42896 <secondary>uid for</secondary>
42897 </indexterm>
42898 The <command>pipe</command> transport contains the special option <option>pipe_as_creator</option>. If this
42899 is set and <option>user</option> is not set, the uid of the process that called Exim to
42900 receive the message is used, and if <option>group</option> is not set, the corresponding
42901 original gid is also used.
42902 </para>
42903 <para>
42904 This is the detailed preference order for obtaining a gid; the first of the
42905 following that is set is used:
42906 </para>
42907 <itemizedlist>
42908 <listitem>
42909 <para>
42910 A <option>group</option> setting of the transport;
42911 </para>
42912 </listitem>
42913 <listitem>
42914 <para>
42915 A <option>group</option> setting of the router;
42916 </para>
42917 </listitem>
42918 <listitem>
42919 <para>
42920 A gid associated with a user setting of the router, either as a result of
42921 <option>check_local_user</option> or an explicit non-numeric <option>user</option> setting;
42922 </para>
42923 </listitem>
42924 <listitem>
42925 <para>
42926 The group associated with a non-numeric <option>user</option> setting of the transport;
42927 </para>
42928 </listitem>
42929 <listitem>
42930 <para>
42931 In a <command>pipe</command> transport, the creator&#x2019;s gid if <option>deliver_as_creator</option> is set and
42932 the uid is the creator&#x2019;s uid;
42933 </para>
42934 </listitem>
42935 <listitem>
42936 <para>
42937 The Exim gid if the Exim uid is being used as a default.
42938 </para>
42939 </listitem>
42940 </itemizedlist>
42941 <para>
42942 If, for example, the user is specified numerically on the router and there are
42943 no group settings, no gid is available. In this situation, an error occurs.
42944 This is different for the uid, for which there always is an ultimate default.
42945 The first of the following that is set is used:
42946 </para>
42947 <itemizedlist>
42948 <listitem>
42949 <para>
42950 A <option>user</option> setting of the transport;
42951 </para>
42952 </listitem>
42953 <listitem>
42954 <para>
42955 In a <command>pipe</command> transport, the creator&#x2019;s uid if <option>deliver_as_creator</option> is set;
42956 </para>
42957 </listitem>
42958 <listitem>
42959 <para>
42960 A <option>user</option> setting of the router;
42961 </para>
42962 </listitem>
42963 <listitem>
42964 <para>
42965 A <option>check_local_user</option> setting of the router;
42966 </para>
42967 </listitem>
42968 <listitem>
42969 <para>
42970 The Exim uid.
42971 </para>
42972 </listitem>
42973 </itemizedlist>
42974 <para>
42975 Of course, an error will still occur if the uid that is chosen is on the
42976 <option>never_users</option> list.
42977 </para>
42978 </section>
42979 <section id="SECID132">
42980 <title>Current and home directories</title>
42981 <para>
42982 <indexterm role="concept">
42983 <primary>current directory for local transport</primary>
42984 </indexterm>
42985 <indexterm role="concept">
42986 <primary>home directory</primary>
42987 <secondary>for local transport</secondary>
42988 </indexterm>
42989 <indexterm role="concept">
42990 <primary>transport</primary>
42991 <secondary>local; home directory for</secondary>
42992 </indexterm>
42993 <indexterm role="concept">
42994 <primary>transport</primary>
42995 <secondary>local; current directory for</secondary>
42996 </indexterm>
42997 Routers may set current and home directories for local transports by means of
42998 the <option>transport_current_directory</option> and <option>transport_home_directory</option> options.
42999 However, if the transport&#x2019;s <option>current_directory</option> or <option>home_directory</option> options
43000 are set, they override the router&#x2019;s values. In detail, the home directory
43001 for a local transport is taken from the first of these values that is set:
43002 </para>
43003 <itemizedlist>
43004 <listitem>
43005 <para>
43006 The <option>home_directory</option> option on the transport;
43007 </para>
43008 </listitem>
43009 <listitem>
43010 <para>
43011 The <option>transport_home_directory</option> option on the router;
43012 </para>
43013 </listitem>
43014 <listitem>
43015 <para>
43016 The password data if <option>check_local_user</option> is set on the router;
43017 </para>
43018 </listitem>
43019 <listitem>
43020 <para>
43021 The <option>router_home_directory</option> option on the router.
43022 </para>
43023 </listitem>
43024 </itemizedlist>
43025 <para>
43026 The current directory is taken from the first of these values that is set:
43027 </para>
43028 <itemizedlist>
43029 <listitem>
43030 <para>
43031 The <option>current_directory</option> option on the transport;
43032 </para>
43033 </listitem>
43034 <listitem>
43035 <para>
43036 The <option>transport_current_directory</option> option on the router.
43037 </para>
43038 </listitem>
43039 </itemizedlist>
43040 <para>
43041 If neither the router nor the transport sets a current directory, Exim uses the
43042 value of the home directory, if it is set. Otherwise it sets the current
43043 directory to <filename>/</filename> before running a local transport.
43044 </para>
43045 </section>
43046 <section id="SECID133">
43047 <title>Expansion variables derived from the address</title>
43048 <para>
43049 <indexterm role="variable">
43050 <primary><varname>$domain</varname></primary>
43051 </indexterm>
43052 <indexterm role="variable">
43053 <primary><varname>$local_part</varname></primary>
43054 </indexterm>
43055 <indexterm role="variable">
43056 <primary><varname>$original_domain</varname></primary>
43057 </indexterm>
43058 Normally a local delivery is handling a single address, and in that case the
43059 variables such as <varname>$domain</varname> and <varname>$local_part</varname> are set during local
43060 deliveries. However, in some circumstances more than one address may be handled
43061 at once (for example, while writing batch SMTP for onward transmission by some
43062 other means). In this case, the variables associated with the local part are
43063 never set, <varname>$domain</varname> is set only if all the addresses have the same domain,
43064 and <varname>$original_domain</varname> is never set.
43065 <indexterm role="concept" startref="IIDenvlotra1" class="endofrange"/>
43066 <indexterm role="concept" startref="IIDenvlotra2" class="endofrange"/>
43067 <indexterm role="concept" startref="IIDenvlotra3" class="endofrange"/>
43068 </para>
43069 </section>
43070 </chapter>
43071
43072 <chapter id="CHAPtransportgeneric">
43073 <title>Generic options for transports</title>
43074 <para>
43075 <indexterm role="concept" id="IIDgenoptra1" class="startofrange">
43076 <primary>generic options</primary>
43077 <secondary>transport</secondary>
43078 </indexterm>
43079 <indexterm role="concept" id="IIDgenoptra2" class="startofrange">
43080 <primary>options</primary>
43081 <secondary>generic; for transports</secondary>
43082 </indexterm>
43083 <indexterm role="concept" id="IIDgenoptra3" class="startofrange">
43084 <primary>transport</primary>
43085 <secondary>generic options for</secondary>
43086 </indexterm>
43087 The name of a transport is limited to be 64 ASCII characters long;
43088 prior to Exim 4.95 names would be silently truncated at this length, but now
43089 it is enforced.
43090 </para>
43091 <para>
43092 The following generic options apply to all transports:
43093 </para>
43094 <para>
43095 <indexterm role="option">
43096 <primary><option>body_only</option></primary>
43097 </indexterm>
43098 </para>
43099 <informaltable frame="all">
43100 <tgroup cols="4" colsep="0" rowsep="0">
43101 <colspec colwidth="8*" align="left"/>
43102 <colspec colwidth="6*" align="center"/>
43103 <colspec colwidth="6*" align="center"/>
43104 <colspec colwidth="6*" align="right"/>
43105 <tbody>
43106 <row>
43107 <entry><option>body_only</option></entry>
43108 <entry>Use: <emphasis>transports</emphasis></entry>
43109 <entry>Type: <emphasis>boolean</emphasis></entry>
43110 <entry>Default: <emphasis>false</emphasis></entry>
43111 </row>
43112 </tbody>
43113 </tgroup>
43114 </informaltable>
43115 <para>
43116 <indexterm role="concept">
43117 <primary>transport</primary>
43118 <secondary>body only</secondary>
43119 </indexterm>
43120 <indexterm role="concept">
43121 <primary>message</primary>
43122 <secondary>transporting body only</secondary>
43123 </indexterm>
43124 <indexterm role="concept">
43125 <primary>body of message</primary>
43126 <secondary>transporting</secondary>
43127 </indexterm>
43128 If this option is set, the message&#x2019;s headers are not transported. It is
43129 mutually exclusive with <option>headers_only</option>. If it is used with the <command>appendfile</command>
43130 or <command>pipe</command> transports, the settings of <option>message_prefix</option> and
43131 <option>message_suffix</option> should be checked, because this option does not
43132 automatically suppress them.
43133 </para>
43134 <para>
43135 <indexterm role="option">
43136 <primary><option>current_directory</option></primary>
43137 </indexterm>
43138 </para>
43139 <informaltable frame="all">
43140 <tgroup cols="4" colsep="0" rowsep="0">
43141 <colspec colwidth="8*" align="left"/>
43142 <colspec colwidth="6*" align="center"/>
43143 <colspec colwidth="6*" align="center"/>
43144 <colspec colwidth="6*" align="right"/>
43145 <tbody>
43146 <row>
43147 <entry><option>current_directory</option></entry>
43148 <entry>Use: <emphasis>transports</emphasis></entry>
43149 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43150 <entry>Default: <emphasis>unset</emphasis></entry>
43151 </row>
43152 </tbody>
43153 </tgroup>
43154 </informaltable>
43155 <para>
43156 <indexterm role="concept">
43157 <primary>transport</primary>
43158 <secondary>current directory for</secondary>
43159 </indexterm>
43160 This specifies the current directory that is to be set while running the
43161 transport, overriding any value that may have been set by the router.
43162 If the expansion fails for any reason, including forced failure, an error is
43163 logged, and delivery is deferred.
43164 </para>
43165 <para>
43166 <indexterm role="option">
43167 <primary><option>disable_logging</option></primary>
43168 </indexterm>
43169 </para>
43170 <informaltable frame="all">
43171 <tgroup cols="4" colsep="0" rowsep="0">
43172 <colspec colwidth="8*" align="left"/>
43173 <colspec colwidth="6*" align="center"/>
43174 <colspec colwidth="6*" align="center"/>
43175 <colspec colwidth="6*" align="right"/>
43176 <tbody>
43177 <row>
43178 <entry><option>disable_logging</option></entry>
43179 <entry>Use: <emphasis>transports</emphasis></entry>
43180 <entry>Type: <emphasis>boolean</emphasis></entry>
43181 <entry>Default: <emphasis>false</emphasis></entry>
43182 </row>
43183 </tbody>
43184 </tgroup>
43185 </informaltable>
43186 <para>
43187 If this option is set true, nothing is logged for any
43188 deliveries by the transport or for any
43189 transport errors. You should not set this option unless you really, really know
43190 what you are doing.
43191 </para>
43192 <para>
43193 <indexterm role="option">
43194 <primary><option>debug_print</option></primary>
43195 </indexterm>
43196 </para>
43197 <informaltable frame="all">
43198 <tgroup cols="4" colsep="0" rowsep="0">
43199 <colspec colwidth="8*" align="left"/>
43200 <colspec colwidth="6*" align="center"/>
43201 <colspec colwidth="6*" align="center"/>
43202 <colspec colwidth="6*" align="right"/>
43203 <tbody>
43204 <row>
43205 <entry><option>debug_print</option></entry>
43206 <entry>Use: <emphasis>transports</emphasis></entry>
43207 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43208 <entry>Default: <emphasis>unset</emphasis></entry>
43209 </row>
43210 </tbody>
43211 </tgroup>
43212 </informaltable>
43213 <para>
43214 <indexterm role="concept">
43215 <primary>testing</primary>
43216 <secondary>variables in drivers</secondary>
43217 </indexterm>
43218 If this option is set and debugging is enabled (see the <option>-d</option> command line
43219 option), the string is expanded and included in the debugging output when the
43220 transport is run.
43221 If expansion of the string fails, the error message is written to the debugging
43222 output, and Exim carries on processing.
43223 This facility is provided to help with checking out the values of variables and
43224 so on when debugging driver configurations. For example, if a <option>headers_add</option>
43225 option is not working properly, <option>debug_print</option> could be used to output the
43226 variables it references. A newline is added to the text if it does not end with
43227 one.
43228 The variables <varname>$transport_name</varname> and <varname>$router_name</varname> contain the name of the
43229 transport and the router that called it.
43230 </para>
43231 <para>
43232 <indexterm role="option">
43233 <primary><option>delivery_date_add</option></primary>
43234 </indexterm>
43235 </para>
43236 <informaltable frame="all">
43237 <tgroup cols="4" colsep="0" rowsep="0">
43238 <colspec colwidth="8*" align="left"/>
43239 <colspec colwidth="6*" align="center"/>
43240 <colspec colwidth="6*" align="center"/>
43241 <colspec colwidth="6*" align="right"/>
43242 <tbody>
43243 <row>
43244 <entry><option>delivery_date_add</option></entry>
43245 <entry>Use: <emphasis>transports</emphasis></entry>
43246 <entry>Type: <emphasis>boolean</emphasis></entry>
43247 <entry>Default: <emphasis>false</emphasis></entry>
43248 </row>
43249 </tbody>
43250 </tgroup>
43251 </informaltable>
43252 <para>
43253 <indexterm role="concept">
43254 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
43255 </indexterm>
43256 If this option is true, a <emphasis>Delivery-date:</emphasis> header is added to the message.
43257 This gives the actual time the delivery was made. As this is not a standard
43258 header, Exim has a configuration option (<option>delivery_date_remove</option>) which
43259 requests its removal from incoming messages, so that delivered messages can
43260 safely be resent to other recipients.
43261 </para>
43262 <para>
43263 <indexterm role="option">
43264 <primary><option>driver</option></primary>
43265 </indexterm>
43266 </para>
43267 <informaltable frame="all">
43268 <tgroup cols="4" colsep="0" rowsep="0">
43269 <colspec colwidth="8*" align="left"/>
43270 <colspec colwidth="6*" align="center"/>
43271 <colspec colwidth="6*" align="center"/>
43272 <colspec colwidth="6*" align="right"/>
43273 <tbody>
43274 <row>
43275 <entry><option>driver</option></entry>
43276 <entry>Use: <emphasis>transports</emphasis></entry>
43277 <entry>Type: <emphasis>string</emphasis></entry>
43278 <entry>Default: <emphasis>unset</emphasis></entry>
43279 </row>
43280 </tbody>
43281 </tgroup>
43282 </informaltable>
43283 <para>
43284 This specifies which of the available transport drivers is to be used.
43285 There is no default, and this option must be set for every transport.
43286 </para>
43287 <para>
43288 <indexterm role="option">
43289 <primary><option>envelope_to_add</option></primary>
43290 </indexterm>
43291 </para>
43292 <informaltable frame="all">
43293 <tgroup cols="4" colsep="0" rowsep="0">
43294 <colspec colwidth="8*" align="left"/>
43295 <colspec colwidth="6*" align="center"/>
43296 <colspec colwidth="6*" align="center"/>
43297 <colspec colwidth="6*" align="right"/>
43298 <tbody>
43299 <row>
43300 <entry><option>envelope_to_add</option></entry>
43301 <entry>Use: <emphasis>transports</emphasis></entry>
43302 <entry>Type: <emphasis>boolean</emphasis></entry>
43303 <entry>Default: <emphasis>false</emphasis></entry>
43304 </row>
43305 </tbody>
43306 </tgroup>
43307 </informaltable>
43308 <para>
43309 <indexterm role="concept">
43310 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
43311 </indexterm>
43312 If this option is true, an <emphasis>Envelope-to:</emphasis> header is added to the message.
43313 This gives the original address(es) in the incoming envelope that caused this
43314 delivery to happen. More than one address may be present if the transport is
43315 configured to handle several addresses at once, or if more than one original
43316 address was redirected to the same final address. As this is not a standard
43317 header, Exim has a configuration option (<option>envelope_to_remove</option>) which requests
43318 its removal from incoming messages, so that delivered messages can safely be
43319 resent to other recipients.
43320 </para>
43321 <para>
43322 <emphasis role="bold">Note:</emphasis> If used on a transport handling multiple recipients
43323 (the smtp transport unless <option>rcpt_max</option> is 1, the appendfile, pipe or lmtp
43324 transport if <option>batch_max</option> is greater than 1)
43325 then information about Bcc recipients will be leaked.
43326 Doing so is generally not advised.
43327 </para>
43328 <para>
43329 <indexterm role="option">
43330 <primary><option>event_action</option></primary>
43331 </indexterm>
43332 </para>
43333 <informaltable frame="all">
43334 <tgroup cols="4" colsep="0" rowsep="0">
43335 <colspec colwidth="8*" align="left"/>
43336 <colspec colwidth="6*" align="center"/>
43337 <colspec colwidth="6*" align="center"/>
43338 <colspec colwidth="6*" align="right"/>
43339 <tbody>
43340 <row>
43341 <entry><option>event_action</option></entry>
43342 <entry>Use: <emphasis>transports</emphasis></entry>
43343 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43344 <entry>Default: <emphasis>unset</emphasis></entry>
43345 </row>
43346 </tbody>
43347 </tgroup>
43348 </informaltable>
43349 <para>
43350 <indexterm role="concept">
43351 <primary>events</primary>
43352 </indexterm>
43353 This option declares a string to be expanded for Exim&#x2019;s events mechanism.
43354 For details see chapter <xref linkend="CHAPevents"/>.
43355 </para>
43356 <para>
43357 <indexterm role="option">
43358 <primary><option>group</option></primary>
43359 </indexterm>
43360 </para>
43361 <informaltable frame="all">
43362 <tgroup cols="4" colsep="0" rowsep="0">
43363 <colspec colwidth="8*" align="left"/>
43364 <colspec colwidth="6*" align="center"/>
43365 <colspec colwidth="6*" align="center"/>
43366 <colspec colwidth="6*" align="right"/>
43367 <tbody>
43368 <row>
43369 <entry><option>group</option></entry>
43370 <entry>Use: <emphasis>transports</emphasis></entry>
43371 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43372 <entry>Default: <emphasis>Exim group</emphasis></entry>
43373 </row>
43374 </tbody>
43375 </tgroup>
43376 </informaltable>
43377 <para>
43378 <indexterm role="concept">
43379 <primary>transport</primary>
43380 <secondary>group; specifying</secondary>
43381 </indexterm>
43382 This option specifies a gid for running the transport process, overriding any
43383 value that the router supplies, and also overriding any value associated with
43384 <option>user</option> (see below).
43385 </para>
43386 <para>
43387 <indexterm role="option">
43388 <primary><option>headers_add</option></primary>
43389 </indexterm>
43390 </para>
43391 <informaltable frame="all">
43392 <tgroup cols="4" colsep="0" rowsep="0">
43393 <colspec colwidth="8*" align="left"/>
43394 <colspec colwidth="6*" align="center"/>
43395 <colspec colwidth="6*" align="center"/>
43396 <colspec colwidth="6*" align="right"/>
43397 <tbody>
43398 <row>
43399 <entry><option>headers_add</option></entry>
43400 <entry>Use: <emphasis>transports</emphasis></entry>
43401 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
43402 <entry>Default: <emphasis>unset</emphasis></entry>
43403 </row>
43404 </tbody>
43405 </tgroup>
43406 </informaltable>
43407 <para>
43408 <indexterm role="concept">
43409 <primary>header lines</primary>
43410 <secondary>adding in transport</secondary>
43411 </indexterm>
43412 <indexterm role="concept">
43413 <primary>transport</primary>
43414 <secondary>header lines; adding</secondary>
43415 </indexterm>
43416 This option specifies a list of text headers,
43417 newline-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
43418 which are (separately) expanded and added to the header
43419 portion of a message as it is transported, as described in section
43420 <xref linkend="SECTheadersaddrem"/>. Additional header lines can also be specified by
43421 routers. If the result of the expansion is an empty string, or if the expansion
43422 is forced to fail, no action is taken. Other expansion failures are treated as
43423 errors and cause the delivery to be deferred.
43424 </para>
43425 <para>
43426 Unlike most options, <option>headers_add</option> can be specified multiple times
43427 for a transport; all listed headers are added.
43428 </para>
43429 <para>
43430 <indexterm role="option">
43431 <primary><option>headers_only</option></primary>
43432 </indexterm>
43433 </para>
43434 <informaltable frame="all">
43435 <tgroup cols="4" colsep="0" rowsep="0">
43436 <colspec colwidth="8*" align="left"/>
43437 <colspec colwidth="6*" align="center"/>
43438 <colspec colwidth="6*" align="center"/>
43439 <colspec colwidth="6*" align="right"/>
43440 <tbody>
43441 <row>
43442 <entry><option>headers_only</option></entry>
43443 <entry>Use: <emphasis>transports</emphasis></entry>
43444 <entry>Type: <emphasis>boolean</emphasis></entry>
43445 <entry>Default: <emphasis>false</emphasis></entry>
43446 </row>
43447 </tbody>
43448 </tgroup>
43449 </informaltable>
43450 <para>
43451 <indexterm role="concept">
43452 <primary>transport</primary>
43453 <secondary>header lines only</secondary>
43454 </indexterm>
43455 <indexterm role="concept">
43456 <primary>message</primary>
43457 <secondary>transporting headers only</secondary>
43458 </indexterm>
43459 <indexterm role="concept">
43460 <primary>header lines</primary>
43461 <secondary>transporting</secondary>
43462 </indexterm>
43463 If this option is set, the message&#x2019;s body is not transported. It is mutually
43464 exclusive with <option>body_only</option>. If it is used with the <command>appendfile</command> or <command>pipe</command>
43465 transports, the settings of <option>message_prefix</option> and <option>message_suffix</option> should be
43466 checked, since this option does not automatically suppress them.
43467 </para>
43468 <para>
43469 <indexterm role="option">
43470 <primary><option>headers_remove</option></primary>
43471 </indexterm>
43472 </para>
43473 <informaltable frame="all">
43474 <tgroup cols="4" colsep="0" rowsep="0">
43475 <colspec colwidth="8*" align="left"/>
43476 <colspec colwidth="6*" align="center"/>
43477 <colspec colwidth="6*" align="center"/>
43478 <colspec colwidth="6*" align="right"/>
43479 <tbody>
43480 <row>
43481 <entry><option>headers_remove</option></entry>
43482 <entry>Use: <emphasis>transports</emphasis></entry>
43483 <entry>Type: <emphasis>list</emphasis>&dagger;<emphasis></emphasis></entry>
43484 <entry>Default: <emphasis>unset</emphasis></entry>
43485 </row>
43486 </tbody>
43487 </tgroup>
43488 </informaltable>
43489 <para>
43490 <indexterm role="concept">
43491 <primary>header lines</primary>
43492 <secondary>removing</secondary>
43493 </indexterm>
43494 <indexterm role="concept">
43495 <primary>transport</primary>
43496 <secondary>header lines; removing</secondary>
43497 </indexterm>
43498 This option specifies a list of text headers,
43499 colon-separated (by default, changeable in the usual way <xref linkend="SECTlistsepchange"/>),
43500 to be removed from the message.
43501 However, the option has no effect when an address is just being verified.
43502 Each list item is separately expanded.
43503 If the result of the expansion is an empty string, or if the expansion
43504 is forced to fail, no action is taken. Other expansion failures are treated as
43505 errors and cause the delivery to be deferred.
43506 If an item ends in *, it will match any header with the given prefix.
43507 </para>
43508 <para>
43509 Matching headers are omitted from the message as it is transported, as described
43510 in section <xref linkend="SECTheadersaddrem"/>. Header removal can also be specified by
43511 routers.
43512 </para>
43513 <para>
43514 Unlike most options, <option>headers_remove</option> can be specified multiple times
43515 for a transport; all listed headers are removed.
43516 </para>
43517 <para>
43518 <emphasis role="bold">Warning</emphasis>: Because of the separate expansion of the list items,
43519 items that contain a list separator must have it doubled.
43520 To avoid this, change the list separator (<xref linkend="SECTlistsepchange"/>).
43521 </para>
43522 <para>
43523 <indexterm role="option">
43524 <primary><option>headers_rewrite</option></primary>
43525 </indexterm>
43526 </para>
43527 <informaltable frame="all">
43528 <tgroup cols="4" colsep="0" rowsep="0">
43529 <colspec colwidth="8*" align="left"/>
43530 <colspec colwidth="6*" align="center"/>
43531 <colspec colwidth="6*" align="center"/>
43532 <colspec colwidth="6*" align="right"/>
43533 <tbody>
43534 <row>
43535 <entry><option>headers_rewrite</option></entry>
43536 <entry>Use: <emphasis>transports</emphasis></entry>
43537 <entry>Type: <emphasis>string</emphasis></entry>
43538 <entry>Default: <emphasis>unset</emphasis></entry>
43539 </row>
43540 </tbody>
43541 </tgroup>
43542 </informaltable>
43543 <para>
43544 <indexterm role="concept">
43545 <primary>transport</primary>
43546 <secondary>header lines; rewriting</secondary>
43547 </indexterm>
43548 <indexterm role="concept">
43549 <primary>rewriting</primary>
43550 <secondary>at transport time</secondary>
43551 </indexterm>
43552 This option allows addresses in header lines to be rewritten at transport time,
43553 that is, as the message is being copied to its destination. The contents of the
43554 option are a colon-separated list of rewriting rules. Each rule is in exactly
43555 the same form as one of the general rewriting rules that are applied when a
43556 message is received. These are described in chapter <xref linkend="CHAPrewrite"/>. For
43557 example,
43558 </para>
43559 <literallayout class="monospaced">
43560 headers_rewrite = a@b c@d f : \
43561                   x@y w@z
43562 </literallayout>
43563 <para>
43564 changes <emphasis>a@b</emphasis> into <emphasis>c@d</emphasis> in <emphasis>From:</emphasis> header lines, and <emphasis>x@y</emphasis> into
43565 <emphasis>w@z</emphasis> in all address-bearing header lines. The rules are applied to the
43566 header lines just before they are written out at transport time, so they affect
43567 only those copies of the message that pass through the transport. However, only
43568 the message&#x2019;s original header lines, and any that were added by a system
43569 filter, are rewritten. If a router or transport adds header lines, they are not
43570 affected by this option. These rewriting rules are <emphasis>not</emphasis> applied to the
43571 envelope. You can change the return path using <option>return_path</option>, but you cannot
43572 change envelope recipients at this time.
43573 </para>
43574 <para>
43575 <indexterm role="option">
43576 <primary><option>home_directory</option></primary>
43577 </indexterm>
43578 </para>
43579 <informaltable frame="all">
43580 <tgroup cols="4" colsep="0" rowsep="0">
43581 <colspec colwidth="8*" align="left"/>
43582 <colspec colwidth="6*" align="center"/>
43583 <colspec colwidth="6*" align="center"/>
43584 <colspec colwidth="6*" align="right"/>
43585 <tbody>
43586 <row>
43587 <entry><option>home_directory</option></entry>
43588 <entry>Use: <emphasis>transports</emphasis></entry>
43589 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43590 <entry>Default: <emphasis>unset</emphasis></entry>
43591 </row>
43592 </tbody>
43593 </tgroup>
43594 </informaltable>
43595 <para>
43596 <indexterm role="concept">
43597 <primary>transport</primary>
43598 <secondary>home directory for</secondary>
43599 </indexterm>
43600 <indexterm role="variable">
43601 <primary><varname>$home</varname></primary>
43602 </indexterm>
43603 This option specifies a home directory setting for a local transport,
43604 overriding any value that may be set by the router. The home directory is
43605 placed in <varname>$home</varname> while expanding the transport&#x2019;s private options. It is also
43606 used as the current directory if no current directory is set by the
43607 <option>current_directory</option> option on the transport or the
43608 <option>transport_current_directory</option> option on the router. If the expansion fails
43609 for any reason, including forced failure, an error is logged, and delivery is
43610 deferred.
43611 </para>
43612 <para>
43613 <indexterm role="option">
43614 <primary><option>initgroups</option></primary>
43615 </indexterm>
43616 </para>
43617 <informaltable frame="all">
43618 <tgroup cols="4" colsep="0" rowsep="0">
43619 <colspec colwidth="8*" align="left"/>
43620 <colspec colwidth="6*" align="center"/>
43621 <colspec colwidth="6*" align="center"/>
43622 <colspec colwidth="6*" align="right"/>
43623 <tbody>
43624 <row>
43625 <entry><option>initgroups</option></entry>
43626 <entry>Use: <emphasis>transports</emphasis></entry>
43627 <entry>Type: <emphasis>boolean</emphasis></entry>
43628 <entry>Default: <emphasis>false</emphasis></entry>
43629 </row>
43630 </tbody>
43631 </tgroup>
43632 </informaltable>
43633 <para>
43634 <indexterm role="concept">
43635 <primary>additional groups</primary>
43636 </indexterm>
43637 <indexterm role="concept">
43638 <primary>groups</primary>
43639 <secondary>additional</secondary>
43640 </indexterm>
43641 <indexterm role="concept">
43642 <primary>transport</primary>
43643 <secondary>group; additional</secondary>
43644 </indexterm>
43645 If this option is true and the uid for the delivery process is provided by the
43646 transport, the <function>initgroups()</function> function is called when running the transport
43647 to ensure that any additional groups associated with the uid are set up.
43648 </para>
43649 <para>
43650 <indexterm role="option">
43651 <primary><option>max_parallel</option></primary>
43652 </indexterm>
43653 </para>
43654 <informaltable frame="all">
43655 <tgroup cols="4" colsep="0" rowsep="0">
43656 <colspec colwidth="8*" align="left"/>
43657 <colspec colwidth="6*" align="center"/>
43658 <colspec colwidth="6*" align="center"/>
43659 <colspec colwidth="6*" align="right"/>
43660 <tbody>
43661 <row>
43662 <entry><option>max_parallel</option></entry>
43663 <entry>Use: <emphasis>transports</emphasis></entry>
43664 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
43665 <entry>Default: <emphasis>unset</emphasis></entry>
43666 </row>
43667 </tbody>
43668 </tgroup>
43669 </informaltable>
43670 <para>
43671 <indexterm role="concept">
43672 <primary>limit</primary>
43673 <secondary>transport parallelism</secondary>
43674 </indexterm>
43675 <indexterm role="concept">
43676 <primary>transport</primary>
43677 <secondary>parallel processes</secondary>
43678 </indexterm>
43679 <indexterm role="concept">
43680 <primary>transport</primary>
43681 <secondary>concurrency limit</secondary>
43682 </indexterm>
43683 <indexterm role="concept">
43684 <primary>delivery</primary>
43685 <secondary>parallelism for transport</secondary>
43686 </indexterm>
43687 If this option is set and expands to an integer greater than zero
43688 it limits the number of concurrent runs of the transport.
43689 The control does not apply to shadow transports.
43690 </para>
43691 <para>
43692 <indexterm role="concept">
43693 <primary>hints database</primary>
43694 <secondary>transport concurrency control</secondary>
43695 </indexterm>
43696 Exim implements this control by means of a hints database in which a record is
43697 incremented whenever a transport process is being created. The record
43698 is decremented and possibly removed when the process terminates.
43699 Obviously there is scope for
43700 records to get left lying around if there is a system or program crash. To
43701 guard against this, Exim ignores any records that are more than six hours old.
43702 </para>
43703 <para>
43704 If you use this option, you should also arrange to delete the
43705 relevant hints database whenever your system reboots. The names of the files
43706 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
43707 may be one or two files, depending on the type of DBM in use. The same files
43708 are used for ETRN and smtp transport serialization.
43709 </para>
43710 <para>
43711 <indexterm role="option">
43712 <primary><option>message_size_limit</option></primary>
43713 </indexterm>
43714 </para>
43715 <informaltable frame="all">
43716 <tgroup cols="4" colsep="0" rowsep="0">
43717 <colspec colwidth="8*" align="left"/>
43718 <colspec colwidth="6*" align="center"/>
43719 <colspec colwidth="6*" align="center"/>
43720 <colspec colwidth="6*" align="right"/>
43721 <tbody>
43722 <row>
43723 <entry><option>message_size_limit</option></entry>
43724 <entry>Use: <emphasis>transports</emphasis></entry>
43725 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43726 <entry>Default: <emphasis>0</emphasis></entry>
43727 </row>
43728 </tbody>
43729 </tgroup>
43730 </informaltable>
43731 <para>
43732 <indexterm role="concept">
43733 <primary>limit</primary>
43734 <secondary>message size per transport</secondary>
43735 </indexterm>
43736 <indexterm role="concept">
43737 <primary>size</primary>
43738 <secondary>of message, limit</secondary>
43739 </indexterm>
43740 <indexterm role="concept">
43741 <primary>transport</primary>
43742 <secondary>message size; limiting</secondary>
43743 </indexterm>
43744 This option controls the size of messages passed through the transport. It is
43745 expanded before use; the result of the expansion must be a sequence of decimal
43746 digits, optionally followed by K or M. If the expansion fails for any reason,
43747 including forced failure, or if the result is not of the required form,
43748 delivery is deferred. If the value is greater than zero and the size of a
43749 message exceeds this limit, the address is failed. If there is any chance that
43750 the resulting bounce message could be routed to the same transport, you should
43751 ensure that <option>return_size_limit</option> is less than the transport&#x2019;s
43752 <option>message_size_limit</option>, as otherwise the bounce message will fail to get
43753 delivered.
43754 </para>
43755 <para>
43756 <indexterm role="option">
43757 <primary><option>rcpt_include_affixes</option></primary>
43758 </indexterm>
43759 </para>
43760 <informaltable frame="all">
43761 <tgroup cols="4" colsep="0" rowsep="0">
43762 <colspec colwidth="8*" align="left"/>
43763 <colspec colwidth="6*" align="center"/>
43764 <colspec colwidth="6*" align="center"/>
43765 <colspec colwidth="6*" align="right"/>
43766 <tbody>
43767 <row>
43768 <entry><option>rcpt_include_affixes</option></entry>
43769 <entry>Use: <emphasis>transports</emphasis></entry>
43770 <entry>Type: <emphasis>boolean</emphasis></entry>
43771 <entry>Default: <emphasis>false</emphasis></entry>
43772 </row>
43773 </tbody>
43774 </tgroup>
43775 </informaltable>
43776 <para>
43777 <indexterm role="concept">
43778 <primary>prefix</primary>
43779 <secondary>for local part, including in envelope</secondary>
43780 </indexterm>
43781 <indexterm role="concept">
43782 <primary>suffix for local part</primary>
43783 <secondary>including in envelope</secondary>
43784 </indexterm>
43785 <indexterm role="concept">
43786 <primary>local part</primary>
43787 <secondary>prefix</secondary>
43788 </indexterm>
43789 <indexterm role="concept">
43790 <primary>local part</primary>
43791 <secondary>suffix</secondary>
43792 </indexterm>
43793 When this option is false (the default), and an address that has had any
43794 affixes (prefixes or suffixes) removed from the local part is delivered by any
43795 form of SMTP or LMTP, the affixes are not included. For example, if a router
43796 that contains
43797 </para>
43798 <literallayout class="monospaced">
43799 local_part_prefix = *-
43800 </literallayout>
43801 <para>
43802 routes the address <emphasis>abc-xyz@some.domain</emphasis> to an SMTP transport, the envelope
43803 is delivered with
43804 </para>
43805 <literallayout class="monospaced">
43806 RCPT TO:&lt;xyz@some.domain&gt;
43807 </literallayout>
43808 <para>
43809 This is also the case when an ACL-time callout is being used to verify a
43810 recipient address. However, if <option>rcpt_include_affixes</option> is set true, the
43811 whole local part is included in the RCPT command. This option applies to BSMTP
43812 deliveries by the <command>appendfile</command> and <command>pipe</command> transports as well as to the
43813 <command>lmtp</command> and <command>smtp</command> transports.
43814 </para>
43815 <para>
43816 <indexterm role="option">
43817 <primary><option>retry_use_local_part</option></primary>
43818 </indexterm>
43819 </para>
43820 <informaltable frame="all">
43821 <tgroup cols="4" colsep="0" rowsep="0">
43822 <colspec colwidth="8*" align="left"/>
43823 <colspec colwidth="6*" align="center"/>
43824 <colspec colwidth="6*" align="center"/>
43825 <colspec colwidth="6*" align="right"/>
43826 <tbody>
43827 <row>
43828 <entry><option>retry_use_local_part</option></entry>
43829 <entry>Use: <emphasis>transports</emphasis></entry>
43830 <entry>Type: <emphasis>boolean</emphasis></entry>
43831 <entry>Default: <emphasis>see below</emphasis></entry>
43832 </row>
43833 </tbody>
43834 </tgroup>
43835 </informaltable>
43836 <para>
43837 <indexterm role="concept">
43838 <primary>hints database</primary>
43839 <secondary>retry keys</secondary>
43840 </indexterm>
43841 When a delivery suffers a temporary failure, a retry record is created
43842 in Exim&#x2019;s hints database. For remote deliveries, the key for the retry record
43843 is based on the name and/or IP address of the failing remote host. For local
43844 deliveries, the key is normally the entire address, including both the local
43845 part and the domain. This is suitable for most common cases of local delivery
43846 temporary failure &ndash; for example, exceeding a mailbox quota should delay only
43847 deliveries to that mailbox, not to the whole domain.
43848 </para>
43849 <para>
43850 However, in some special cases you may want to treat a temporary local delivery
43851 as a failure associated with the domain, and not with a particular local part.
43852 (For example, if you are storing all mail for some domain in files.) You can do
43853 this by setting <option>retry_use_local_part</option> false.
43854 </para>
43855 <para>
43856 For all the local transports, its default value is true. For remote transports,
43857 the default value is false for tidiness, but changing the value has no effect
43858 on a remote transport in the current implementation.
43859 </para>
43860 <para>
43861 <indexterm role="option">
43862 <primary><option>return_path</option></primary>
43863 </indexterm>
43864 </para>
43865 <informaltable frame="all">
43866 <tgroup cols="4" colsep="0" rowsep="0">
43867 <colspec colwidth="8*" align="left"/>
43868 <colspec colwidth="6*" align="center"/>
43869 <colspec colwidth="6*" align="center"/>
43870 <colspec colwidth="6*" align="right"/>
43871 <tbody>
43872 <row>
43873 <entry><option>return_path</option></entry>
43874 <entry>Use: <emphasis>transports</emphasis></entry>
43875 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43876 <entry>Default: <emphasis>unset</emphasis></entry>
43877 </row>
43878 </tbody>
43879 </tgroup>
43880 </informaltable>
43881 <para>
43882 <indexterm role="concept">
43883 <primary>envelope sender</primary>
43884 </indexterm>
43885 <indexterm role="concept">
43886 <primary>envelope from</primary>
43887 </indexterm>
43888 <indexterm role="concept">
43889 <primary>transport</primary>
43890 <secondary>return path; changing</secondary>
43891 </indexterm>
43892 <indexterm role="concept">
43893 <primary>return path</primary>
43894 <secondary>changing in transport</secondary>
43895 </indexterm>
43896 If this option is set, the string is expanded at transport time and replaces
43897 the existing return path (envelope sender) value in the copy of the message
43898 that is being delivered. An empty return path is permitted. This feature is
43899 designed for remote deliveries, where the value of this option is used in the
43900 SMTP MAIL command. If you set <option>return_path</option> for a local transport, the
43901 only effect is to change the address that is placed in the <emphasis>Return-path:</emphasis>
43902 header line, if one is added to the message (see the next option).
43903 </para>
43904 <para>
43905 <emphasis role="bold">Note:</emphasis> A changed return path is not logged unless you add
43906 <option>return_path_on_delivery</option> to the log selector.
43907 </para>
43908 <para>
43909 <indexterm role="variable">
43910 <primary><varname>$return_path</varname></primary>
43911 </indexterm>
43912 The expansion can refer to the existing value via <varname>$return_path</varname>. This is
43913 either the message&#x2019;s envelope sender, or an address set by the
43914 <option>errors_to</option> option on a router. If the expansion is forced to fail, no
43915 replacement occurs; if it fails for another reason, delivery is deferred. This
43916 option can be used to support VERP (Variable Envelope Return Paths) &ndash; see
43917 section <xref linkend="SECTverp"/>.
43918 </para>
43919 <para>
43920 <emphasis role="bold">Note</emphasis>: If a delivery error is detected locally, including the case when a
43921 remote server rejects a message at SMTP time, the bounce message is not sent to
43922 the value of this option. It is sent to the previously set errors address.
43923 This defaults to the incoming sender address, but can be changed by setting
43924 <option>errors_to</option> in a router.
43925 </para>
43926 <para>
43927 <indexterm role="option">
43928 <primary><option>return_path_add</option></primary>
43929 </indexterm>
43930 </para>
43931 <informaltable frame="all">
43932 <tgroup cols="4" colsep="0" rowsep="0">
43933 <colspec colwidth="8*" align="left"/>
43934 <colspec colwidth="6*" align="center"/>
43935 <colspec colwidth="6*" align="center"/>
43936 <colspec colwidth="6*" align="right"/>
43937 <tbody>
43938 <row>
43939 <entry><option>return_path_add</option></entry>
43940 <entry>Use: <emphasis>transports</emphasis></entry>
43941 <entry>Type: <emphasis>boolean</emphasis></entry>
43942 <entry>Default: <emphasis>false</emphasis></entry>
43943 </row>
43944 </tbody>
43945 </tgroup>
43946 </informaltable>
43947 <para>
43948 <indexterm role="concept">
43949 <primary><emphasis>Return-path:</emphasis> header line</primary>
43950 </indexterm>
43951 <indexterm role="concept">
43952 <primary>header lines</primary>
43953 <secondary>Return-path:</secondary>
43954 </indexterm>
43955 If this option is true, a <emphasis>Return-path:</emphasis> header is added to the message.
43956 Although the return path is normally available in the prefix line of BSD
43957 mailboxes, this is commonly not displayed by MUAs, and so the user does not
43958 have easy access to it.
43959 </para>
43960 <para>
43961 RFC 2821 states that the <emphasis>Return-path:</emphasis> header is added to a message <quote>when
43962 the delivery SMTP server makes the final delivery</quote>. This implies that this
43963 header should not be present in incoming messages. Exim has a configuration
43964 option, <option>return_path_remove</option>, which requests removal of this header from
43965 incoming messages, so that delivered messages can safely be resent to other
43966 recipients.
43967 </para>
43968 <para>
43969 <indexterm role="option">
43970 <primary><option>shadow_condition</option></primary>
43971 </indexterm>
43972 </para>
43973 <informaltable frame="all">
43974 <tgroup cols="4" colsep="0" rowsep="0">
43975 <colspec colwidth="8*" align="left"/>
43976 <colspec colwidth="6*" align="center"/>
43977 <colspec colwidth="6*" align="center"/>
43978 <colspec colwidth="6*" align="right"/>
43979 <tbody>
43980 <row>
43981 <entry><option>shadow_condition</option></entry>
43982 <entry>Use: <emphasis>transports</emphasis></entry>
43983 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
43984 <entry>Default: <emphasis>unset</emphasis></entry>
43985 </row>
43986 </tbody>
43987 </tgroup>
43988 </informaltable>
43989 <para>
43990 See <option>shadow_transport</option> below.
43991 </para>
43992 <para>
43993 <indexterm role="option">
43994 <primary><option>shadow_transport</option></primary>
43995 </indexterm>
43996 </para>
43997 <informaltable frame="all">
43998 <tgroup cols="4" colsep="0" rowsep="0">
43999 <colspec colwidth="8*" align="left"/>
44000 <colspec colwidth="6*" align="center"/>
44001 <colspec colwidth="6*" align="center"/>
44002 <colspec colwidth="6*" align="right"/>
44003 <tbody>
44004 <row>
44005 <entry><option>shadow_transport</option></entry>
44006 <entry>Use: <emphasis>transports</emphasis></entry>
44007 <entry>Type: <emphasis>string</emphasis></entry>
44008 <entry>Default: <emphasis>unset</emphasis></entry>
44009 </row>
44010 </tbody>
44011 </tgroup>
44012 </informaltable>
44013 <para>
44014 <indexterm role="concept">
44015 <primary>shadow transport</primary>
44016 </indexterm>
44017 <indexterm role="concept">
44018 <primary>transport</primary>
44019 <secondary>shadow</secondary>
44020 </indexterm>
44021 A local transport may set the <option>shadow_transport</option> option to the name of
44022 another local transport. Shadow remote transports are not supported.
44023 </para>
44024 <para>
44025 Whenever a delivery to the main transport succeeds, and either
44026 <option>shadow_condition</option> is unset, or its expansion does not result in the empty
44027 string or one of the strings <quote>0</quote> or <quote>no</quote> or <quote>false</quote>, the message is also
44028 passed to the shadow transport, with the same delivery address or addresses. If
44029 expansion fails, no action is taken except that non-forced expansion failures
44030 cause a log line to be written.
44031 </para>
44032 <para>
44033 The result of the shadow transport is discarded and does not affect the
44034 subsequent processing of the message. Only a single level of shadowing is
44035 provided; the <option>shadow_transport</option> option is ignored on any transport when it
44036 is running as a shadow. Options concerned with output from pipes are also
44037 ignored. The log line for the successful delivery has an item added on the end,
44038 of the form
44039 </para>
44040 <literallayout class="monospaced">
44041 ST=&lt;shadow transport name&gt;
44042 </literallayout>
44043 <para>
44044 If the shadow transport did not succeed, the error message is put in
44045 parentheses afterwards. Shadow transports can be used for a number of different
44046 purposes, including keeping more detailed log information than Exim normally
44047 provides, and implementing automatic acknowledgment policies based on message
44048 headers that some sites insist on.
44049 </para>
44050 <para>
44051 <indexterm role="option">
44052 <primary><option>transport_filter</option></primary>
44053 </indexterm>
44054 </para>
44055 <informaltable frame="all">
44056 <tgroup cols="4" colsep="0" rowsep="0">
44057 <colspec colwidth="8*" align="left"/>
44058 <colspec colwidth="6*" align="center"/>
44059 <colspec colwidth="6*" align="center"/>
44060 <colspec colwidth="6*" align="right"/>
44061 <tbody>
44062 <row>
44063 <entry><option>transport_filter</option></entry>
44064 <entry>Use: <emphasis>transports</emphasis></entry>
44065 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44066 <entry>Default: <emphasis>unset</emphasis></entry>
44067 </row>
44068 </tbody>
44069 </tgroup>
44070 </informaltable>
44071 <para>
44072 <indexterm role="concept">
44073 <primary>transport</primary>
44074 <secondary>filter</secondary>
44075 </indexterm>
44076 <indexterm role="concept">
44077 <primary>filter</primary>
44078 <secondary>transport filter</secondary>
44079 </indexterm>
44080 This option sets up a filtering (in the Unix shell sense) process for messages
44081 at transport time. It should not be confused with mail filtering as set up by
44082 individual users or via a system filter.
44083 If unset, or expanding to an empty string, no filtering is done.
44084 </para>
44085 <para>
44086 When the message is about to be written out, the command specified by
44087 <option>transport_filter</option> is started up in a separate, parallel process, and
44088 the entire message, including the header lines, is passed to it on its standard
44089 input (this in fact is done from a third process, to avoid deadlock). The
44090 command must be specified as an absolute path.
44091 </para>
44092 <para>
44093 The lines of the message that are written to the transport filter are
44094 terminated by newline (<quote>\n</quote>). The message is passed to the filter before any
44095 SMTP-specific processing, such as turning <quote>\n</quote> into <quote>\r\n</quote> and escaping
44096 lines beginning with a dot, and also before any processing implied by the
44097 settings of <option>check_string</option> and <option>escape_string</option> in the <command>appendfile</command> or
44098 <command>pipe</command> transports.
44099 </para>
44100 <para>
44101 The standard error for the filter process is set to the same destination as its
44102 standard output; this is read and written to the message&#x2019;s ultimate
44103 destination. The process that writes the message to the filter, the
44104 filter itself, and the original process that reads the result and delivers it
44105 are all run in parallel, like a shell pipeline.
44106 </para>
44107 <para>
44108 The filter can perform any transformations it likes, but of course should take
44109 care not to break RFC 2822 syntax. Exim does not check the result, except to
44110 test for a final newline when SMTP is in use. All messages transmitted over
44111 SMTP must end with a newline, so Exim supplies one if it is missing.
44112 </para>
44113 <para>
44114 <indexterm role="concept">
44115 <primary>content scanning</primary>
44116 <secondary>per user</secondary>
44117 </indexterm>
44118 A transport filter can be used to provide content-scanning on a per-user basis
44119 at delivery time if the only required effect of the scan is to modify the
44120 message. For example, a content scan could insert a new header line containing
44121 a spam score. This could be interpreted by a filter in the user&#x2019;s MUA. It is
44122 not possible to discard a message at this stage.
44123 </para>
44124 <para>
44125 <indexterm role="concept">
44126 <primary>SIZE</primary>
44127 <secondary>ESMTP extension</secondary>
44128 </indexterm>
44129 A problem might arise if the filter increases the size of a message that is
44130 being sent down an SMTP connection. If the receiving SMTP server has indicated
44131 support for the SIZE parameter, Exim will have sent the size of the message
44132 at the start of the SMTP session. If what is actually sent is substantially
44133 more, the server might reject the message. This can be worked round by setting
44134 the <option>size_addition</option> option on the <command>smtp</command> transport, either to allow for
44135 additions to the message, or to disable the use of SIZE altogether.
44136 </para>
44137 <para>
44138 <indexterm role="variable">
44139 <primary><varname>$pipe_addresses</varname></primary>
44140 </indexterm>
44141 The value of the <option>transport_filter</option> option is the command string for starting
44142 the filter, which is run directly from Exim, not under a shell. The string is
44143 parsed by Exim in the same way as a command string for the <command>pipe</command> transport:
44144 Exim breaks it up into arguments and then expands each argument separately (see
44145 section <xref linkend="SECThowcommandrun"/>). Any kind of expansion failure causes delivery
44146 to be deferred. The special argument <varname>$pipe_addresses</varname> is replaced by a number
44147 of arguments, one for each address that applies to this delivery. (This isn&#x2019;t
44148 an ideal name for this feature here, but as it was already implemented for the
44149 <command>pipe</command> transport, it seemed sensible not to change it.)
44150 </para>
44151 <para>
44152 <indexterm role="variable">
44153 <primary><varname>$host</varname></primary>
44154 </indexterm>
44155 <indexterm role="variable">
44156 <primary><varname>$host_address</varname></primary>
44157 </indexterm>
44158 The expansion variables <varname>$host</varname> and <varname>$host_address</varname> are available when the
44159 transport is a remote one. They contain the name and IP address of the host to
44160 which the message is being sent. For example:
44161 </para>
44162 <literallayout class="monospaced">
44163 transport_filter = /some/directory/transport-filter.pl \
44164   $host $host_address $pipe_addresses
44165 </literallayout>
44166 <para>
44167 Two problems arise if you want to use more complicated expansion items to
44168 generate transport filter commands, both of which due to the fact that the
44169 command is split up <emphasis>before</emphasis> expansion.
44170 </para>
44171 <itemizedlist>
44172 <listitem>
44173 <para>
44174 If an expansion item contains white space, you must quote it, so that it is all
44175 part of the same command item. If the entire option setting is one such
44176 expansion item, you have to take care what kind of quoting you use. For
44177 example:
44178 </para>
44179 <literallayout class="monospaced">
44180 transport_filter = '/bin/cmd${if eq{$host}{a.b.c}{1}{2}}'
44181 </literallayout>
44182 <para>
44183 This runs the command <command>/bin/cmd1</command> if the host name is <emphasis>a.b.c</emphasis>, and
44184 <command>/bin/cmd2</command> otherwise. If double quotes had been used, they would have been
44185 stripped by Exim when it read the option&#x2019;s value. When the value is used, if
44186 the single quotes were missing, the line would be split into two items,
44187 <literal>/bin/cmd${if</literal> and <literal>eq{$host}{a.b.c}{1}{2}</literal>, and an error would occur when
44188 Exim tried to expand the first one.
44189 </para>
44190 </listitem>
44191 <listitem>
44192 <para>
44193 Except for the special case of <varname>$pipe_addresses</varname> that is mentioned above, an
44194 expansion cannot generate multiple arguments, or a command name followed by
44195 arguments. Consider this example:
44196 </para>
44197 <literallayout class="monospaced">
44198 transport_filter = ${lookup{$host}lsearch{/a/file}\
44199                     {$value}{/bin/cat}}
44200 </literallayout>
44201 <para>
44202 The result of the lookup is interpreted as the name of the command, even
44203 if it contains white space. The simplest way round this is to use a shell:
44204 </para>
44205 <literallayout class="monospaced">
44206 transport_filter = /bin/sh -c ${lookup{$host}lsearch{/a/file}\
44207                                {$value}{/bin/cat}}
44208 </literallayout>
44209 </listitem>
44210 </itemizedlist>
44211 <para>
44212 The filter process is run under the same uid and gid as the normal delivery.
44213 For remote deliveries this is the Exim uid/gid by default. The command should
44214 normally yield a zero return code. Transport filters are not supposed to fail.
44215 A non-zero code is taken to mean that the transport filter encountered some
44216 serious problem. Delivery of the message is deferred; the message remains on
44217 the queue and is tried again later. It is not possible to cause a message to be
44218 bounced from a transport filter.
44219 </para>
44220 <para>
44221 If a transport filter is set on an autoreply transport, the original message is
44222 passed through the filter as it is being copied into the newly generated
44223 message, which happens if the <option>return_message</option> option is set.
44224 </para>
44225 <para>
44226 <indexterm role="option">
44227 <primary><option>transport_filter_timeout</option></primary>
44228 </indexterm>
44229 </para>
44230 <informaltable frame="all">
44231 <tgroup cols="4" colsep="0" rowsep="0">
44232 <colspec colwidth="8*" align="left"/>
44233 <colspec colwidth="6*" align="center"/>
44234 <colspec colwidth="6*" align="center"/>
44235 <colspec colwidth="6*" align="right"/>
44236 <tbody>
44237 <row>
44238 <entry><option>transport_filter_timeout</option></entry>
44239 <entry>Use: <emphasis>transports</emphasis></entry>
44240 <entry>Type: <emphasis>time</emphasis></entry>
44241 <entry>Default: <emphasis>5m</emphasis></entry>
44242 </row>
44243 </tbody>
44244 </tgroup>
44245 </informaltable>
44246 <para>
44247 <indexterm role="concept">
44248 <primary>transport</primary>
44249 <secondary>filter, timeout</secondary>
44250 </indexterm>
44251 When Exim is reading the output of a transport filter, it applies a timeout
44252 that can be set by this option. Exceeding the timeout is normally treated as a
44253 temporary delivery failure. However, if a transport filter is used with a
44254 <command>pipe</command> transport, a timeout in the transport filter is treated in the same
44255 way as a timeout in the pipe command itself. By default, a timeout is a hard
44256 error, but if the <command>pipe</command> transport&#x2019;s <option>timeout_defer</option> option is set true, it
44257 becomes a temporary error.
44258 </para>
44259 <para>
44260 <indexterm role="option">
44261 <primary><option>user</option></primary>
44262 </indexterm>
44263 </para>
44264 <informaltable frame="all">
44265 <tgroup cols="4" colsep="0" rowsep="0">
44266 <colspec colwidth="8*" align="left"/>
44267 <colspec colwidth="6*" align="center"/>
44268 <colspec colwidth="6*" align="center"/>
44269 <colspec colwidth="6*" align="right"/>
44270 <tbody>
44271 <row>
44272 <entry><option>user</option></entry>
44273 <entry>Use: <emphasis>transports</emphasis></entry>
44274 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44275 <entry>Default: <emphasis>Exim user</emphasis></entry>
44276 </row>
44277 </tbody>
44278 </tgroup>
44279 </informaltable>
44280 <para>
44281 <indexterm role="concept">
44282 <primary>uid (user id)</primary>
44283 <secondary>local delivery</secondary>
44284 </indexterm>
44285 <indexterm role="concept">
44286 <primary>transport</primary>
44287 <secondary>user, specifying</secondary>
44288 </indexterm>
44289 This option specifies the user under whose uid the delivery process is to be
44290 run, overriding any uid that may have been set by the router. If the user is
44291 given as a name, the uid is looked up from the password data, and the
44292 associated group is taken as the value of the gid to be used if the <option>group</option>
44293 option is not set.
44294 </para>
44295 <para>
44296 For deliveries that use local transports, a user and group are normally
44297 specified explicitly or implicitly (for example, as a result of
44298 <option>check_local_user</option>) by the router or transport.
44299 </para>
44300 <para>
44301 <indexterm role="concept">
44302 <primary>hints database</primary>
44303 <secondary>access by remote transport</secondary>
44304 </indexterm>
44305 For remote transports, you should leave this option unset unless you really are
44306 sure you know what you are doing. When a remote transport is running, it needs
44307 to be able to access Exim&#x2019;s hints databases, because each host may have its own
44308 retry data.
44309 <indexterm role="concept" startref="IIDgenoptra1" class="endofrange"/>
44310 <indexterm role="concept" startref="IIDgenoptra2" class="endofrange"/>
44311 <indexterm role="concept" startref="IIDgenoptra3" class="endofrange"/>
44312 </para>
44313 </chapter>
44314
44315 <chapter id="CHAPbatching">
44316 <title>Address batching in local transports</title>
44317 <titleabbrev>Address batching</titleabbrev>
44318 <para>
44319 <indexterm role="concept">
44320 <primary>transport</primary>
44321 <secondary>local; address batching in</secondary>
44322 </indexterm>
44323 The only remote transport (<command>smtp</command>) is normally configured to handle more than
44324 one address at a time, so that when several addresses are routed to the same
44325 remote host, just one copy of the message is sent. Local transports, however,
44326 normally handle one address at a time. That is, a separate instance of the
44327 transport is run for each address that is routed to the transport. A separate
44328 copy of the message is delivered each time.
44329 </para>
44330 <para>
44331 <indexterm role="concept">
44332 <primary>batched local delivery</primary>
44333 </indexterm>
44334 <indexterm role="option">
44335 <primary><option>batch_max</option></primary>
44336 </indexterm>
44337 <indexterm role="option">
44338 <primary><option>batch_id</option></primary>
44339 </indexterm>
44340 In special cases, it may be desirable to handle several addresses at once in a
44341 local transport, for example:
44342 </para>
44343 <itemizedlist>
44344 <listitem>
44345 <para>
44346 In an <command>appendfile</command> transport, when storing messages in files for later
44347 delivery by some other means, a single copy of the message with multiple
44348 recipients saves space.
44349 </para>
44350 </listitem>
44351 <listitem>
44352 <para>
44353 In an <command>lmtp</command> transport, when delivering over <quote>local SMTP</quote> to some process,
44354 a single copy saves time, and is the normal way LMTP is expected to work.
44355 </para>
44356 </listitem>
44357 <listitem>
44358 <para>
44359 In a <command>pipe</command> transport, when passing the message
44360 to a scanner program or
44361 to some other delivery mechanism such as UUCP, multiple recipients may be
44362 acceptable.
44363 </para>
44364 </listitem>
44365 </itemizedlist>
44366 <para>
44367 These three local transports all have the same options for controlling multiple
44368 (<quote>batched</quote>) deliveries, namely <option>batch_max</option> and <option>batch_id</option>. To save
44369 repeating the information for each transport, these options are described here.
44370 </para>
44371 <para>
44372 The <option>batch_max</option> option specifies the maximum number of addresses that can be
44373 delivered together in a single run of the transport. Its default value is one
44374 (no batching). When more than one address is routed to a transport that has a
44375 <option>batch_max</option> value greater than one, the addresses are delivered in a batch
44376 (that is, in a single run of the transport with multiple recipients), subject
44377 to certain conditions:
44378 </para>
44379 <itemizedlist>
44380 <listitem>
44381 <para>
44382 <indexterm role="variable">
44383 <primary><varname>$local_part</varname></primary>
44384 </indexterm>
44385 If any of the transport&#x2019;s options contain a reference to <varname>$local_part</varname>, no
44386 batching is possible.
44387 </para>
44388 </listitem>
44389 <listitem>
44390 <para>
44391 <indexterm role="variable">
44392 <primary><varname>$domain</varname></primary>
44393 </indexterm>
44394 If any of the transport&#x2019;s options contain a reference to <varname>$domain</varname>, only
44395 addresses with the same domain are batched.
44396 </para>
44397 </listitem>
44398 <listitem>
44399 <para>
44400 <indexterm role="concept">
44401 <primary>customizing</primary>
44402 <secondary>batching condition</secondary>
44403 </indexterm>
44404 If <option>batch_id</option> is set, it is expanded for each address, and only those
44405 addresses with the same expanded value are batched. This allows you to specify
44406 customized batching conditions. Failure of the expansion for any reason,
44407 including forced failure, disables batching, but it does not stop the delivery
44408 from taking place.
44409 </para>
44410 </listitem>
44411 <listitem>
44412 <para>
44413 Batched addresses must also have the same errors address (where to send
44414 delivery errors), the same header additions and removals, the same user and
44415 group for the transport, and if a host list is present, the first host must
44416 be the same.
44417 </para>
44418 </listitem>
44419 </itemizedlist>
44420 <para>
44421 In the case of the <command>appendfile</command> and <command>pipe</command> transports, batching applies
44422 both when the file or pipe command is specified in the transport, and when it
44423 is specified by a <command>redirect</command> router, but all the batched addresses must of
44424 course be routed to the same file or pipe command. These two transports have an
44425 option called <option>use_bsmtp</option>, which causes them to deliver the message in
44426 <quote>batched SMTP</quote> format, with the envelope represented as SMTP commands. The
44427 <option>check_string</option> and <option>escape_string</option> options are forced to the values
44428 </para>
44429 <literallayout class="monospaced">
44430 check_string = "."
44431 escape_string = ".."
44432 </literallayout>
44433 <para>
44434 when batched SMTP is in use. A full description of the batch SMTP mechanism is
44435 given in section <xref linkend="SECTbatchSMTP"/>. The <command>lmtp</command> transport does not have a
44436 <option>use_bsmtp</option> option, because it always delivers using the SMTP protocol.
44437 </para>
44438 <para>
44439 <indexterm role="concept">
44440 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
44441 </indexterm>
44442 If the generic <option>envelope_to_add</option> option is set for a batching transport, the
44443 <emphasis>Envelope-to:</emphasis> header that is added to the message contains all the addresses
44444 that are being processed together. If you are using a batching <command>appendfile</command>
44445 transport without <option>use_bsmtp</option>, the only way to preserve the recipient
44446 addresses is to set the <option>envelope_to_add</option> option.
44447 </para>
44448 <para>
44449 <indexterm role="concept">
44450 <primary><command>pipe</command> transport</primary>
44451 <secondary>with multiple addresses</secondary>
44452 </indexterm>
44453 <indexterm role="variable">
44454 <primary><varname>$pipe_addresses</varname></primary>
44455 </indexterm>
44456 If you are using a <command>pipe</command> transport without BSMTP, and setting the
44457 transport&#x2019;s <option>command</option> option, you can include <varname>$pipe_addresses</varname> as part of
44458 the command. This is not a true variable; it is a bit of magic that causes each
44459 of the recipient addresses to be inserted into the command as a separate
44460 argument. This provides a way of accessing all the addresses that are being
44461 delivered in the batch. <emphasis role="bold">Note:</emphasis> This is not possible for pipe commands that
44462 are specified by a <command>redirect</command> router.
44463 </para>
44464 </chapter>
44465
44466 <chapter id="CHAPappendfile">
44467 <title>The appendfile transport</title>
44468 <para>
44469 <indexterm role="concept" id="IIDapptra1" class="startofrange">
44470 <primary><command>appendfile</command> transport</primary>
44471 </indexterm>
44472 <indexterm role="concept" id="IIDapptra2" class="startofrange">
44473 <primary>transports</primary>
44474 <secondary><command>appendfile</command></secondary>
44475 </indexterm>
44476 <indexterm role="concept">
44477 <primary>directory creation</primary>
44478 </indexterm>
44479 <indexterm role="concept">
44480 <primary>creating directories</primary>
44481 </indexterm>
44482 The <command>appendfile</command> transport delivers a message by appending it to an existing
44483 file, or by creating an entirely new file in a specified directory. Single
44484 files to which messages are appended can be in the traditional Unix mailbox
44485 format, or optionally in the MBX format supported by the Pine MUA and
44486 University of Washington IMAP daemon, <emphasis>inter alia</emphasis>. When each message is
44487 being delivered as a separate file, <quote>maildir</quote> format can optionally be used
44488 to give added protection against failures that happen part-way through the
44489 delivery. A third form of separate-file delivery known as <quote>mailstore</quote> is also
44490 supported. For all file formats, Exim attempts to create as many levels of
44491 directory as necessary, provided that <option>create_directory</option> is set.
44492 </para>
44493 <para>
44494 The code for the optional formats is not included in the Exim binary by
44495 default. It is necessary to set SUPPORT_MBX, SUPPORT_MAILDIR and/or
44496 SUPPORT_MAILSTORE in <filename>Local/Makefile</filename> to have the appropriate code
44497 included.
44498 </para>
44499 <para>
44500 <indexterm role="concept">
44501 <primary>quota</primary>
44502 <secondary>system</secondary>
44503 </indexterm>
44504 Exim recognizes system quota errors, and generates an appropriate message. Exim
44505 also supports its own quota control within the transport, for use when the
44506 system facility is unavailable or cannot be used for some reason.
44507 </para>
44508 <para>
44509 If there is an error while appending to a file (for example, quota exceeded or
44510 partition filled), Exim attempts to reset the file&#x2019;s length and last
44511 modification time back to what they were before. If there is an error while
44512 creating an entirely new file, the new file is removed.
44513 </para>
44514 <para>
44515 Before appending to a file, a number of security checks are made, and the
44516 file is locked. A detailed description is given below, after the list of
44517 private options.
44518 </para>
44519 <para>
44520 The <command>appendfile</command> transport is most commonly used for local deliveries to
44521 users&#x2019; mailboxes. However, it can also be used as a pseudo-remote transport for
44522 putting messages into files for remote delivery by some means other than Exim.
44523 <quote>Batch SMTP</quote> format is often used in this case (see the <option>use_bsmtp</option>
44524 option).
44525 </para>
44526 <section id="SECTfildiropt">
44527 <title>The file and directory options</title>
44528 <para>
44529 The <option>file</option> option specifies a single file, to which the message is appended;
44530 the <option>directory</option> option specifies a directory, in which a new file containing
44531 the message is created. Only one of these two options can be set, and for
44532 normal deliveries to mailboxes, one of them <emphasis>must</emphasis> be set.
44533 </para>
44534 <para>
44535 <indexterm role="variable">
44536 <primary><varname>$address_file</varname></primary>
44537 </indexterm>
44538 <indexterm role="variable">
44539 <primary><varname>$local_part</varname></primary>
44540 </indexterm>
44541 However, <command>appendfile</command> is also used for delivering messages to files or
44542 directories whose names (or parts of names) are obtained from alias,
44543 forwarding, or filtering operations (for example, a <option>save</option> command in a
44544 user&#x2019;s Exim filter). When such a transport is running, <varname>$local_part</varname> contains
44545 the local part that was aliased or forwarded, and <varname>$address_file</varname> contains the
44546 name (or partial name) of the file or directory generated by the redirection
44547 operation. There are two cases:
44548 </para>
44549 <itemizedlist>
44550 <listitem>
44551 <para>
44552 If neither <option>file</option> nor <option>directory</option> is set, the redirection operation
44553 must specify an absolute path (one that begins with <literal>/</literal>). This is the most
44554 common case when users with local accounts use filtering to sort mail into
44555 different folders. See for example, the <command>address_file</command> transport in the
44556 default configuration. If the path ends with a slash, it is assumed to be the
44557 name of a directory. A delivery to a directory can also be forced by setting
44558 <option>maildir_format</option> or <option>mailstore_format</option>.
44559 </para>
44560 </listitem>
44561 <listitem>
44562 <para>
44563 If <option>file</option> or <option>directory</option> is set for a delivery from a redirection, it is
44564 used to determine the file or directory name for the delivery. Normally, the
44565 contents of <varname>$address_file</varname> are used in some way in the string expansion.
44566 </para>
44567 </listitem>
44568 </itemizedlist>
44569 <para>
44570 If the <option>create_file</option> option is set to a path which
44571 matches (see the option definition below for details)
44572 a file or directory name
44573 for the delivery, that name becomes de-tainted.
44574 </para>
44575 <para>
44576 <indexterm role="concept">
44577 <primary>tainted data</primary>
44578 <secondary>in filenames</secondary>
44579 </indexterm>
44580 <indexterm role="concept">
44581 <primary>appendfile</primary>
44582 <secondary>tainted data</secondary>
44583 </indexterm>
44584 Tainted data may not be used for a file or directory name.
44585 This means that, for instance, <varname>$local_part</varname> cannot be used directly
44586 as a component of a path.  It can however be used as the key for a lookup
44587 which returns a path (or component).
44588 </para>
44589 <para>
44590 <indexterm role="concept">
44591 <primary>Sieve filter</primary>
44592 <secondary>configuring <command>appendfile</command></secondary>
44593 </indexterm>
44594 <indexterm role="concept">
44595 <primary>Sieve filter</primary>
44596 <secondary>relative mailbox path handling</secondary>
44597 </indexterm>
44598 As an example of the second case, consider an environment where users do not
44599 have home directories. They may be permitted to use Exim filter commands of the
44600 form:
44601 </para>
44602 <literallayout class="monospaced">
44603 save folder23
44604 </literallayout>
44605 <para>
44606 or Sieve filter commands of the form:
44607 </para>
44608 <literallayout class="monospaced">
44609 require "fileinto";
44610 fileinto "folder23";
44611 </literallayout>
44612 <para>
44613 In this situation, the expansion of <option>file</option> or <option>directory</option> in the transport
44614 must transform the relative path into an appropriate absolute filename. In the
44615 case of Sieve filters, the name <emphasis>inbox</emphasis> must be handled. It is the name that
44616 is used as a result of a <quote>keep</quote> action in the filter. This example shows one
44617 way of handling this requirement:
44618 </para>
44619 <literallayout class="monospaced">
44620 file = ${if eq{$address_file}{inbox} \
44621             {/var/mail/$local_part_data} \
44622             {${if eq{${substr_0_1:$address_file}}{/} \
44623                   {$address_file} \
44624                   {$home/mail/$address_file} \
44625             }} \
44626        }
44627 </literallayout>
44628 <para>
44629 With this setting of <option>file</option>, <emphasis>inbox</emphasis> refers to the standard mailbox
44630 location, absolute paths are used without change, and other folders are in the
44631 <filename>mail</filename> directory within the home directory.
44632 </para>
44633 <para>
44634 <emphasis role="bold">Note 1</emphasis>: While processing an Exim filter, a relative path such as
44635 <filename>folder23</filename> is turned into an absolute path if a home directory is known to
44636 the router. In particular, this is the case if <option>check_local_user</option> is set. If
44637 you want to prevent this happening at routing time, you can set
44638 <option>router_home_directory</option> empty. This forces the router to pass the relative
44639 path to the transport.
44640 </para>
44641 <para>
44642 <emphasis role="bold">Note 2</emphasis>: An absolute path in <varname>$address_file</varname> is not treated specially;
44643 the <option>file</option> or <option>directory</option> option is still used if it is set.
44644 </para>
44645 </section>
44646 <section id="SECID134">
44647 <title>Private options for appendfile</title>
44648 <para>
44649 <indexterm role="concept">
44650 <primary>options</primary>
44651 <secondary><command>appendfile</command> transport</secondary>
44652 </indexterm>
44653 </para>
44654 <para>
44655 <indexterm role="option">
44656 <primary><option>allow_fifo</option></primary>
44657 </indexterm>
44658 </para>
44659 <informaltable frame="all">
44660 <tgroup cols="4" colsep="0" rowsep="0">
44661 <colspec colwidth="8*" align="left"/>
44662 <colspec colwidth="6*" align="center"/>
44663 <colspec colwidth="6*" align="center"/>
44664 <colspec colwidth="6*" align="right"/>
44665 <tbody>
44666 <row>
44667 <entry><option>allow_fifo</option></entry>
44668 <entry>Use: <emphasis>appendfile</emphasis></entry>
44669 <entry>Type: <emphasis>boolean</emphasis></entry>
44670 <entry>Default: <emphasis>false</emphasis></entry>
44671 </row>
44672 </tbody>
44673 </tgroup>
44674 </informaltable>
44675 <para>
44676 <indexterm role="concept">
44677 <primary>fifo (named pipe)</primary>
44678 </indexterm>
44679 <indexterm role="concept">
44680 <primary>named pipe (fifo)</primary>
44681 </indexterm>
44682 <indexterm role="concept">
44683 <primary>pipe</primary>
44684 <secondary>named (fifo)</secondary>
44685 </indexterm>
44686 Setting this option permits delivery to named pipes (FIFOs) as well as to
44687 regular files. If no process is reading the named pipe at delivery time, the
44688 delivery is deferred.
44689 </para>
44690 <para>
44691 <indexterm role="option">
44692 <primary><option>allow_symlink</option></primary>
44693 </indexterm>
44694 </para>
44695 <informaltable frame="all">
44696 <tgroup cols="4" colsep="0" rowsep="0">
44697 <colspec colwidth="8*" align="left"/>
44698 <colspec colwidth="6*" align="center"/>
44699 <colspec colwidth="6*" align="center"/>
44700 <colspec colwidth="6*" align="right"/>
44701 <tbody>
44702 <row>
44703 <entry><option>allow_symlink</option></entry>
44704 <entry>Use: <emphasis>appendfile</emphasis></entry>
44705 <entry>Type: <emphasis>boolean</emphasis></entry>
44706 <entry>Default: <emphasis>false</emphasis></entry>
44707 </row>
44708 </tbody>
44709 </tgroup>
44710 </informaltable>
44711 <para>
44712 <indexterm role="concept">
44713 <primary>symbolic link</primary>
44714 <secondary>to mailbox</secondary>
44715 </indexterm>
44716 <indexterm role="concept">
44717 <primary>mailbox</primary>
44718 <secondary>symbolic link</secondary>
44719 </indexterm>
44720 By default, <command>appendfile</command> will not deliver if the path name for the file is
44721 that of a symbolic link. Setting this option relaxes that constraint, but there
44722 are security issues involved in the use of symbolic links. Be sure you know
44723 what you are doing if you set this. Details of exactly what this option affects
44724 are included in the discussion which follows this list of options.
44725 </para>
44726 <para>
44727 <indexterm role="option">
44728 <primary><option>batch_id</option></primary>
44729 </indexterm>
44730 </para>
44731 <informaltable frame="all">
44732 <tgroup cols="4" colsep="0" rowsep="0">
44733 <colspec colwidth="8*" align="left"/>
44734 <colspec colwidth="6*" align="center"/>
44735 <colspec colwidth="6*" align="center"/>
44736 <colspec colwidth="6*" align="right"/>
44737 <tbody>
44738 <row>
44739 <entry><option>batch_id</option></entry>
44740 <entry>Use: <emphasis>appendfile</emphasis></entry>
44741 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
44742 <entry>Default: <emphasis>unset</emphasis></entry>
44743 </row>
44744 </tbody>
44745 </tgroup>
44746 </informaltable>
44747 <para>
44748 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44749 However, batching is automatically disabled for <command>appendfile</command> deliveries that
44750 happen as a result of forwarding or aliasing or other redirection directly to a
44751 file.
44752 </para>
44753 <para>
44754 <indexterm role="option">
44755 <primary><option>batch_max</option></primary>
44756 </indexterm>
44757 </para>
44758 <informaltable frame="all">
44759 <tgroup cols="4" colsep="0" rowsep="0">
44760 <colspec colwidth="8*" align="left"/>
44761 <colspec colwidth="6*" align="center"/>
44762 <colspec colwidth="6*" align="center"/>
44763 <colspec colwidth="6*" align="right"/>
44764 <tbody>
44765 <row>
44766 <entry><option>batch_max</option></entry>
44767 <entry>Use: <emphasis>appendfile</emphasis></entry>
44768 <entry>Type: <emphasis>integer</emphasis></entry>
44769 <entry>Default: <emphasis>1</emphasis></entry>
44770 </row>
44771 </tbody>
44772 </tgroup>
44773 </informaltable>
44774 <para>
44775 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
44776 </para>
44777 <para>
44778 <indexterm role="option">
44779 <primary><option>check_group</option></primary>
44780 </indexterm>
44781 </para>
44782 <informaltable frame="all">
44783 <tgroup cols="4" colsep="0" rowsep="0">
44784 <colspec colwidth="8*" align="left"/>
44785 <colspec colwidth="6*" align="center"/>
44786 <colspec colwidth="6*" align="center"/>
44787 <colspec colwidth="6*" align="right"/>
44788 <tbody>
44789 <row>
44790 <entry><option>check_group</option></entry>
44791 <entry>Use: <emphasis>appendfile</emphasis></entry>
44792 <entry>Type: <emphasis>boolean</emphasis></entry>
44793 <entry>Default: <emphasis>false</emphasis></entry>
44794 </row>
44795 </tbody>
44796 </tgroup>
44797 </informaltable>
44798 <para>
44799 When this option is set, the group owner of the file defined by the <option>file</option>
44800 option is checked to see that it is the same as the group under which the
44801 delivery process is running. The default setting is false because the default
44802 file mode is 0600, which means that the group is irrelevant.
44803 </para>
44804 <para>
44805 <indexterm role="option">
44806 <primary><option>check_owner</option></primary>
44807 </indexterm>
44808 </para>
44809 <informaltable frame="all">
44810 <tgroup cols="4" colsep="0" rowsep="0">
44811 <colspec colwidth="8*" align="left"/>
44812 <colspec colwidth="6*" align="center"/>
44813 <colspec colwidth="6*" align="center"/>
44814 <colspec colwidth="6*" align="right"/>
44815 <tbody>
44816 <row>
44817 <entry><option>check_owner</option></entry>
44818 <entry>Use: <emphasis>appendfile</emphasis></entry>
44819 <entry>Type: <emphasis>boolean</emphasis></entry>
44820 <entry>Default: <emphasis>true</emphasis></entry>
44821 </row>
44822 </tbody>
44823 </tgroup>
44824 </informaltable>
44825 <para>
44826 When this option is set, the owner of the file defined by the <option>file</option> option
44827 is checked to ensure that it is the same as the user under which the delivery
44828 process is running.
44829 </para>
44830 <para>
44831 <indexterm role="option">
44832 <primary><option>check_string</option></primary>
44833 </indexterm>
44834 </para>
44835 <informaltable frame="all">
44836 <tgroup cols="4" colsep="0" rowsep="0">
44837 <colspec colwidth="8*" align="left"/>
44838 <colspec colwidth="6*" align="center"/>
44839 <colspec colwidth="6*" align="center"/>
44840 <colspec colwidth="6*" align="right"/>
44841 <tbody>
44842 <row>
44843 <entry><option>check_string</option></entry>
44844 <entry>Use: <emphasis>appendfile</emphasis></entry>
44845 <entry>Type: <emphasis>string</emphasis></entry>
44846 <entry>Default: <emphasis>see below</emphasis></entry>
44847 </row>
44848 </tbody>
44849 </tgroup>
44850 </informaltable>
44851 <para>
44852 <indexterm role="concept">
44853 <primary><quote>From</quote> line</primary>
44854 </indexterm>
44855 As <command>appendfile</command> writes the message, the start of each line is tested for
44856 matching <option>check_string</option>, and if it does, the initial matching characters are
44857 replaced by the contents of <option>escape_string</option>. The value of <option>check_string</option> is
44858 a literal string, not a regular expression, and the case of any letters it
44859 contains is significant.
44860 </para>
44861 <para>
44862 If <option>use_bsmtp</option> is set the values of <option>check_string</option> and <option>escape_string</option>
44863 are forced to <quote>.</quote> and <quote>..</quote> respectively, and any settings in the
44864 configuration are ignored. Otherwise, they default to <quote>From&nbsp;</quote> and
44865 <quote>&gt;From&nbsp;</quote> when the <option>file</option> option is set, and unset when any of the
44866 <option>directory</option>, <option>maildir</option>, or <option>mailstore</option> options are set.
44867 </para>
44868 <para>
44869 The default settings, along with <option>message_prefix</option> and <option>message_suffix</option>, are
44870 suitable for traditional <quote>BSD</quote> mailboxes, where a line beginning with
44871 <quote>From&nbsp;</quote> indicates the start of a new message. All four options need changing
44872 if another format is used. For example, to deliver to mailboxes in MMDF format:
44873 <indexterm role="concept">
44874 <primary>MMDF format mailbox</primary>
44875 </indexterm>
44876 <indexterm role="concept">
44877 <primary>mailbox</primary>
44878 <secondary>MMDF format</secondary>
44879 </indexterm>
44880 </para>
44881 <literallayout class="monospaced">
44882 check_string = "\1\1\1\1\n"
44883 escape_string = "\1\1\1\1 \n"
44884 message_prefix = "\1\1\1\1\n"
44885 message_suffix = "\1\1\1\1\n"
44886 </literallayout>
44887 <para>
44888 <indexterm role="option">
44889 <primary><option>create_directory</option></primary>
44890 </indexterm>
44891 </para>
44892 <informaltable frame="all">
44893 <tgroup cols="4" colsep="0" rowsep="0">
44894 <colspec colwidth="8*" align="left"/>
44895 <colspec colwidth="6*" align="center"/>
44896 <colspec colwidth="6*" align="center"/>
44897 <colspec colwidth="6*" align="right"/>
44898 <tbody>
44899 <row>
44900 <entry><option>create_directory</option></entry>
44901 <entry>Use: <emphasis>appendfile</emphasis></entry>
44902 <entry>Type: <emphasis>boolean</emphasis></entry>
44903 <entry>Default: <emphasis>true</emphasis></entry>
44904 </row>
44905 </tbody>
44906 </tgroup>
44907 </informaltable>
44908 <para>
44909 <indexterm role="concept">
44910 <primary>directory creation</primary>
44911 </indexterm>
44912 When this option is true, Exim attempts to create any missing superior
44913 directories for the file that it is about to write. A created directory&#x2019;s mode
44914 is given by the <option>directory_mode</option> option.
44915 </para>
44916 <para>
44917 The group ownership of a newly created directory is highly dependent on the
44918 operating system (and possibly the file system) that is being used. For
44919 example, in Solaris, if the parent directory has the setgid bit set, its group
44920 is propagated to the child; if not, the currently set group is used. However,
44921 in FreeBSD, the parent&#x2019;s group is always used.
44922 </para>
44923 <para>
44924 <indexterm role="option">
44925 <primary><option>create_file</option></primary>
44926 </indexterm>
44927 </para>
44928 <informaltable frame="all">
44929 <tgroup cols="4" colsep="0" rowsep="0">
44930 <colspec colwidth="8*" align="left"/>
44931 <colspec colwidth="6*" align="center"/>
44932 <colspec colwidth="6*" align="center"/>
44933 <colspec colwidth="6*" align="right"/>
44934 <tbody>
44935 <row>
44936 <entry><option>create_file</option></entry>
44937 <entry>Use: <emphasis>appendfile</emphasis></entry>
44938 <entry>Type: <emphasis>string</emphasis></entry>
44939 <entry>Default: <emphasis>anywhere</emphasis></entry>
44940 </row>
44941 </tbody>
44942 </tgroup>
44943 </informaltable>
44944 <para>
44945 This option constrains the location of files and directories that are created
44946 by this transport. It applies to files defined by the <option>file</option> option and
44947 directories defined by the <option>directory</option> option. In the case of maildir
44948 delivery, it applies to the top level directory, not the maildir directories
44949 beneath.
44950 </para>
44951 <para>
44952 The option must be set to one of the words <quote>anywhere</quote>, <quote>inhome</quote>, or
44953 <quote>belowhome</quote>, or to an absolute path.
44954 </para>
44955 <para>
44956 In the second and third cases, a home directory must have been
44957 set for the transport, and the file or directory being created must
44958 reside within it.
44959 The "belowhome" checking additionally checks for attempts to use "../"
44960 to evade the testing.
44961 This option is not useful when an explicit filename is
44962 given for normal mailbox deliveries. It is intended for the case when filenames
44963 are generated from users&#x2019; <filename>.forward</filename> files. These are usually handled
44964 by an <command>appendfile</command> transport called <option>address_file</option>. See also
44965 <option>file_must_exist</option>.
44966 </para>
44967 <para>
44968 In the fourth case,
44969 the value given for this option must be an absolute path for an
44970 existing directory.
44971 The value is used for checking instead of a home directory;
44972 checking is done in "belowhome" mode.
44973 </para>
44974 <para>
44975 <indexterm role="concept">
44976 <primary>tainted data</primary>
44977 <secondary>de-tainting</secondary>
44978 </indexterm>
44979 <indexterm role="concept">
44980 <primary>de-tainting</primary>
44981 <secondary>using appendfile create_file option</secondary>
44982 </indexterm>
44983 If "belowhome" checking is used, the file or directory path
44984 becomes de-tainted.
44985 </para>
44986 <para>
44987 <indexterm role="option">
44988 <primary><option>directory</option></primary>
44989 </indexterm>
44990 </para>
44991 <informaltable frame="all">
44992 <tgroup cols="4" colsep="0" rowsep="0">
44993 <colspec colwidth="8*" align="left"/>
44994 <colspec colwidth="6*" align="center"/>
44995 <colspec colwidth="6*" align="center"/>
44996 <colspec colwidth="6*" align="right"/>
44997 <tbody>
44998 <row>
44999 <entry><option>directory</option></entry>
45000 <entry>Use: <emphasis>appendfile</emphasis></entry>
45001 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45002 <entry>Default: <emphasis>unset</emphasis></entry>
45003 </row>
45004 </tbody>
45005 </tgroup>
45006 </informaltable>
45007 <para>
45008 This option is mutually exclusive with the <option>file</option> option, but one of <option>file</option>
45009 or <option>directory</option> must be set, unless the delivery is the direct result of a
45010 redirection (see section <xref linkend="SECTfildiropt"/>).
45011 </para>
45012 <para>
45013 When <option>directory</option> is set, the string is expanded, and the message is delivered
45014 into a new file or files in or below the given directory, instead of being
45015 appended to a single mailbox file. A number of different formats are provided
45016 (see <option>maildir_format</option> and <option>mailstore_format</option>), and see section
45017 <xref linkend="SECTopdir"/> for further details of this form of delivery.
45018 </para>
45019 <para>
45020 The result of expansion must not be tainted, unless the <option>create_file</option> option
45021 specifies a path.
45022 </para>
45023 <para>
45024 <indexterm role="option">
45025 <primary><option>directory_file</option></primary>
45026 </indexterm>
45027 </para>
45028 <informaltable frame="all">
45029 <tgroup cols="4" colsep="0" rowsep="0">
45030 <colspec colwidth="8*" align="left"/>
45031 <colspec colwidth="6*" align="center"/>
45032 <colspec colwidth="6*" align="center"/>
45033 <colspec colwidth="6*" align="right"/>
45034 <tbody>
45035 <row>
45036 <entry><option>directory_file</option></entry>
45037 <entry>Use: <emphasis>appendfile</emphasis></entry>
45038 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45039 <entry>Default: <emphasis>see below</emphasis></entry>
45040 </row>
45041 </tbody>
45042 </tgroup>
45043 </informaltable>
45044 <para>
45045 <indexterm role="concept">
45046 <primary>base62</primary>
45047 </indexterm>
45048 <indexterm role="variable">
45049 <primary><varname>$inode</varname></primary>
45050 </indexterm>
45051 When <option>directory</option> is set, but neither <option>maildir_format</option> nor
45052 <option>mailstore_format</option> is set, <command>appendfile</command> delivers each message into a file
45053 whose name is obtained by expanding this string. The default value is:
45054 </para>
45055 <literallayout class="monospaced">
45056 q${base62:$tod_epoch}-$inode
45057 </literallayout>
45058 <para>
45059 This generates a unique name from the current time, in base 62 form, and the
45060 inode of the file. The variable <varname>$inode</varname> is available only when expanding this
45061 option.
45062 </para>
45063 <para>
45064 <indexterm role="option">
45065 <primary><option>directory_mode</option></primary>
45066 </indexterm>
45067 </para>
45068 <informaltable frame="all">
45069 <tgroup cols="4" colsep="0" rowsep="0">
45070 <colspec colwidth="8*" align="left"/>
45071 <colspec colwidth="6*" align="center"/>
45072 <colspec colwidth="6*" align="center"/>
45073 <colspec colwidth="6*" align="right"/>
45074 <tbody>
45075 <row>
45076 <entry><option>directory_mode</option></entry>
45077 <entry>Use: <emphasis>appendfile</emphasis></entry>
45078 <entry>Type: <emphasis>octal integer</emphasis></entry>
45079 <entry>Default: <emphasis>0700</emphasis></entry>
45080 </row>
45081 </tbody>
45082 </tgroup>
45083 </informaltable>
45084 <para>
45085 If <command>appendfile</command> creates any directories as a result of the
45086 <option>create_directory</option> option, their mode is specified by this option.
45087 </para>
45088 <para>
45089 <indexterm role="option">
45090 <primary><option>escape_string</option></primary>
45091 </indexterm>
45092 </para>
45093 <informaltable frame="all">
45094 <tgroup cols="4" colsep="0" rowsep="0">
45095 <colspec colwidth="8*" align="left"/>
45096 <colspec colwidth="6*" align="center"/>
45097 <colspec colwidth="6*" align="center"/>
45098 <colspec colwidth="6*" align="right"/>
45099 <tbody>
45100 <row>
45101 <entry><option>escape_string</option></entry>
45102 <entry>Use: <emphasis>appendfile</emphasis></entry>
45103 <entry>Type: <emphasis>string</emphasis></entry>
45104 <entry>Default: <emphasis>see description</emphasis></entry>
45105 </row>
45106 </tbody>
45107 </tgroup>
45108 </informaltable>
45109 <para>
45110 See <option>check_string</option> above.
45111 </para>
45112 <para>
45113 <indexterm role="option">
45114 <primary><option>file</option></primary>
45115 </indexterm>
45116 </para>
45117 <informaltable frame="all">
45118 <tgroup cols="4" colsep="0" rowsep="0">
45119 <colspec colwidth="8*" align="left"/>
45120 <colspec colwidth="6*" align="center"/>
45121 <colspec colwidth="6*" align="center"/>
45122 <colspec colwidth="6*" align="right"/>
45123 <tbody>
45124 <row>
45125 <entry><option>file</option></entry>
45126 <entry>Use: <emphasis>appendfile</emphasis></entry>
45127 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45128 <entry>Default: <emphasis>unset</emphasis></entry>
45129 </row>
45130 </tbody>
45131 </tgroup>
45132 </informaltable>
45133 <para>
45134 This option is mutually exclusive with the <option>directory</option> option, but one of
45135 <option>file</option> or <option>directory</option> must be set, unless the delivery is the direct result
45136 of a redirection (see section <xref linkend="SECTfildiropt"/>). The <option>file</option> option
45137 specifies a single file, to which the message is appended. One or more of
45138 <option>use_fcntl_lock</option>, <option>use_flock_lock</option>, or <option>use_lockfile</option> must be set with
45139 <option>file</option>.
45140 </para>
45141 <para>
45142 The result of expansion must not be tainted, unless the <option>create_file</option> option
45143 specifies a path.
45144 </para>
45145 <para>
45146 <indexterm role="concept">
45147 <primary>NFS</primary>
45148 <secondary>lock file</secondary>
45149 </indexterm>
45150 <indexterm role="concept">
45151 <primary>locking files</primary>
45152 </indexterm>
45153 <indexterm role="concept">
45154 <primary>lock files</primary>
45155 </indexterm>
45156 If you are using more than one host to deliver over NFS into the same
45157 mailboxes, you should always use lock files.
45158 </para>
45159 <para>
45160 The string value is expanded for each delivery, and must yield an absolute
45161 path. The most common settings of this option are variations on one of these
45162 examples:
45163 </para>
45164 <literallayout class="monospaced">
45165 file = /var/spool/mail/$local_part_data
45166 file = /home/$local_part_data/inbox
45167 file = $home/inbox
45168 </literallayout>
45169 <para>
45170 <indexterm role="concept">
45171 <primary><quote>sticky</quote> bit</primary>
45172 </indexterm>
45173 In the first example, all deliveries are done into the same directory. If Exim
45174 is configured to use lock files (see <option>use_lockfile</option> below) it must be able to
45175 create a file in the directory, so the <quote>sticky</quote> bit must be turned on for
45176 deliveries to be possible, or alternatively the <option>group</option> option can be used to
45177 run the delivery under a group id which has write access to the directory.
45178 </para>
45179 <para>
45180 <indexterm role="option">
45181 <primary><option>file_format</option></primary>
45182 </indexterm>
45183 </para>
45184 <informaltable frame="all">
45185 <tgroup cols="4" colsep="0" rowsep="0">
45186 <colspec colwidth="8*" align="left"/>
45187 <colspec colwidth="6*" align="center"/>
45188 <colspec colwidth="6*" align="center"/>
45189 <colspec colwidth="6*" align="right"/>
45190 <tbody>
45191 <row>
45192 <entry><option>file_format</option></entry>
45193 <entry>Use: <emphasis>appendfile</emphasis></entry>
45194 <entry>Type: <emphasis>string</emphasis></entry>
45195 <entry>Default: <emphasis>unset</emphasis></entry>
45196 </row>
45197 </tbody>
45198 </tgroup>
45199 </informaltable>
45200 <para>
45201 <indexterm role="concept">
45202 <primary>file</primary>
45203 <secondary>mailbox; checking existing format</secondary>
45204 </indexterm>
45205 This option requests the transport to check the format of an existing file
45206 before adding to it. The check consists of matching a specific string at the
45207 start of the file. The value of the option consists of an even number of
45208 colon-separated strings. The first of each pair is the test string, and the
45209 second is the name of a transport. If the transport associated with a matched
45210 string is not the current transport, control is passed over to the other
45211 transport. For example, suppose the standard <command>local_delivery</command> transport has
45212 this added to it:
45213 </para>
45214 <literallayout class="monospaced">
45215 file_format = "From       : local_delivery :\
45216                \1\1\1\1\n : local_mmdf_delivery"
45217 </literallayout>
45218 <para>
45219 Mailboxes that begin with <quote>From</quote> are still handled by this transport, but if
45220 a mailbox begins with four binary ones followed by a newline, control is passed
45221 to a transport called <option>local_mmdf_delivery</option>, which presumably is configured
45222 to do the delivery in MMDF format. If a mailbox does not exist or is empty, it
45223 is assumed to match the current transport. If the start of a mailbox doesn&#x2019;t
45224 match any string, or if the transport named for a given string is not defined,
45225 delivery is deferred.
45226 </para>
45227 <para>
45228 <indexterm role="option">
45229 <primary><option>file_must_exist</option></primary>
45230 </indexterm>
45231 </para>
45232 <informaltable frame="all">
45233 <tgroup cols="4" colsep="0" rowsep="0">
45234 <colspec colwidth="8*" align="left"/>
45235 <colspec colwidth="6*" align="center"/>
45236 <colspec colwidth="6*" align="center"/>
45237 <colspec colwidth="6*" align="right"/>
45238 <tbody>
45239 <row>
45240 <entry><option>file_must_exist</option></entry>
45241 <entry>Use: <emphasis>appendfile</emphasis></entry>
45242 <entry>Type: <emphasis>boolean</emphasis></entry>
45243 <entry>Default: <emphasis>false</emphasis></entry>
45244 </row>
45245 </tbody>
45246 </tgroup>
45247 </informaltable>
45248 <para>
45249 If this option is true, the file specified by the <option>file</option> option must exist.
45250 A temporary error occurs if it does not, causing delivery to be deferred.
45251 If this option is false, the file is created if it does not exist.
45252 </para>
45253 <para>
45254 <indexterm role="option">
45255 <primary><option>lock_fcntl_timeout</option></primary>
45256 </indexterm>
45257 </para>
45258 <informaltable frame="all">
45259 <tgroup cols="4" colsep="0" rowsep="0">
45260 <colspec colwidth="8*" align="left"/>
45261 <colspec colwidth="6*" align="center"/>
45262 <colspec colwidth="6*" align="center"/>
45263 <colspec colwidth="6*" align="right"/>
45264 <tbody>
45265 <row>
45266 <entry><option>lock_fcntl_timeout</option></entry>
45267 <entry>Use: <emphasis>appendfile</emphasis></entry>
45268 <entry>Type: <emphasis>time</emphasis></entry>
45269 <entry>Default: <emphasis>0s</emphasis></entry>
45270 </row>
45271 </tbody>
45272 </tgroup>
45273 </informaltable>
45274 <para>
45275 <indexterm role="concept">
45276 <primary>timeout</primary>
45277 <secondary>mailbox locking</secondary>
45278 </indexterm>
45279 <indexterm role="concept">
45280 <primary>mailbox</primary>
45281 <secondary>locking, blocking and non-blocking</secondary>
45282 </indexterm>
45283 <indexterm role="concept">
45284 <primary>locking files</primary>
45285 </indexterm>
45286 By default, the <command>appendfile</command> transport uses non-blocking calls to <function>fcntl()</function>
45287 when locking an open mailbox file. If the call fails, the delivery process
45288 sleeps for <option>lock_interval</option> and tries again, up to <option>lock_retries</option> times.
45289 Non-blocking calls are used so that the file is not kept open during the wait
45290 for the lock; the reason for this is to make it as safe as possible for
45291 deliveries over NFS in the case when processes might be accessing an NFS
45292 mailbox without using a lock file. This should not be done, but
45293 misunderstandings and hence misconfigurations are not unknown.
45294 </para>
45295 <para>
45296 On a busy system, however, the performance of a non-blocking lock approach is
45297 not as good as using a blocking lock with a timeout. In this case, the waiting
45298 is done inside the system call, and Exim&#x2019;s delivery process acquires the lock
45299 and can proceed as soon as the previous lock holder releases it.
45300 </para>
45301 <para>
45302 If <option>lock_fcntl_timeout</option> is set to a non-zero time, blocking locks, with that
45303 timeout, are used. There may still be some retrying: the maximum number of
45304 retries is
45305 </para>
45306 <literallayout class="monospaced">
45307 (lock_retries * lock_interval) / lock_fcntl_timeout
45308 </literallayout>
45309 <para>
45310 rounded up to the next whole number. In other words, the total time during
45311 which <command>appendfile</command> is trying to get a lock is roughly the same, unless
45312 <option>lock_fcntl_timeout</option> is set very large.
45313 </para>
45314 <para>
45315 You should consider setting this option if you are getting a lot of delayed
45316 local deliveries because of errors of the form
45317 </para>
45318 <literallayout class="monospaced">
45319 failed to lock mailbox /some/file (fcntl)
45320 </literallayout>
45321 <para>
45322 <indexterm role="option">
45323 <primary><option>lock_flock_timeout</option></primary>
45324 </indexterm>
45325 </para>
45326 <informaltable frame="all">
45327 <tgroup cols="4" colsep="0" rowsep="0">
45328 <colspec colwidth="8*" align="left"/>
45329 <colspec colwidth="6*" align="center"/>
45330 <colspec colwidth="6*" align="center"/>
45331 <colspec colwidth="6*" align="right"/>
45332 <tbody>
45333 <row>
45334 <entry><option>lock_flock_timeout</option></entry>
45335 <entry>Use: <emphasis>appendfile</emphasis></entry>
45336 <entry>Type: <emphasis>time</emphasis></entry>
45337 <entry>Default: <emphasis>0s</emphasis></entry>
45338 </row>
45339 </tbody>
45340 </tgroup>
45341 </informaltable>
45342 <para>
45343 This timeout applies to file locking when using <function>flock()</function> (see
45344 <option>use_flock</option>); the timeout operates in a similar manner to
45345 <option>lock_fcntl_timeout</option>.
45346 </para>
45347 <para>
45348 <indexterm role="option">
45349 <primary><option>lock_interval</option></primary>
45350 </indexterm>
45351 </para>
45352 <informaltable frame="all">
45353 <tgroup cols="4" colsep="0" rowsep="0">
45354 <colspec colwidth="8*" align="left"/>
45355 <colspec colwidth="6*" align="center"/>
45356 <colspec colwidth="6*" align="center"/>
45357 <colspec colwidth="6*" align="right"/>
45358 <tbody>
45359 <row>
45360 <entry><option>lock_interval</option></entry>
45361 <entry>Use: <emphasis>appendfile</emphasis></entry>
45362 <entry>Type: <emphasis>time</emphasis></entry>
45363 <entry>Default: <emphasis>3s</emphasis></entry>
45364 </row>
45365 </tbody>
45366 </tgroup>
45367 </informaltable>
45368 <para>
45369 This specifies the time to wait between attempts to lock the file. See below
45370 for details of locking.
45371 </para>
45372 <para>
45373 <indexterm role="option">
45374 <primary><option>lock_retries</option></primary>
45375 </indexterm>
45376 </para>
45377 <informaltable frame="all">
45378 <tgroup cols="4" colsep="0" rowsep="0">
45379 <colspec colwidth="8*" align="left"/>
45380 <colspec colwidth="6*" align="center"/>
45381 <colspec colwidth="6*" align="center"/>
45382 <colspec colwidth="6*" align="right"/>
45383 <tbody>
45384 <row>
45385 <entry><option>lock_retries</option></entry>
45386 <entry>Use: <emphasis>appendfile</emphasis></entry>
45387 <entry>Type: <emphasis>integer</emphasis></entry>
45388 <entry>Default: <emphasis>10</emphasis></entry>
45389 </row>
45390 </tbody>
45391 </tgroup>
45392 </informaltable>
45393 <para>
45394 This specifies the maximum number of attempts to lock the file. A value of zero
45395 is treated as 1. See below for details of locking.
45396 </para>
45397 <para>
45398 <indexterm role="option">
45399 <primary><option>lockfile_mode</option></primary>
45400 </indexterm>
45401 </para>
45402 <informaltable frame="all">
45403 <tgroup cols="4" colsep="0" rowsep="0">
45404 <colspec colwidth="8*" align="left"/>
45405 <colspec colwidth="6*" align="center"/>
45406 <colspec colwidth="6*" align="center"/>
45407 <colspec colwidth="6*" align="right"/>
45408 <tbody>
45409 <row>
45410 <entry><option>lockfile_mode</option></entry>
45411 <entry>Use: <emphasis>appendfile</emphasis></entry>
45412 <entry>Type: <emphasis>octal integer</emphasis></entry>
45413 <entry>Default: <emphasis>0600</emphasis></entry>
45414 </row>
45415 </tbody>
45416 </tgroup>
45417 </informaltable>
45418 <para>
45419 This specifies the mode of the created lock file, when a lock file is being
45420 used (see <option>use_lockfile</option> and <option>use_mbx_lock</option>).
45421 </para>
45422 <para>
45423 <indexterm role="option">
45424 <primary><option>lockfile_timeout</option></primary>
45425 </indexterm>
45426 </para>
45427 <informaltable frame="all">
45428 <tgroup cols="4" colsep="0" rowsep="0">
45429 <colspec colwidth="8*" align="left"/>
45430 <colspec colwidth="6*" align="center"/>
45431 <colspec colwidth="6*" align="center"/>
45432 <colspec colwidth="6*" align="right"/>
45433 <tbody>
45434 <row>
45435 <entry><option>lockfile_timeout</option></entry>
45436 <entry>Use: <emphasis>appendfile</emphasis></entry>
45437 <entry>Type: <emphasis>time</emphasis></entry>
45438 <entry>Default: <emphasis>30m</emphasis></entry>
45439 </row>
45440 </tbody>
45441 </tgroup>
45442 </informaltable>
45443 <para>
45444 <indexterm role="concept">
45445 <primary>timeout</primary>
45446 <secondary>mailbox locking</secondary>
45447 </indexterm>
45448 When a lock file is being used (see <option>use_lockfile</option>), if a lock file already
45449 exists and is older than this value, it is assumed to have been left behind by
45450 accident, and Exim attempts to remove it.
45451 </para>
45452 <para>
45453 <indexterm role="option">
45454 <primary><option>mailbox_filecount</option></primary>
45455 </indexterm>
45456 </para>
45457 <informaltable frame="all">
45458 <tgroup cols="4" colsep="0" rowsep="0">
45459 <colspec colwidth="8*" align="left"/>
45460 <colspec colwidth="6*" align="center"/>
45461 <colspec colwidth="6*" align="center"/>
45462 <colspec colwidth="6*" align="right"/>
45463 <tbody>
45464 <row>
45465 <entry><option>mailbox_filecount</option></entry>
45466 <entry>Use: <emphasis>appendfile</emphasis></entry>
45467 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45468 <entry>Default: <emphasis>unset</emphasis></entry>
45469 </row>
45470 </tbody>
45471 </tgroup>
45472 </informaltable>
45473 <para>
45474 <indexterm role="concept">
45475 <primary>mailbox</primary>
45476 <secondary>specifying size of</secondary>
45477 </indexterm>
45478 <indexterm role="concept">
45479 <primary>size</primary>
45480 <secondary>of mailbox</secondary>
45481 </indexterm>
45482 If this option is set, it is expanded, and the result is taken as the current
45483 number of files in the mailbox. It must be a decimal number, optionally
45484 followed by K or M. This provides a way of obtaining this information from an
45485 external source that maintains the data.
45486 </para>
45487 <para>
45488 <indexterm role="option">
45489 <primary><option>mailbox_size</option></primary>
45490 </indexterm>
45491 </para>
45492 <informaltable frame="all">
45493 <tgroup cols="4" colsep="0" rowsep="0">
45494 <colspec colwidth="8*" align="left"/>
45495 <colspec colwidth="6*" align="center"/>
45496 <colspec colwidth="6*" align="center"/>
45497 <colspec colwidth="6*" align="right"/>
45498 <tbody>
45499 <row>
45500 <entry><option>mailbox_size</option></entry>
45501 <entry>Use: <emphasis>appendfile</emphasis></entry>
45502 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45503 <entry>Default: <emphasis>unset</emphasis></entry>
45504 </row>
45505 </tbody>
45506 </tgroup>
45507 </informaltable>
45508 <para>
45509 <indexterm role="concept">
45510 <primary>mailbox</primary>
45511 <secondary>specifying size of</secondary>
45512 </indexterm>
45513 <indexterm role="concept">
45514 <primary>size</primary>
45515 <secondary>of mailbox</secondary>
45516 </indexterm>
45517 If this option is set, it is expanded, and the result is taken as the current
45518 size the mailbox. It must be a decimal number, optionally followed by K or M.
45519 This provides a way of obtaining this information from an external source that
45520 maintains the data. This is likely to be helpful for maildir deliveries where
45521 it is computationally expensive to compute the size of a mailbox.
45522 </para>
45523 <para>
45524 <indexterm role="option">
45525 <primary><option>maildir_format</option></primary>
45526 </indexterm>
45527 </para>
45528 <informaltable frame="all">
45529 <tgroup cols="4" colsep="0" rowsep="0">
45530 <colspec colwidth="8*" align="left"/>
45531 <colspec colwidth="6*" align="center"/>
45532 <colspec colwidth="6*" align="center"/>
45533 <colspec colwidth="6*" align="right"/>
45534 <tbody>
45535 <row>
45536 <entry><option>maildir_format</option></entry>
45537 <entry>Use: <emphasis>appendfile</emphasis></entry>
45538 <entry>Type: <emphasis>boolean</emphasis></entry>
45539 <entry>Default: <emphasis>false</emphasis></entry>
45540 </row>
45541 </tbody>
45542 </tgroup>
45543 </informaltable>
45544 <para>
45545 <indexterm role="concept">
45546 <primary>maildir format</primary>
45547 <secondary>specifying</secondary>
45548 </indexterm>
45549 If this option is set with the <option>directory</option> option, the delivery is into a new
45550 file, in the <quote>maildir</quote> format that is used by other mail software. When the
45551 transport is activated directly from a <command>redirect</command> router (for example, the
45552 <command>address_file</command> transport in the default configuration), setting
45553 <option>maildir_format</option> causes the path received from the router to be treated as a
45554 directory, whether or not it ends with <literal>/</literal>. This option is available only if
45555 SUPPORT_MAILDIR is present in <filename>Local/Makefile</filename>. See section
45556 <xref linkend="SECTmaildirdelivery"/> below for further details.
45557 </para>
45558 <para>
45559 <indexterm role="option">
45560 <primary><option>maildir_quota_directory_regex</option></primary>
45561 </indexterm>
45562 </para>
45563 <informaltable frame="all">
45564 <tgroup cols="4" colsep="0" rowsep="0">
45565 <colspec colwidth="8*" align="left"/>
45566 <colspec colwidth="6*" align="center"/>
45567 <colspec colwidth="6*" align="center"/>
45568 <colspec colwidth="6*" align="right"/>
45569 <tbody>
45570 <row>
45571 <entry><option>maildir_quota_directory_regex</option></entry>
45572 <entry>Use: <emphasis>appendfile</emphasis></entry>
45573 <entry>Type: <emphasis>string</emphasis></entry>
45574 <entry>Default: <emphasis>See below</emphasis></entry>
45575 </row>
45576 </tbody>
45577 </tgroup>
45578 </informaltable>
45579 <para>
45580 <indexterm role="concept">
45581 <primary>maildir format</primary>
45582 <secondary>quota; directories included in</secondary>
45583 </indexterm>
45584 <indexterm role="concept">
45585 <primary>quota</primary>
45586 <secondary>maildir; directories included in</secondary>
45587 </indexterm>
45588 This option is relevant only when <option>maildir_use_size_file</option> is set. It defines
45589 a regular expression for specifying directories, relative to the quota
45590 directory (see <option>quota_directory</option>), that should be included in the quota
45591 calculation. The default value is:
45592 </para>
45593 <literallayout class="monospaced">
45594 maildir_quota_directory_regex = ^(?:cur|new|\..*)$
45595 </literallayout>
45596 <para>
45597 This includes the <filename>cur</filename> and <filename>new</filename> directories, and any maildir++ folders
45598 (directories whose names begin with a dot). If you want to exclude the
45599 <filename>Trash</filename>
45600 folder from the count (as some sites do), you need to change this setting to
45601 </para>
45602 <literallayout class="monospaced">
45603 maildir_quota_directory_regex = ^(?:cur|new|\.(?!Trash).*)$
45604 </literallayout>
45605 <para>
45606 This uses a negative lookahead in the regular expression to exclude the
45607 directory whose name is <filename>.Trash</filename>. When a directory is excluded from quota
45608 calculations, quota processing is bypassed for any messages that are delivered
45609 directly into that directory.
45610 </para>
45611 <para>
45612 <indexterm role="option">
45613 <primary><option>maildir_retries</option></primary>
45614 </indexterm>
45615 </para>
45616 <informaltable frame="all">
45617 <tgroup cols="4" colsep="0" rowsep="0">
45618 <colspec colwidth="8*" align="left"/>
45619 <colspec colwidth="6*" align="center"/>
45620 <colspec colwidth="6*" align="center"/>
45621 <colspec colwidth="6*" align="right"/>
45622 <tbody>
45623 <row>
45624 <entry><option>maildir_retries</option></entry>
45625 <entry>Use: <emphasis>appendfile</emphasis></entry>
45626 <entry>Type: <emphasis>integer</emphasis></entry>
45627 <entry>Default: <emphasis>10</emphasis></entry>
45628 </row>
45629 </tbody>
45630 </tgroup>
45631 </informaltable>
45632 <para>
45633 This option specifies the number of times to retry when writing a file in
45634 <quote>maildir</quote> format. See section <xref linkend="SECTmaildirdelivery"/> below.
45635 </para>
45636 <para>
45637 <indexterm role="option">
45638 <primary><option>maildir_tag</option></primary>
45639 </indexterm>
45640 </para>
45641 <informaltable frame="all">
45642 <tgroup cols="4" colsep="0" rowsep="0">
45643 <colspec colwidth="8*" align="left"/>
45644 <colspec colwidth="6*" align="center"/>
45645 <colspec colwidth="6*" align="center"/>
45646 <colspec colwidth="6*" align="right"/>
45647 <tbody>
45648 <row>
45649 <entry><option>maildir_tag</option></entry>
45650 <entry>Use: <emphasis>appendfile</emphasis></entry>
45651 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45652 <entry>Default: <emphasis>unset</emphasis></entry>
45653 </row>
45654 </tbody>
45655 </tgroup>
45656 </informaltable>
45657 <para>
45658 This option applies only to deliveries in maildir format, and is described in
45659 section <xref linkend="SECTmaildirdelivery"/> below.
45660 </para>
45661 <para>
45662 <indexterm role="option">
45663 <primary><option>maildir_use_size_file</option></primary>
45664 </indexterm>
45665 </para>
45666 <informaltable frame="all">
45667 <tgroup cols="4" colsep="0" rowsep="0">
45668 <colspec colwidth="8*" align="left"/>
45669 <colspec colwidth="6*" align="center"/>
45670 <colspec colwidth="6*" align="center"/>
45671 <colspec colwidth="6*" align="right"/>
45672 <tbody>
45673 <row>
45674 <entry><option>maildir_use_size_file</option></entry>
45675 <entry>Use: <emphasis>appendfile</emphasis>&dagger;<emphasis></emphasis></entry>
45676 <entry>Type: <emphasis>boolean</emphasis></entry>
45677 <entry>Default: <emphasis>false</emphasis></entry>
45678 </row>
45679 </tbody>
45680 </tgroup>
45681 </informaltable>
45682 <para>
45683 <indexterm role="concept">
45684 <primary>maildir format</primary>
45685 <secondary><filename>maildirsize</filename> file</secondary>
45686 </indexterm>
45687 The result of string expansion for this option must be a valid boolean value.
45688 If it is true, it enables support for <filename>maildirsize</filename> files. Exim
45689 creates a <filename>maildirsize</filename> file in a maildir if one does not exist, taking the
45690 quota from the <option>quota</option> option of the transport. If <option>quota</option> is unset, the
45691 value is zero. See <option>maildir_quota_directory_regex</option> above and section
45692 <xref linkend="SECTmaildirdelivery"/> below for further details.
45693 </para>
45694 <para>
45695 <indexterm role="option">
45696 <primary><option>maildirfolder_create_regex</option></primary>
45697 </indexterm>
45698 </para>
45699 <informaltable frame="all">
45700 <tgroup cols="4" colsep="0" rowsep="0">
45701 <colspec colwidth="8*" align="left"/>
45702 <colspec colwidth="6*" align="center"/>
45703 <colspec colwidth="6*" align="center"/>
45704 <colspec colwidth="6*" align="right"/>
45705 <tbody>
45706 <row>
45707 <entry><option>maildirfolder_create_regex</option></entry>
45708 <entry>Use: <emphasis>appendfile</emphasis></entry>
45709 <entry>Type: <emphasis>string</emphasis></entry>
45710 <entry>Default: <emphasis>unset</emphasis></entry>
45711 </row>
45712 </tbody>
45713 </tgroup>
45714 </informaltable>
45715 <para>
45716 <indexterm role="concept">
45717 <primary>maildir format</primary>
45718 <secondary><filename>maildirfolder</filename> file</secondary>
45719 </indexterm>
45720 <indexterm role="concept">
45721 <primary><filename>maildirfolder</filename>, creating</primary>
45722 </indexterm>
45723 The value of this option is a regular expression. If it is unset, it has no
45724 effect. Otherwise, before a maildir delivery takes place, the pattern is
45725 matched against the name of the maildir directory, that is, the directory
45726 containing the <filename>new</filename> and <filename>tmp</filename> subdirectories that will be used for the
45727 delivery. If there is a match, Exim checks for the existence of a file called
45728 <filename>maildirfolder</filename> in the directory, and creates it if it does not exist.
45729 See section <xref linkend="SECTmaildirdelivery"/> for more details.
45730 </para>
45731 <para>
45732 <indexterm role="option">
45733 <primary><option>mailstore_format</option></primary>
45734 </indexterm>
45735 </para>
45736 <informaltable frame="all">
45737 <tgroup cols="4" colsep="0" rowsep="0">
45738 <colspec colwidth="8*" align="left"/>
45739 <colspec colwidth="6*" align="center"/>
45740 <colspec colwidth="6*" align="center"/>
45741 <colspec colwidth="6*" align="right"/>
45742 <tbody>
45743 <row>
45744 <entry><option>mailstore_format</option></entry>
45745 <entry>Use: <emphasis>appendfile</emphasis></entry>
45746 <entry>Type: <emphasis>boolean</emphasis></entry>
45747 <entry>Default: <emphasis>false</emphasis></entry>
45748 </row>
45749 </tbody>
45750 </tgroup>
45751 </informaltable>
45752 <para>
45753 <indexterm role="concept">
45754 <primary>mailstore format</primary>
45755 <secondary>specifying</secondary>
45756 </indexterm>
45757 If this option is set with the <option>directory</option> option, the delivery is into two
45758 new files in  <quote>mailstore</quote> format. The option is available only if
45759 SUPPORT_MAILSTORE is present in <filename>Local/Makefile</filename>. See section <xref linkend="SECTopdir"/>
45760 below for further details.
45761 </para>
45762 <para>
45763 <indexterm role="option">
45764 <primary><option>mailstore_prefix</option></primary>
45765 </indexterm>
45766 </para>
45767 <informaltable frame="all">
45768 <tgroup cols="4" colsep="0" rowsep="0">
45769 <colspec colwidth="8*" align="left"/>
45770 <colspec colwidth="6*" align="center"/>
45771 <colspec colwidth="6*" align="center"/>
45772 <colspec colwidth="6*" align="right"/>
45773 <tbody>
45774 <row>
45775 <entry><option>mailstore_prefix</option></entry>
45776 <entry>Use: <emphasis>appendfile</emphasis></entry>
45777 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45778 <entry>Default: <emphasis>unset</emphasis></entry>
45779 </row>
45780 </tbody>
45781 </tgroup>
45782 </informaltable>
45783 <para>
45784 This option applies only to deliveries in mailstore format, and is described in
45785 section <xref linkend="SECTopdir"/> below.
45786 </para>
45787 <para>
45788 <indexterm role="option">
45789 <primary><option>mailstore_suffix</option></primary>
45790 </indexterm>
45791 </para>
45792 <informaltable frame="all">
45793 <tgroup cols="4" colsep="0" rowsep="0">
45794 <colspec colwidth="8*" align="left"/>
45795 <colspec colwidth="6*" align="center"/>
45796 <colspec colwidth="6*" align="center"/>
45797 <colspec colwidth="6*" align="right"/>
45798 <tbody>
45799 <row>
45800 <entry><option>mailstore_suffix</option></entry>
45801 <entry>Use: <emphasis>appendfile</emphasis></entry>
45802 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45803 <entry>Default: <emphasis>unset</emphasis></entry>
45804 </row>
45805 </tbody>
45806 </tgroup>
45807 </informaltable>
45808 <para>
45809 This option applies only to deliveries in mailstore format, and is described in
45810 section <xref linkend="SECTopdir"/> below.
45811 </para>
45812 <para>
45813 <indexterm role="option">
45814 <primary><option>mbx_format</option></primary>
45815 </indexterm>
45816 </para>
45817 <informaltable frame="all">
45818 <tgroup cols="4" colsep="0" rowsep="0">
45819 <colspec colwidth="8*" align="left"/>
45820 <colspec colwidth="6*" align="center"/>
45821 <colspec colwidth="6*" align="center"/>
45822 <colspec colwidth="6*" align="right"/>
45823 <tbody>
45824 <row>
45825 <entry><option>mbx_format</option></entry>
45826 <entry>Use: <emphasis>appendfile</emphasis></entry>
45827 <entry>Type: <emphasis>boolean</emphasis></entry>
45828 <entry>Default: <emphasis>false</emphasis></entry>
45829 </row>
45830 </tbody>
45831 </tgroup>
45832 </informaltable>
45833 <para>
45834 <indexterm role="concept">
45835 <primary>locking files</primary>
45836 </indexterm>
45837 <indexterm role="concept">
45838 <primary>file</primary>
45839 <secondary>locking</secondary>
45840 </indexterm>
45841 <indexterm role="concept">
45842 <primary>file</primary>
45843 <secondary>MBX format</secondary>
45844 </indexterm>
45845 <indexterm role="concept">
45846 <primary>MBX format, specifying</primary>
45847 </indexterm>
45848 This option is available only if Exim has been compiled with SUPPORT_MBX
45849 set in <filename>Local/Makefile</filename>. If <option>mbx_format</option> is set with the <option>file</option> option,
45850 the message is appended to the mailbox file in MBX format instead of
45851 traditional Unix format. This format is supported by Pine4 and its associated
45852 IMAP and POP daemons, by means of the <emphasis>c-client</emphasis> library that they all use.
45853 </para>
45854 <para>
45855 <emphasis role="bold">Note</emphasis>: The <option>message_prefix</option> and <option>message_suffix</option> options are not
45856 automatically changed by the use of <option>mbx_format</option>. They should normally be set
45857 empty when using MBX format, so this option almost always appears in this
45858 combination:
45859 </para>
45860 <literallayout class="monospaced">
45861 mbx_format = true
45862 message_prefix =
45863 message_suffix =
45864 </literallayout>
45865 <para>
45866 If none of the locking options are mentioned in the configuration,
45867 <option>use_mbx_lock</option> is assumed and the other locking options default to false. It
45868 is possible to specify the other kinds of locking with <option>mbx_format</option>, but
45869 <option>use_fcntl_lock</option> and <option>use_mbx_lock</option> are mutually exclusive. MBX locking
45870 interworks with <emphasis>c-client</emphasis>, providing for shared access to the mailbox. It
45871 should not be used if any program that does not use this form of locking is
45872 going to access the mailbox, nor should it be used if the mailbox file is NFS
45873 mounted, because it works only when the mailbox is accessed from a single host.
45874 </para>
45875 <para>
45876 If you set <option>use_fcntl_lock</option> with an MBX-format mailbox, you cannot use
45877 the standard version of <emphasis>c-client</emphasis>, because as long as it has a mailbox open
45878 (this means for the whole of a Pine or IMAP session), Exim will not be able to
45879 append messages to it.
45880 </para>
45881 <para>
45882 <indexterm role="option">
45883 <primary><option>message_prefix</option></primary>
45884 </indexterm>
45885 </para>
45886 <informaltable frame="all">
45887 <tgroup cols="4" colsep="0" rowsep="0">
45888 <colspec colwidth="8*" align="left"/>
45889 <colspec colwidth="6*" align="center"/>
45890 <colspec colwidth="6*" align="center"/>
45891 <colspec colwidth="6*" align="right"/>
45892 <tbody>
45893 <row>
45894 <entry><option>message_prefix</option></entry>
45895 <entry>Use: <emphasis>appendfile</emphasis></entry>
45896 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45897 <entry>Default: <emphasis>see below</emphasis></entry>
45898 </row>
45899 </tbody>
45900 </tgroup>
45901 </informaltable>
45902 <para>
45903 <indexterm role="concept">
45904 <primary><quote>From</quote> line</primary>
45905 </indexterm>
45906 The string specified here is expanded and output at the start of every message.
45907 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
45908 in which case it is:
45909 </para>
45910 <literallayout class="monospaced">
45911 message_prefix = "From ${if def:return_path{$return_path}\
45912   {MAILER-DAEMON}} $tod_bsdinbox\n"
45913 </literallayout>
45914 <para>
45915 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
45916 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
45917 </para>
45918 <para>
45919 <indexterm role="option">
45920 <primary><option>message_suffix</option></primary>
45921 </indexterm>
45922 </para>
45923 <informaltable frame="all">
45924 <tgroup cols="4" colsep="0" rowsep="0">
45925 <colspec colwidth="8*" align="left"/>
45926 <colspec colwidth="6*" align="center"/>
45927 <colspec colwidth="6*" align="center"/>
45928 <colspec colwidth="6*" align="right"/>
45929 <tbody>
45930 <row>
45931 <entry><option>message_suffix</option></entry>
45932 <entry>Use: <emphasis>appendfile</emphasis></entry>
45933 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
45934 <entry>Default: <emphasis>see below</emphasis></entry>
45935 </row>
45936 </tbody>
45937 </tgroup>
45938 </informaltable>
45939 <para>
45940 The string specified here is expanded and output at the end of every message.
45941 The default is unset unless <option>file</option> is specified and <option>use_bsmtp</option> is not set,
45942 in which case it is a single newline character. The suffix can be suppressed by
45943 setting
45944 </para>
45945 <literallayout class="monospaced">
45946 message_suffix =
45947 </literallayout>
45948 <para>
45949 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
45950 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
45951 </para>
45952 <para>
45953 <indexterm role="option">
45954 <primary><option>mode</option></primary>
45955 </indexterm>
45956 </para>
45957 <informaltable frame="all">
45958 <tgroup cols="4" colsep="0" rowsep="0">
45959 <colspec colwidth="8*" align="left"/>
45960 <colspec colwidth="6*" align="center"/>
45961 <colspec colwidth="6*" align="center"/>
45962 <colspec colwidth="6*" align="right"/>
45963 <tbody>
45964 <row>
45965 <entry><option>mode</option></entry>
45966 <entry>Use: <emphasis>appendfile</emphasis></entry>
45967 <entry>Type: <emphasis>octal integer</emphasis></entry>
45968 <entry>Default: <emphasis>0600</emphasis></entry>
45969 </row>
45970 </tbody>
45971 </tgroup>
45972 </informaltable>
45973 <para>
45974 If the output file is created, it is given this mode. If it already exists and
45975 has wider permissions, they are reduced to this mode. If it has narrower
45976 permissions, an error occurs unless <option>mode_fail_narrower</option> is false. However,
45977 if the delivery is the result of a <option>save</option> command in a filter file specifying
45978 a particular mode, the mode of the output file is always forced to take that
45979 value, and this option is ignored.
45980 </para>
45981 <para>
45982 <indexterm role="option">
45983 <primary><option>mode_fail_narrower</option></primary>
45984 </indexterm>
45985 </para>
45986 <informaltable frame="all">
45987 <tgroup cols="4" colsep="0" rowsep="0">
45988 <colspec colwidth="8*" align="left"/>
45989 <colspec colwidth="6*" align="center"/>
45990 <colspec colwidth="6*" align="center"/>
45991 <colspec colwidth="6*" align="right"/>
45992 <tbody>
45993 <row>
45994 <entry><option>mode_fail_narrower</option></entry>
45995 <entry>Use: <emphasis>appendfile</emphasis></entry>
45996 <entry>Type: <emphasis>boolean</emphasis></entry>
45997 <entry>Default: <emphasis>true</emphasis></entry>
45998 </row>
45999 </tbody>
46000 </tgroup>
46001 </informaltable>
46002 <para>
46003 This option applies in the case when an existing mailbox file has a narrower
46004 mode than that specified by the <option>mode</option> option. If <option>mode_fail_narrower</option> is
46005 true, the delivery is deferred (<quote>mailbox has the wrong mode</quote>); otherwise Exim
46006 continues with the delivery attempt, using the existing mode of the file.
46007 </para>
46008 <para>
46009 <indexterm role="option">
46010 <primary><option>notify_comsat</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>notify_comsat</option></entry>
46022 <entry>Use: <emphasis>appendfile</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 option is true, the <emphasis>comsat</emphasis> daemon is notified after every
46031 successful delivery to a user mailbox. This is the daemon that notifies logged
46032 on users about incoming mail.
46033 </para>
46034 <para>
46035 <indexterm role="option">
46036 <primary><option>quota</option></primary>
46037 </indexterm>
46038 </para>
46039 <informaltable frame="all">
46040 <tgroup cols="4" colsep="0" rowsep="0">
46041 <colspec colwidth="8*" align="left"/>
46042 <colspec colwidth="6*" align="center"/>
46043 <colspec colwidth="6*" align="center"/>
46044 <colspec colwidth="6*" align="right"/>
46045 <tbody>
46046 <row>
46047 <entry><option>quota</option></entry>
46048 <entry>Use: <emphasis>appendfile</emphasis></entry>
46049 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46050 <entry>Default: <emphasis>unset</emphasis></entry>
46051 </row>
46052 </tbody>
46053 </tgroup>
46054 </informaltable>
46055 <para>
46056 <indexterm role="concept">
46057 <primary>quota</primary>
46058 <secondary>imposed by Exim</secondary>
46059 </indexterm>
46060 This option imposes a limit on the size of the file to which Exim is appending,
46061 or to the total space used in the directory tree when the <option>directory</option> option
46062 is set. In the latter case, computation of the space used is expensive, because
46063 all the files in the directory (and any sub-directories) have to be
46064 individually inspected and their sizes summed. (See <option>quota_size_regex</option> and
46065 <option>maildir_use_size_file</option> for ways to avoid this in environments where users
46066 have no shell access to their mailboxes).
46067 </para>
46068 <para>
46069 As there is no interlock against two simultaneous deliveries into a
46070 multi-file mailbox, it is possible for the quota to be overrun in this case.
46071 For single-file mailboxes, of course, an interlock is a necessity.
46072 </para>
46073 <para>
46074 A file&#x2019;s size is taken as its <emphasis>used</emphasis> value. Because of blocking effects, this
46075 may be a lot less than the actual amount of disk space allocated to the file.
46076 If the sizes of a number of files are being added up, the rounding effect can
46077 become quite noticeable, especially on systems that have large block sizes.
46078 Nevertheless, it seems best to stick to the <emphasis>used</emphasis> figure, because this is
46079 the obvious value which users understand most easily.
46080 </para>
46081 <para>
46082 The value of the option is expanded, and must then be a numerical value
46083 (decimal point allowed), optionally followed by one of the letters K, M, or G,
46084 for kilobytes, megabytes, or gigabytes, optionally followed by a slash
46085 and further option modifiers. If Exim is running on a system with
46086 large file support (Linux and FreeBSD have this), mailboxes larger than 2G can
46087 be handled.
46088 </para>
46089 <para>
46090 The option modifier <option>no_check</option> can be used to force delivery even if the over
46091 quota condition is met. The quota gets updated as usual.
46092 </para>
46093 <para>
46094 <emphasis role="bold">Note</emphasis>: A value of zero is interpreted as <quote>no quota</quote>.
46095 </para>
46096 <para>
46097 The expansion happens while Exim is running as root, before it changes uid for
46098 the delivery. This means that files that are inaccessible to the end user can
46099 be used to hold quota values that are looked up in the expansion. When delivery
46100 fails because this quota is exceeded, the handling of the error is as for
46101 system quota failures.
46102 </para>
46103 <para>
46104 By default, Exim&#x2019;s quota checking mimics system quotas, and restricts the
46105 mailbox to the specified maximum size, though the value is not accurate to the
46106 last byte, owing to separator lines and additional headers that may get added
46107 during message delivery. When a mailbox is nearly full, large messages may get
46108 refused even though small ones are accepted, because the size of the current
46109 message is added to the quota when the check is made. This behaviour can be
46110 changed by setting <option>quota_is_inclusive</option> false. When this is done, the check
46111 for exceeding the quota does not include the current message. Thus, deliveries
46112 continue until the quota has been exceeded; thereafter, no further messages are
46113 delivered. See also <option>quota_warn_threshold</option>.
46114 </para>
46115 <para>
46116 <indexterm role="option">
46117 <primary><option>quota_directory</option></primary>
46118 </indexterm>
46119 </para>
46120 <informaltable frame="all">
46121 <tgroup cols="4" colsep="0" rowsep="0">
46122 <colspec colwidth="8*" align="left"/>
46123 <colspec colwidth="6*" align="center"/>
46124 <colspec colwidth="6*" align="center"/>
46125 <colspec colwidth="6*" align="right"/>
46126 <tbody>
46127 <row>
46128 <entry><option>quota_directory</option></entry>
46129 <entry>Use: <emphasis>appendfile</emphasis></entry>
46130 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46131 <entry>Default: <emphasis>unset</emphasis></entry>
46132 </row>
46133 </tbody>
46134 </tgroup>
46135 </informaltable>
46136 <para>
46137 This option defines the directory to check for quota purposes when delivering
46138 into individual files. The default is the delivery directory, or, if a file
46139 called <filename>maildirfolder</filename> exists in a maildir directory, the parent of the
46140 delivery directory.
46141 </para>
46142 <para>
46143 <indexterm role="option">
46144 <primary><option>quota_filecount</option></primary>
46145 </indexterm>
46146 </para>
46147 <informaltable frame="all">
46148 <tgroup cols="4" colsep="0" rowsep="0">
46149 <colspec colwidth="8*" align="left"/>
46150 <colspec colwidth="6*" align="center"/>
46151 <colspec colwidth="6*" align="center"/>
46152 <colspec colwidth="6*" align="right"/>
46153 <tbody>
46154 <row>
46155 <entry><option>quota_filecount</option></entry>
46156 <entry>Use: <emphasis>appendfile</emphasis></entry>
46157 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46158 <entry>Default: <emphasis>0</emphasis></entry>
46159 </row>
46160 </tbody>
46161 </tgroup>
46162 </informaltable>
46163 <para>
46164 This option applies when the <option>directory</option> option is set. It limits the total
46165 number of files in the directory (compare the inode limit in system quotas). It
46166 can only be used if <option>quota</option> is also set. The value is expanded; an expansion
46167 failure causes delivery to be deferred. A value of zero is interpreted as
46168 <quote>no quota</quote>.
46169 </para>
46170 <para>
46171 The option modifier <option>no_check</option> can be used to force delivery even if the over
46172 quota condition is met. The quota gets updated as usual.
46173 </para>
46174 <para>
46175 <indexterm role="option">
46176 <primary><option>quota_is_inclusive</option></primary>
46177 </indexterm>
46178 </para>
46179 <informaltable frame="all">
46180 <tgroup cols="4" colsep="0" rowsep="0">
46181 <colspec colwidth="8*" align="left"/>
46182 <colspec colwidth="6*" align="center"/>
46183 <colspec colwidth="6*" align="center"/>
46184 <colspec colwidth="6*" align="right"/>
46185 <tbody>
46186 <row>
46187 <entry><option>quota_is_inclusive</option></entry>
46188 <entry>Use: <emphasis>appendfile</emphasis></entry>
46189 <entry>Type: <emphasis>boolean</emphasis></entry>
46190 <entry>Default: <emphasis>true</emphasis></entry>
46191 </row>
46192 </tbody>
46193 </tgroup>
46194 </informaltable>
46195 <para>
46196 See <option>quota</option> above.
46197 </para>
46198 <para>
46199 <indexterm role="option">
46200 <primary><option>quota_size_regex</option></primary>
46201 </indexterm>
46202 </para>
46203 <informaltable frame="all">
46204 <tgroup cols="4" colsep="0" rowsep="0">
46205 <colspec colwidth="8*" align="left"/>
46206 <colspec colwidth="6*" align="center"/>
46207 <colspec colwidth="6*" align="center"/>
46208 <colspec colwidth="6*" align="right"/>
46209 <tbody>
46210 <row>
46211 <entry><option>quota_size_regex</option></entry>
46212 <entry>Use: <emphasis>appendfile</emphasis></entry>
46213 <entry>Type: <emphasis>string</emphasis></entry>
46214 <entry>Default: <emphasis>unset</emphasis></entry>
46215 </row>
46216 </tbody>
46217 </tgroup>
46218 </informaltable>
46219 <para>
46220 This option applies when one of the delivery modes that writes a separate file
46221 for each message is being used. When Exim wants to find the size of one of
46222 these files in order to test the quota, it first checks <option>quota_size_regex</option>.
46223 If this is set to a regular expression that matches the filename, and it
46224 captures one string, that string is interpreted as a representation of the
46225 file&#x2019;s size. The value of <option>quota_size_regex</option> is not expanded.
46226 </para>
46227 <para>
46228 This feature is useful only when users have no shell access to their mailboxes
46229 &ndash; otherwise they could defeat the quota simply by renaming the files. This
46230 facility can be used with maildir deliveries, by setting <option>maildir_tag</option> to add
46231 the file length to the filename. For example:
46232 </para>
46233 <literallayout class="monospaced">
46234 maildir_tag = ,S=$message_size
46235 quota_size_regex = ,S=(\d+)
46236 </literallayout>
46237 <para>
46238 An alternative to <varname>$message_size</varname> is <varname>$message_linecount</varname>, which contains the
46239 number of lines in the message.
46240 </para>
46241 <para>
46242 The regular expression should not assume that the length is at the end of the
46243 filename (even though <option>maildir_tag</option> puts it there) because maildir MUAs
46244 sometimes add other information onto the ends of message filenames.
46245 </para>
46246 <para>
46247 Section <xref linkend="SECID136"/> contains further information.
46248 </para>
46249 <para>
46250 This option should not be used when other message-handling software
46251 may duplicate messages by making hardlinks to the files.  When that is done Exim
46252 will count the message size once for each filename, in contrast with the actual
46253 disk usage.  When the option is not set, calculating total usage requires
46254 a system-call per file to get the size; the number of links is then available also
46255 as is used to adjust the effective size.
46256 </para>
46257 <para>
46258 <indexterm role="option">
46259 <primary><option>quota_warn_message</option></primary>
46260 </indexterm>
46261 </para>
46262 <informaltable frame="all">
46263 <tgroup cols="4" colsep="0" rowsep="0">
46264 <colspec colwidth="8*" align="left"/>
46265 <colspec colwidth="6*" align="center"/>
46266 <colspec colwidth="6*" align="center"/>
46267 <colspec colwidth="6*" align="right"/>
46268 <tbody>
46269 <row>
46270 <entry><option>quota_warn_message</option></entry>
46271 <entry>Use: <emphasis>appendfile</emphasis></entry>
46272 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46273 <entry>Default: <emphasis>see below</emphasis></entry>
46274 </row>
46275 </tbody>
46276 </tgroup>
46277 </informaltable>
46278 <para>
46279 See below for the use of this option. If it is not set when
46280 <option>quota_warn_threshold</option> is set, it defaults to
46281 </para>
46282 <literallayout class="monospaced">
46283 quota_warn_message = "\
46284   To: $local_part@$domain\n\
46285   Subject: Your mailbox\n\n\
46286   This message is automatically created \
46287   by mail delivery software.\n\n\
46288   The size of your mailbox has exceeded \
46289   a warning threshold that is\n\
46290   set by the system administrator.\n"
46291 </literallayout>
46292 <para>
46293 <indexterm role="option">
46294 <primary><option>quota_warn_threshold</option></primary>
46295 </indexterm>
46296 </para>
46297 <informaltable frame="all">
46298 <tgroup cols="4" colsep="0" rowsep="0">
46299 <colspec colwidth="8*" align="left"/>
46300 <colspec colwidth="6*" align="center"/>
46301 <colspec colwidth="6*" align="center"/>
46302 <colspec colwidth="6*" align="right"/>
46303 <tbody>
46304 <row>
46305 <entry><option>quota_warn_threshold</option></entry>
46306 <entry>Use: <emphasis>appendfile</emphasis></entry>
46307 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
46308 <entry>Default: <emphasis>0</emphasis></entry>
46309 </row>
46310 </tbody>
46311 </tgroup>
46312 </informaltable>
46313 <para>
46314 <indexterm role="concept">
46315 <primary>quota</primary>
46316 <secondary>warning threshold</secondary>
46317 </indexterm>
46318 <indexterm role="concept">
46319 <primary>mailbox</primary>
46320 <secondary>size warning</secondary>
46321 </indexterm>
46322 <indexterm role="concept">
46323 <primary>size</primary>
46324 <secondary>of mailbox</secondary>
46325 </indexterm>
46326 This option is expanded in the same way as <option>quota</option> (see above). If the
46327 resulting value is greater than zero, and delivery of the message causes the
46328 size of the file or total space in the directory tree to cross the given
46329 threshold, a warning message is sent. If <option>quota</option> is also set, the threshold
46330 may be specified as a percentage of it by following the value with a percent
46331 sign. For example:
46332 </para>
46333 <literallayout class="monospaced">
46334 quota = 10M
46335 quota_warn_threshold = 75%
46336 </literallayout>
46337 <para>
46338 If <option>quota</option> is not set, a setting of <option>quota_warn_threshold</option> that ends with a
46339 percent sign is ignored.
46340 </para>
46341 <para>
46342 The warning message itself is specified by the <option>quota_warn_message</option> option,
46343 and it must start with a <emphasis>To:</emphasis> header line containing the recipient(s) of the
46344 warning message. These do not necessarily have to include the recipient(s) of
46345 the original message. A <emphasis>Subject:</emphasis> line should also normally be supplied. You
46346 can include any other header lines that you want. If you do not include a
46347 <emphasis>From:</emphasis> line, the default is:
46348 </para>
46349 <literallayout class="monospaced">
46350 From: Mail Delivery System &lt;mailer-daemon@$qualify_domain_sender&gt;
46351 </literallayout>
46352 <para>
46353 <indexterm role="option">
46354 <primary><option>errors_reply_to</option></primary>
46355 </indexterm>
46356 If you supply a <emphasis>Reply-To:</emphasis> line, it overrides the global <option>errors_reply_to</option>
46357 option.
46358 </para>
46359 <para>
46360 The <option>quota</option> option does not have to be set in order to use this option; they
46361 are independent of one another except when the threshold is specified as a
46362 percentage.
46363 </para>
46364 <para>
46365 <indexterm role="option">
46366 <primary><option>use_bsmtp</option></primary>
46367 </indexterm>
46368 </para>
46369 <informaltable frame="all">
46370 <tgroup cols="4" colsep="0" rowsep="0">
46371 <colspec colwidth="8*" align="left"/>
46372 <colspec colwidth="6*" align="center"/>
46373 <colspec colwidth="6*" align="center"/>
46374 <colspec colwidth="6*" align="right"/>
46375 <tbody>
46376 <row>
46377 <entry><option>use_bsmtp</option></entry>
46378 <entry>Use: <emphasis>appendfile</emphasis></entry>
46379 <entry>Type: <emphasis>boolean</emphasis></entry>
46380 <entry>Default: <emphasis>false</emphasis></entry>
46381 </row>
46382 </tbody>
46383 </tgroup>
46384 </informaltable>
46385 <para>
46386 <indexterm role="concept">
46387 <primary>envelope from</primary>
46388 </indexterm>
46389 <indexterm role="concept">
46390 <primary>envelope sender</primary>
46391 </indexterm>
46392 If this option is set true, <command>appendfile</command> writes messages in <quote>batch SMTP</quote>
46393 format, with the envelope sender and recipient(s) included as SMTP commands. If
46394 you want to include a leading HELO command with such messages, you can do
46395 so by setting the <option>message_prefix</option> option. See section <xref linkend="SECTbatchSMTP"/>
46396 for details of batch SMTP.
46397 </para>
46398 <para>
46399 <indexterm role="option">
46400 <primary><option>use_crlf</option></primary>
46401 </indexterm>
46402 </para>
46403 <informaltable frame="all">
46404 <tgroup cols="4" colsep="0" rowsep="0">
46405 <colspec colwidth="8*" align="left"/>
46406 <colspec colwidth="6*" align="center"/>
46407 <colspec colwidth="6*" align="center"/>
46408 <colspec colwidth="6*" align="right"/>
46409 <tbody>
46410 <row>
46411 <entry><option>use_crlf</option></entry>
46412 <entry>Use: <emphasis>appendfile</emphasis></entry>
46413 <entry>Type: <emphasis>boolean</emphasis></entry>
46414 <entry>Default: <emphasis>false</emphasis></entry>
46415 </row>
46416 </tbody>
46417 </tgroup>
46418 </informaltable>
46419 <para>
46420 <indexterm role="concept">
46421 <primary>carriage return</primary>
46422 </indexterm>
46423 <indexterm role="concept">
46424 <primary>linefeed</primary>
46425 </indexterm>
46426 This option causes lines to be terminated with the two-character CRLF sequence
46427 (carriage return, linefeed) instead of just a linefeed character. In the case
46428 of batched SMTP, the byte sequence written to the file is then an exact image
46429 of what would be sent down a real SMTP connection.
46430 </para>
46431 <para>
46432 <emphasis role="bold">Note:</emphasis> The contents of the <option>message_prefix</option> and <option>message_suffix</option> options
46433 (which are used to supply the traditional <quote>From&nbsp;</quote> and blank line separators
46434 in Berkeley-style mailboxes) are written verbatim, so must contain their own
46435 carriage return characters if these are needed. In cases where these options
46436 have non-empty defaults, the values end with a single linefeed, so they must be
46437 changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
46438 </para>
46439 <para>
46440 <indexterm role="option">
46441 <primary><option>use_fcntl_lock</option></primary>
46442 </indexterm>
46443 </para>
46444 <informaltable frame="all">
46445 <tgroup cols="4" colsep="0" rowsep="0">
46446 <colspec colwidth="8*" align="left"/>
46447 <colspec colwidth="6*" align="center"/>
46448 <colspec colwidth="6*" align="center"/>
46449 <colspec colwidth="6*" align="right"/>
46450 <tbody>
46451 <row>
46452 <entry><option>use_fcntl_lock</option></entry>
46453 <entry>Use: <emphasis>appendfile</emphasis></entry>
46454 <entry>Type: <emphasis>boolean</emphasis></entry>
46455 <entry>Default: <emphasis>see below</emphasis></entry>
46456 </row>
46457 </tbody>
46458 </tgroup>
46459 </informaltable>
46460 <para>
46461 This option controls the use of the <function>fcntl()</function> function to lock a file for
46462 exclusive use when a message is being appended. It is set by default unless
46463 <option>use_flock_lock</option> is set. Otherwise, it should be turned off only if you know
46464 that all your MUAs use lock file locking. When both <option>use_fcntl_lock</option> and
46465 <option>use_flock_lock</option> are unset, <option>use_lockfile</option> must be set.
46466 </para>
46467 <para>
46468 <indexterm role="option">
46469 <primary><option>use_flock_lock</option></primary>
46470 </indexterm>
46471 </para>
46472 <informaltable frame="all">
46473 <tgroup cols="4" colsep="0" rowsep="0">
46474 <colspec colwidth="8*" align="left"/>
46475 <colspec colwidth="6*" align="center"/>
46476 <colspec colwidth="6*" align="center"/>
46477 <colspec colwidth="6*" align="right"/>
46478 <tbody>
46479 <row>
46480 <entry><option>use_flock_lock</option></entry>
46481 <entry>Use: <emphasis>appendfile</emphasis></entry>
46482 <entry>Type: <emphasis>boolean</emphasis></entry>
46483 <entry>Default: <emphasis>false</emphasis></entry>
46484 </row>
46485 </tbody>
46486 </tgroup>
46487 </informaltable>
46488 <para>
46489 This option is provided to support the use of <function>flock()</function> for file locking, for
46490 the few situations where it is needed. Most modern operating systems support
46491 <function>fcntl()</function> and <function>lockf()</function> locking, and these two functions interwork with
46492 each other. Exim uses <function>fcntl()</function> locking by default.
46493 </para>
46494 <para>
46495 This option is required only if you are using an operating system where
46496 <function>flock()</function> is used by programs that access mailboxes (typically MUAs), and
46497 where <function>flock()</function> does not correctly interwork with <function>fcntl()</function>. You can use
46498 both <function>fcntl()</function> and <function>flock()</function> locking simultaneously if you want.
46499 </para>
46500 <para>
46501 <indexterm role="concept">
46502 <primary>Solaris</primary>
46503 <secondary><function>flock()</function> support</secondary>
46504 </indexterm>
46505 Not all operating systems provide <function>flock()</function>. Some versions of Solaris do not
46506 have it (and some, I think, provide a not quite right version built on top of
46507 <function>lockf()</function>). If the OS does not have <function>flock()</function>, Exim will be built without
46508 the ability to use it, and any attempt to do so will cause a configuration
46509 error.
46510 </para>
46511 <para>
46512 <emphasis role="bold">Warning</emphasis>: <function>flock()</function> locks do not work on NFS files (unless <function>flock()</function>
46513 is just being mapped onto <function>fcntl()</function> by the OS).
46514 </para>
46515 <para>
46516 <indexterm role="option">
46517 <primary><option>use_lockfile</option></primary>
46518 </indexterm>
46519 </para>
46520 <informaltable frame="all">
46521 <tgroup cols="4" colsep="0" rowsep="0">
46522 <colspec colwidth="8*" align="left"/>
46523 <colspec colwidth="6*" align="center"/>
46524 <colspec colwidth="6*" align="center"/>
46525 <colspec colwidth="6*" align="right"/>
46526 <tbody>
46527 <row>
46528 <entry><option>use_lockfile</option></entry>
46529 <entry>Use: <emphasis>appendfile</emphasis></entry>
46530 <entry>Type: <emphasis>boolean</emphasis></entry>
46531 <entry>Default: <emphasis>see below</emphasis></entry>
46532 </row>
46533 </tbody>
46534 </tgroup>
46535 </informaltable>
46536 <para>
46537 If this option is turned off, Exim does not attempt to create a lock file when
46538 appending to a mailbox file. In this situation, the only locking is by
46539 <function>fcntl()</function>. You should only turn <option>use_lockfile</option> off if you are absolutely
46540 sure that every MUA that is ever going to look at your users&#x2019; mailboxes uses
46541 <function>fcntl()</function> rather than a lock file, and even then only when you are not
46542 delivering over NFS from more than one host.
46543 </para>
46544 <para>
46545 <indexterm role="concept">
46546 <primary>NFS</primary>
46547 <secondary>lock file</secondary>
46548 </indexterm>
46549 In order to append to an NFS file safely from more than one host, it is
46550 necessary to take out a lock <emphasis>before</emphasis> opening the file, and the lock file
46551 achieves this. Otherwise, even with <function>fcntl()</function> locking, there is a risk of
46552 file corruption.
46553 </para>
46554 <para>
46555 The <option>use_lockfile</option> option is set by default unless <option>use_mbx_lock</option> is set.
46556 It is not possible to turn both <option>use_lockfile</option> and <option>use_fcntl_lock</option> off,
46557 except when <option>mbx_format</option> is set.
46558 </para>
46559 <para>
46560 <indexterm role="option">
46561 <primary><option>use_mbx_lock</option></primary>
46562 </indexterm>
46563 </para>
46564 <informaltable frame="all">
46565 <tgroup cols="4" colsep="0" rowsep="0">
46566 <colspec colwidth="8*" align="left"/>
46567 <colspec colwidth="6*" align="center"/>
46568 <colspec colwidth="6*" align="center"/>
46569 <colspec colwidth="6*" align="right"/>
46570 <tbody>
46571 <row>
46572 <entry><option>use_mbx_lock</option></entry>
46573 <entry>Use: <emphasis>appendfile</emphasis></entry>
46574 <entry>Type: <emphasis>boolean</emphasis></entry>
46575 <entry>Default: <emphasis>see below</emphasis></entry>
46576 </row>
46577 </tbody>
46578 </tgroup>
46579 </informaltable>
46580 <para>
46581 This option is available only if Exim has been compiled with SUPPORT_MBX
46582 set in <filename>Local/Makefile</filename>. Setting the option specifies that special MBX
46583 locking rules be used. It is set by default if <option>mbx_format</option> is set and none
46584 of the locking options are mentioned in the configuration. The locking rules
46585 are the same as are used by the <emphasis>c-client</emphasis> library that underlies Pine and
46586 the IMAP4 and POP daemons that come with it (see the discussion below). The
46587 rules allow for shared access to the mailbox. However, this kind of locking
46588 does not work when the mailbox is NFS mounted.
46589 </para>
46590 <para>
46591 You can set <option>use_mbx_lock</option> with either (or both) of <option>use_fcntl_lock</option> and
46592 <option>use_flock_lock</option> to control what kind of locking is used in implementing the
46593 MBX locking rules. The default is to use <function>fcntl()</function> if <option>use_mbx_lock</option> is set
46594 without <option>use_fcntl_lock</option> or <option>use_flock_lock</option>.
46595 </para>
46596 </section>
46597 <section id="SECTopappend">
46598 <title>Operational details for appending</title>
46599 <para>
46600 <indexterm role="concept">
46601 <primary>appending to a file</primary>
46602 </indexterm>
46603 <indexterm role="concept">
46604 <primary>file</primary>
46605 <secondary>appending</secondary>
46606 </indexterm>
46607 Before appending to a file, the following preparations are made:
46608 </para>
46609 <itemizedlist>
46610 <listitem>
46611 <para>
46612 If the name of the file is <filename>/dev/null</filename>, no action is taken, and a success
46613 return is given.
46614 </para>
46615 </listitem>
46616 <listitem>
46617 <para>
46618 <indexterm role="concept">
46619 <primary>directory creation</primary>
46620 </indexterm>
46621 If any directories on the file&#x2019;s path are missing, Exim creates them if the
46622 <option>create_directory</option> option is set. A created directory&#x2019;s mode is given by the
46623 <option>directory_mode</option> option.
46624 </para>
46625 </listitem>
46626 <listitem>
46627 <para>
46628 If <option>file_format</option> is set, the format of an existing file is checked. If this
46629 indicates that a different transport should be used, control is passed to that
46630 transport.
46631 </para>
46632 </listitem>
46633 <listitem>
46634 <para>
46635 <indexterm role="concept">
46636 <primary>file</primary>
46637 <secondary>locking</secondary>
46638 </indexterm>
46639 <indexterm role="concept">
46640 <primary>locking files</primary>
46641 </indexterm>
46642 <indexterm role="concept">
46643 <primary>NFS</primary>
46644 <secondary>lock file</secondary>
46645 </indexterm>
46646 If <option>use_lockfile</option> is set, a lock file is built in a way that will work
46647 reliably over NFS, as follows:
46648 </para>
46649 <orderedlist numeration="arabic">
46650 <listitem>
46651 <para>
46652 Create a <quote>hitching post</quote> file whose name is that of the lock file with the
46653 current time, primary host name, and process id added, by opening for writing
46654 as a new file. If this fails with an access error, delivery is deferred.
46655 </para>
46656 </listitem>
46657 <listitem>
46658 <para>
46659 Close the hitching post file, and hard link it to the lock filename.
46660 </para>
46661 </listitem>
46662 <listitem>
46663 <para>
46664 If the call to <function>link()</function> succeeds, creation of the lock file has succeeded.
46665 Unlink the hitching post name.
46666 </para>
46667 </listitem>
46668 <listitem>
46669 <para>
46670 Otherwise, use <function>stat()</function> to get information about the hitching post file, and
46671 then unlink hitching post name. If the number of links is exactly two, creation
46672 of the lock file succeeded but something (for example, an NFS server crash and
46673 restart) caused this fact not to be communicated to the <function>link()</function> call.
46674 </para>
46675 </listitem>
46676 <listitem>
46677 <para>
46678 If creation of the lock file failed, wait for <option>lock_interval</option> and try again,
46679 up to <option>lock_retries</option> times. However, since any program that writes to a
46680 mailbox should complete its task very quickly, it is reasonable to time out old
46681 lock files that are normally the result of user agent and system crashes. If an
46682 existing lock file is older than <option>lockfile_timeout</option> Exim attempts to unlink
46683 it before trying again.
46684 </para>
46685 </listitem>
46686 </orderedlist>
46687 </listitem>
46688 <listitem>
46689 <para>
46690 A call is made to <function>lstat()</function> to discover whether the main file exists, and if
46691 so, what its characteristics are. If <function>lstat()</function> fails for any reason other
46692 than non-existence, delivery is deferred.
46693 </para>
46694 </listitem>
46695 <listitem>
46696 <para>
46697 <indexterm role="concept">
46698 <primary>symbolic link</primary>
46699 <secondary>to mailbox</secondary>
46700 </indexterm>
46701 <indexterm role="concept">
46702 <primary>mailbox</primary>
46703 <secondary>symbolic link</secondary>
46704 </indexterm>
46705 If the file does exist and is a symbolic link, delivery is deferred, unless the
46706 <option>allow_symlink</option> option is set, in which case the ownership of the link is
46707 checked, and then <function>stat()</function> is called to find out about the real file, which
46708 is then subjected to the checks below. The check on the top-level link
46709 ownership prevents one user creating a link for another&#x2019;s mailbox in a sticky
46710 directory, though allowing symbolic links in this case is definitely not a good
46711 idea. If there is a chain of symbolic links, the intermediate ones are not
46712 checked.
46713 </para>
46714 </listitem>
46715 <listitem>
46716 <para>
46717 If the file already exists but is not a regular file, or if the file&#x2019;s owner
46718 and group (if the group is being checked &ndash; see <option>check_group</option> above) are
46719 different from the user and group under which the delivery is running,
46720 delivery is deferred.
46721 </para>
46722 </listitem>
46723 <listitem>
46724 <para>
46725 If the file&#x2019;s permissions are more generous than specified, they are reduced.
46726 If they are insufficient, delivery is deferred, unless <option>mode_fail_narrower</option>
46727 is set false, in which case the delivery is tried using the existing
46728 permissions.
46729 </para>
46730 </listitem>
46731 <listitem>
46732 <para>
46733 The file&#x2019;s inode number is saved, and the file is then opened for appending.
46734 If this fails because the file has vanished, <command>appendfile</command> behaves as if it
46735 hadn&#x2019;t existed (see below). For any other failures, delivery is deferred.
46736 </para>
46737 </listitem>
46738 <listitem>
46739 <para>
46740 If the file is opened successfully, check that the inode number hasn&#x2019;t
46741 changed, that it is still a regular file, and that the owner and permissions
46742 have not changed. If anything is wrong, defer delivery and freeze the message.
46743 </para>
46744 </listitem>
46745 <listitem>
46746 <para>
46747 If the file did not exist originally, defer delivery if the <option>file_must_exist</option>
46748 option is set. Otherwise, check that the file is being created in a permitted
46749 directory if the <option>create_file</option> option is set (deferring on failure), and then
46750 open for writing as a new file, with the O_EXCL and O_CREAT options,
46751 except when dealing with a symbolic link (the <option>allow_symlink</option> option must be
46752 set). In this case, which can happen if the link points to a non-existent file,
46753 the file is opened for writing using O_CREAT but not O_EXCL, because
46754 that prevents link following.
46755 </para>
46756 </listitem>
46757 <listitem>
46758 <para>
46759 <indexterm role="concept">
46760 <primary>loop</primary>
46761 <secondary>while file testing</secondary>
46762 </indexterm>
46763 If opening fails because the file exists, obey the tests given above for
46764 existing files. However, to avoid looping in a situation where the file is
46765 being continuously created and destroyed, the exists/not-exists loop is broken
46766 after 10 repetitions, and the message is then frozen.
46767 </para>
46768 </listitem>
46769 <listitem>
46770 <para>
46771 If opening fails with any other error, defer delivery.
46772 </para>
46773 </listitem>
46774 <listitem>
46775 <para>
46776 <indexterm role="concept">
46777 <primary>file</primary>
46778 <secondary>locking</secondary>
46779 </indexterm>
46780 <indexterm role="concept">
46781 <primary>locking files</primary>
46782 </indexterm>
46783 Once the file is open, unless both <option>use_fcntl_lock</option> and <option>use_flock_lock</option>
46784 are false, it is locked using <function>fcntl()</function> or <function>flock()</function> or both. If
46785 <option>use_mbx_lock</option> is false, an exclusive lock is requested in each case.
46786 However, if <option>use_mbx_lock</option> is true, Exim takes out a shared lock on the open
46787 file, and an exclusive lock on the file whose name is
46788 </para>
46789 <literallayout class="monospaced">
46790 /tmp/.&lt;device-number&gt;.&lt;inode-number&gt;
46791 </literallayout>
46792 <para>
46793 using the device and inode numbers of the open mailbox file, in accordance with
46794 the MBX locking rules. This file is created with a mode that is specified by
46795 the <option>lockfile_mode</option> option.
46796 </para>
46797 <para>
46798 If Exim fails to lock the file, there are two possible courses of action,
46799 depending on the value of the locking timeout. This is obtained from
46800 <option>lock_fcntl_timeout</option> or <option>lock_flock_timeout</option>, as appropriate.
46801 </para>
46802 <para>
46803 If the timeout value is zero, the file is closed, Exim waits for
46804 <option>lock_interval</option>, and then goes back and re-opens the file as above and tries
46805 to lock it again. This happens up to <option>lock_retries</option> times, after which the
46806 delivery is deferred.
46807 </para>
46808 <para>
46809 If the timeout has a value greater than zero, blocking calls to <function>fcntl()</function> or
46810 <function>flock()</function> are used (with the given timeout), so there has already been some
46811 waiting involved by the time locking fails. Nevertheless, Exim does not give up
46812 immediately. It retries up to
46813 </para>
46814 <literallayout class="monospaced">
46815 (lock_retries * lock_interval) / &lt;timeout&gt;
46816 </literallayout>
46817 <para>
46818 times (rounded up).
46819 </para>
46820 </listitem>
46821 </itemizedlist>
46822 <para>
46823 At the end of delivery, Exim closes the file (which releases the <function>fcntl()</function>
46824 and/or <function>flock()</function> locks) and then deletes the lock file if one was created.
46825 </para>
46826 </section>
46827 <section id="SECTopdir">
46828 <title>Operational details for delivery to a new file</title>
46829 <para>
46830 <indexterm role="concept">
46831 <primary>delivery</primary>
46832 <secondary>to single file</secondary>
46833 </indexterm>
46834 <indexterm role="concept">
46835 <primary><quote>From</quote> line</primary>
46836 </indexterm>
46837 When the <option>directory</option> option is set instead of <option>file</option>, each message is
46838 delivered into a newly-created file or set of files. When <command>appendfile</command> is
46839 activated directly from a <command>redirect</command> router, neither <option>file</option> nor
46840 <option>directory</option> is normally set, because the path for delivery is supplied by the
46841 router. (See for example, the <command>address_file</command> transport in the default
46842 configuration.) In this case, delivery is to a new file if either the path name
46843 ends in <literal>/</literal>, or the <option>maildir_format</option> or <option>mailstore_format</option> option is set.
46844 </para>
46845 <para>
46846 No locking is required while writing the message to a new file, so the various
46847 locking options of the transport are ignored. The <quote>From</quote> line that by default
46848 separates messages in a single file is not normally needed, nor is the escaping
46849 of message lines that start with <quote>From</quote>, and there is no need to ensure a
46850 newline at the end of each message. Consequently, the default values for
46851 <option>check_string</option>, <option>message_prefix</option>, and <option>message_suffix</option> are all unset when
46852 any of <option>directory</option>, <option>maildir_format</option>, or <option>mailstore_format</option> is set.
46853 </para>
46854 <para>
46855 If Exim is required to check a <option>quota</option> setting, it adds up the sizes of all
46856 the files in the delivery directory by default. However, you can specify a
46857 different directory by setting <option>quota_directory</option>. Also, for maildir
46858 deliveries (see below) the <filename>maildirfolder</filename> convention is honoured.
46859 </para>
46860 <para>
46861 <indexterm role="concept">
46862 <primary>maildir format</primary>
46863 </indexterm>
46864 <indexterm role="concept">
46865 <primary>mailstore format</primary>
46866 </indexterm>
46867 There are three different ways in which delivery to individual files can be
46868 done, controlled by the settings of the <option>maildir_format</option> and
46869 <option>mailstore_format</option> options. Note that code to support maildir or mailstore
46870 formats is not included in the binary unless SUPPORT_MAILDIR or
46871 SUPPORT_MAILSTORE, respectively, is set in <filename>Local/Makefile</filename>.
46872 </para>
46873 <para>
46874 <indexterm role="concept">
46875 <primary>directory creation</primary>
46876 </indexterm>
46877 In all three cases an attempt is made to create the directory and any necessary
46878 sub-directories if they do not exist, provided that the <option>create_directory</option>
46879 option is set (the default). The location of a created directory can be
46880 constrained by setting <option>create_file</option>. A created directory&#x2019;s mode is given by
46881 the <option>directory_mode</option> option. If creation fails, or if the
46882 <option>create_directory</option> option is not set when creation is required, delivery is
46883 deferred.
46884 </para>
46885 </section>
46886 <section id="SECTmaildirdelivery">
46887 <title>Maildir delivery</title>
46888 <para>
46889 <indexterm role="concept">
46890 <primary>maildir format</primary>
46891 <secondary>description of</secondary>
46892 </indexterm>
46893 If the <option>maildir_format</option> option is true, Exim delivers each message by writing
46894 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
46895 directory that is defined by the <option>directory</option> option (the <quote>delivery
46896 directory</quote>). If the delivery is successful, the file is renamed into the
46897 <filename>new</filename> subdirectory.
46898 </para>
46899 <para>
46900 In the filename, &lt;<emphasis>stime</emphasis>&gt; is the current time of day in seconds, and
46901 &lt;<emphasis>mtime</emphasis>&gt; is the microsecond fraction of the time. After a maildir delivery,
46902 Exim checks that the time-of-day clock has moved on by at least one microsecond
46903 before terminating the delivery process. This guarantees uniqueness for the
46904 filename. However, as a precaution, Exim calls <function>stat()</function> for the file before
46905 opening it. If any response other than ENOENT (does not exist) is given,
46906 Exim waits 2 seconds and tries again, up to <option>maildir_retries</option> times.
46907 </para>
46908 <para>
46909 Before Exim carries out a maildir delivery, it ensures that subdirectories
46910 called <filename>new</filename>, <filename>cur</filename>, and <filename>tmp</filename> exist in the delivery directory. If they
46911 do not exist, Exim tries to create them and any superior directories in their
46912 path, subject to the <option>create_directory</option> and <option>create_file</option> options. If the
46913 <option>maildirfolder_create_regex</option> option is set, and the regular expression it
46914 contains matches the delivery directory, Exim also ensures that a file called
46915 <filename>maildirfolder</filename> exists in the delivery directory. If a missing directory or
46916 <filename>maildirfolder</filename> file cannot be created, delivery is deferred.
46917 </para>
46918 <para>
46919 These features make it possible to use Exim to create all the necessary files
46920 and directories in a maildir mailbox, including subdirectories for maildir++
46921 folders. Consider this example:
46922 </para>
46923 <literallayout class="monospaced">
46924 maildir_format = true
46925 directory = /var/mail/$local_part_data\
46926            ${if eq{$local_part_suffix}{}{}\
46927            {/.${substr_1:$local_part_suffix}}}
46928 maildirfolder_create_regex = /\.[^/]+$
46929 </literallayout>
46930 <para>
46931 If <varname>$local_part_suffix</varname> is empty (there was no suffix for the local part),
46932 delivery is into a toplevel maildir with a name like <filename>/var/mail/pimbo</filename> (for
46933 the user called <emphasis>pimbo</emphasis>). The pattern in <option>maildirfolder_create_regex</option> does
46934 not match this name, so Exim will not look for or create the file
46935 <filename>/var/mail/pimbo/maildirfolder</filename>, though it will create
46936 <filename>/var/mail/pimbo/{cur,new,tmp}</filename> if necessary.
46937 </para>
46938 <para>
46939 However, if <varname>$local_part_suffix</varname> contains <literal>-eximusers</literal> (for example),
46940 delivery is into the maildir++ folder <filename>/var/mail/pimbo/.eximusers</filename>, which
46941 does match <option>maildirfolder_create_regex</option>. In this case, Exim will create
46942 <filename>/var/mail/pimbo/.eximusers/maildirfolder</filename> as well as the three maildir
46943 directories <filename>/var/mail/pimbo/.eximusers/{cur,new,tmp}</filename>.
46944 </para>
46945 <para>
46946 <emphasis role="bold">Warning:</emphasis> Take care when setting <option>maildirfolder_create_regex</option> that it does
46947 not inadvertently match the toplevel maildir directory, because a
46948 <filename>maildirfolder</filename> file at top level would completely break quota calculations.
46949 </para>
46950 <para>
46951 <indexterm role="concept">
46952 <primary>quota</primary>
46953 <secondary>in maildir delivery</secondary>
46954 </indexterm>
46955 <indexterm role="concept">
46956 <primary>maildir++</primary>
46957 </indexterm>
46958 If Exim is required to check a <option>quota</option> setting before a maildir delivery, and
46959 <option>quota_directory</option> is not set, it looks for a file called <filename>maildirfolder</filename> in
46960 the maildir directory (alongside <filename>new</filename>, <filename>cur</filename>, <filename>tmp</filename>). If this exists,
46961 Exim assumes the directory is a maildir++ folder directory, which is one level
46962 down from the user&#x2019;s top level mailbox directory. This causes it to start at
46963 the parent directory instead of the current directory when calculating the
46964 amount of space used.
46965 </para>
46966 <para>
46967 One problem with delivering into a multi-file mailbox is that it is
46968 computationally expensive to compute the size of the mailbox for quota
46969 checking. Various approaches have been taken to reduce the amount of work
46970 needed. The next two sections describe two of them. A third alternative is to
46971 use some external process for maintaining the size data, and use the expansion
46972 of the <option>mailbox_size</option> option as a way of importing it into Exim.
46973 </para>
46974 </section>
46975 <section id="SECID135">
46976 <title>Using tags to record message sizes</title>
46977 <para>
46978 If <option>maildir_tag</option> is set, the string is expanded for each delivery.
46979 When the maildir file is renamed into the <filename>new</filename> sub-directory, the
46980 tag is added to its name. However, if adding the tag takes the length of the
46981 name to the point where the test <function>stat()</function> call fails with ENAMETOOLONG,
46982 the tag is dropped and the maildir file is created with no tag.
46983 </para>
46984 <para>
46985 <indexterm role="variable">
46986 <primary><varname>$message_size</varname></primary>
46987 </indexterm>
46988 Tags can be used to encode the size of files in their names; see
46989 <option>quota_size_regex</option> above for an example. The expansion of <option>maildir_tag</option>
46990 happens after the message has been written. The value of the <varname>$message_size</varname>
46991 variable is set to the number of bytes actually written. If the expansion is
46992 forced to fail, the tag is ignored, but a non-forced failure causes delivery to
46993 be deferred. The expanded tag may contain any printing characters except <quote>/</quote>.
46994 Non-printing characters in the string are ignored; if the resulting string is
46995 empty, it is ignored. If it starts with an alphanumeric character, a leading
46996 colon is inserted; this default has not proven to be the path that popular
46997 maildir implementations have chosen (but changing it in Exim would break
46998 backwards compatibility).
46999 </para>
47000 <para>
47001 For one common implementation, you might set:
47002 </para>
47003 <literallayout class="monospaced">
47004 maildir_tag = ,S=${message_size}
47005 </literallayout>
47006 <para>
47007 but you should check the documentation of the other software to be sure.
47008 </para>
47009 <para>
47010 It is advisable to also set <option>quota_size_regex</option> when setting <option>maildir_tag</option>
47011 as this allows Exim to extract the size from your tag, instead of having to
47012 <function>stat()</function> each message file.
47013 </para>
47014 </section>
47015 <section id="SECID136">
47016 <title>Using a maildirsize file</title>
47017 <para>
47018 <indexterm role="concept">
47019 <primary>quota</primary>
47020 <secondary>in maildir delivery</secondary>
47021 </indexterm>
47022 <indexterm role="concept">
47023 <primary>maildir format</primary>
47024 <secondary><filename>maildirsize</filename> file</secondary>
47025 </indexterm>
47026 If <option>maildir_use_size_file</option> is true, Exim implements the maildir++ rules for
47027 storing quota and message size information in a file called <filename>maildirsize</filename>
47028 within the toplevel maildir directory. If this file does not exist, Exim
47029 creates it, setting the quota from the <option>quota</option> option of the transport. If
47030 the maildir directory itself does not exist, it is created before any attempt
47031 to write a <filename>maildirsize</filename> file.
47032 </para>
47033 <para>
47034 The <filename>maildirsize</filename> file is used to hold information about the sizes of
47035 messages in the maildir, thus speeding up quota calculations. The quota value
47036 in the file is just a cache; if the quota is changed in the transport, the new
47037 value overrides the cached value when the next message is delivered. The cache
47038 is maintained for the benefit of other programs that access the maildir and
47039 need to know the quota.
47040 </para>
47041 <para>
47042 If the <option>quota</option> option in the transport is unset or zero, the <filename>maildirsize</filename>
47043 file is maintained (with a zero quota setting), but no quota is imposed.
47044 </para>
47045 <para>
47046 A regular expression is available for controlling which directories in the
47047 maildir participate in quota calculations when a <filename>maildirsizefile</filename> is in use.
47048 See the description of the <option>maildir_quota_directory_regex</option> option above for
47049 details.
47050 </para>
47051 </section>
47052 <section id="SECID137">
47053 <title>Mailstore delivery</title>
47054 <para>
47055 <indexterm role="concept">
47056 <primary>mailstore format</primary>
47057 <secondary>description of</secondary>
47058 </indexterm>
47059 If the <option>mailstore_format</option> option is true, each message is written as two
47060 files in the given directory. A unique base name is constructed from the
47061 message id and the current delivery process, and the files that are written use
47062 this base name plus the suffixes <filename>.env</filename> and <filename>.msg</filename>. The <filename>.env</filename> file
47063 contains the message&#x2019;s envelope, and the <filename>.msg</filename> file contains the message
47064 itself. The base name is placed in the variable <varname>$mailstore_basename</varname>.
47065 </para>
47066 <para>
47067 During delivery, the envelope is first written to a file with the suffix
47068 <filename>.tmp</filename>. The <filename>.msg</filename> file is then written, and when it is complete, the
47069 <filename>.tmp</filename> file is renamed as the <filename>.env</filename> file. Programs that access messages in
47070 mailstore format should wait for the presence of both a <filename>.msg</filename> and a <filename>.env</filename>
47071 file before accessing either of them. An alternative approach is to wait for
47072 the absence of a <filename>.tmp</filename> file.
47073 </para>
47074 <para>
47075 The envelope file starts with any text defined by the <option>mailstore_prefix</option>
47076 option, expanded and terminated by a newline if there isn&#x2019;t one. Then follows
47077 the sender address on one line, then all the recipient addresses, one per line.
47078 There can be more than one recipient only if the <option>batch_max</option> option is set
47079 greater than one. Finally, <option>mailstore_suffix</option> is expanded and the result
47080 appended to the file, followed by a newline if it does not end with one.
47081 </para>
47082 <para>
47083 If expansion of <option>mailstore_prefix</option> or <option>mailstore_suffix</option> ends with a forced
47084 failure, it is ignored. Other expansion errors are treated as serious
47085 configuration errors, and delivery is deferred. The variable
47086 <varname>$mailstore_basename</varname> is available for use during these expansions.
47087 </para>
47088 </section>
47089 <section id="SECID138">
47090 <title>Non-special new file delivery</title>
47091 <para>
47092 If neither <option>maildir_format</option> nor <option>mailstore_format</option> is set, a single new
47093 file is created directly in the named directory. For example, when delivering
47094 messages into files in batched SMTP format for later delivery to some host (see
47095 section <xref linkend="SECTbatchSMTP"/>), a setting such as
47096 </para>
47097 <literallayout class="monospaced">
47098 directory = /var/bsmtp/$host
47099 </literallayout>
47100 <para>
47101 might be used. A message is written to a file with a temporary name, which is
47102 then renamed when the delivery is complete. The final name is obtained by
47103 expanding the contents of the <option>directory_file</option> option.
47104 <indexterm role="concept" startref="IIDapptra1" class="endofrange"/>
47105 <indexterm role="concept" startref="IIDapptra2" class="endofrange"/>
47106 </para>
47107 </section>
47108 </chapter>
47109
47110 <chapter id="CHID8">
47111 <title>The autoreply transport</title>
47112 <para>
47113 <indexterm role="concept" id="IIDauttra1" class="startofrange">
47114 <primary>transports</primary>
47115 <secondary><command>autoreply</command></secondary>
47116 </indexterm>
47117 <indexterm role="concept" id="IIDauttra2" class="startofrange">
47118 <primary><command>autoreply</command> transport</primary>
47119 </indexterm>
47120 The <command>autoreply</command> transport is not a true transport in that it does not cause
47121 the message to be transmitted. Instead, it generates a new mail message as an
47122 automatic reply to the incoming message. <emphasis>References:</emphasis> and
47123 <emphasis>Auto-Submitted:</emphasis> header lines are included. These are constructed according
47124 to the rules in RFCs 2822 and 3834, respectively.
47125 </para>
47126 <para>
47127 If the router that passes the message to this transport does not have the
47128 <option>unseen</option> option set, the original message (for the current recipient) is not
47129 delivered anywhere. However, when the <option>unseen</option> option is set on the router
47130 that passes the message to this transport, routing of the address continues, so
47131 another router can set up a normal message delivery.
47132 </para>
47133 <para>
47134 The <command>autoreply</command> transport is usually run as the result of mail filtering, a
47135 <quote>vacation</quote> message being the standard example. However, it can also be run
47136 directly from a router like any other transport. To reduce the possibility of
47137 message cascades, messages created by the <command>autoreply</command> transport always have
47138 empty envelope sender addresses, like bounce messages.
47139 </para>
47140 <para>
47141 The parameters of the message to be sent can be specified in the configuration
47142 by options described below. However, these are used only when the address
47143 passed to the transport does not contain its own reply information. When the
47144 transport is run as a consequence of a
47145 <option>mail</option>
47146 or <option>vacation</option> command in a filter file, the parameters of the message are
47147 supplied by the filter, and passed with the address. The transport&#x2019;s options
47148 that define the message are then ignored (so they are not usually set in this
47149 case). The message is specified entirely by the filter or by the transport; it
47150 is never built from a mixture of options. However, the <option>file_optional</option>,
47151 <option>mode</option>, and <option>return_message</option> options apply in all cases.
47152 </para>
47153 <para>
47154 <command>Autoreply</command> is implemented as a local transport. When used as a result of a
47155 command in a user&#x2019;s filter file, <command>autoreply</command> normally runs under the uid and
47156 gid of the user, and with appropriate current and home directories (see chapter
47157 <xref linkend="CHAPenvironment"/>).
47158 </para>
47159 <para>
47160 There is a subtle difference between routing a message to a <command>pipe</command> transport
47161 that generates some text to be returned to the sender, and routing it to an
47162 <command>autoreply</command> transport. This difference is noticeable only if more than one
47163 address from the same message is so handled. In the case of a pipe, the
47164 separate outputs from the different addresses are gathered up and returned to
47165 the sender in a single message, whereas if <command>autoreply</command> is used, a separate
47166 message is generated for each address that is passed to it.
47167 </para>
47168 <para>
47169 Non-printing characters are not permitted in the header lines generated for the
47170 message that <command>autoreply</command> creates, with the exception of newlines that are
47171 immediately followed by white space. If any non-printing characters are found,
47172 the transport defers.
47173 Whether characters with the top bit set count as printing characters or not is
47174 controlled by the <option>print_topbitchars</option> global option.
47175 </para>
47176 <para>
47177 If any of the generic options for manipulating headers (for example,
47178 <option>headers_add</option>) are set on an <command>autoreply</command> transport, they apply to the copy
47179 of the original message that is included in the generated message when
47180 <option>return_message</option> is set. They do not apply to the generated message itself.
47181 </para>
47182 <para>
47183 <indexterm role="variable">
47184 <primary><varname>$sender_address</varname></primary>
47185 </indexterm>
47186 If the <command>autoreply</command> transport receives return code 2 from Exim when it submits
47187 the message, indicating that there were no recipients, it does not treat this
47188 as an error. This means that autoreplies sent to <varname>$sender_address</varname> when this
47189 is empty (because the incoming message is a bounce message) do not cause
47190 problems. They are just discarded.
47191 </para>
47192 <section id="SECID139">
47193 <title>Private options for autoreply</title>
47194 <para>
47195 <indexterm role="concept">
47196 <primary>options</primary>
47197 <secondary><command>autoreply</command> transport</secondary>
47198 </indexterm>
47199 </para>
47200 <para>
47201 <indexterm role="option">
47202 <primary><option>bcc</option></primary>
47203 </indexterm>
47204 </para>
47205 <informaltable frame="all">
47206 <tgroup cols="4" colsep="0" rowsep="0">
47207 <colspec colwidth="8*" align="left"/>
47208 <colspec colwidth="6*" align="center"/>
47209 <colspec colwidth="6*" align="center"/>
47210 <colspec colwidth="6*" align="right"/>
47211 <tbody>
47212 <row>
47213 <entry><option>bcc</option></entry>
47214 <entry>Use: <emphasis>autoreply</emphasis></entry>
47215 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47216 <entry>Default: <emphasis>unset</emphasis></entry>
47217 </row>
47218 </tbody>
47219 </tgroup>
47220 </informaltable>
47221 <para>
47222 This specifies the addresses that are to receive <quote>blind carbon copies</quote> of the
47223 message when the message is specified by the transport.
47224 </para>
47225 <para>
47226 <indexterm role="option">
47227 <primary><option>cc</option></primary>
47228 </indexterm>
47229 </para>
47230 <informaltable frame="all">
47231 <tgroup cols="4" colsep="0" rowsep="0">
47232 <colspec colwidth="8*" align="left"/>
47233 <colspec colwidth="6*" align="center"/>
47234 <colspec colwidth="6*" align="center"/>
47235 <colspec colwidth="6*" align="right"/>
47236 <tbody>
47237 <row>
47238 <entry><option>cc</option></entry>
47239 <entry>Use: <emphasis>autoreply</emphasis></entry>
47240 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47241 <entry>Default: <emphasis>unset</emphasis></entry>
47242 </row>
47243 </tbody>
47244 </tgroup>
47245 </informaltable>
47246 <para>
47247 This specifies recipients of the message and the contents of the <emphasis>Cc:</emphasis> header
47248 when the message is specified by the transport.
47249 </para>
47250 <para>
47251 <indexterm role="option">
47252 <primary><option>file</option></primary>
47253 </indexterm>
47254 </para>
47255 <informaltable frame="all">
47256 <tgroup cols="4" colsep="0" rowsep="0">
47257 <colspec colwidth="8*" align="left"/>
47258 <colspec colwidth="6*" align="center"/>
47259 <colspec colwidth="6*" align="center"/>
47260 <colspec colwidth="6*" align="right"/>
47261 <tbody>
47262 <row>
47263 <entry><option>file</option></entry>
47264 <entry>Use: <emphasis>autoreply</emphasis></entry>
47265 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47266 <entry>Default: <emphasis>unset</emphasis></entry>
47267 </row>
47268 </tbody>
47269 </tgroup>
47270 </informaltable>
47271 <para>
47272 The contents of the file are sent as the body of the message when the message
47273 is specified by the transport. If both <option>file</option> and <option>text</option> are set, the text
47274 string comes first.
47275 </para>
47276 <para>
47277 <indexterm role="option">
47278 <primary><option>file_expand</option></primary>
47279 </indexterm>
47280 </para>
47281 <informaltable frame="all">
47282 <tgroup cols="4" colsep="0" rowsep="0">
47283 <colspec colwidth="8*" align="left"/>
47284 <colspec colwidth="6*" align="center"/>
47285 <colspec colwidth="6*" align="center"/>
47286 <colspec colwidth="6*" align="right"/>
47287 <tbody>
47288 <row>
47289 <entry><option>file_expand</option></entry>
47290 <entry>Use: <emphasis>autoreply</emphasis></entry>
47291 <entry>Type: <emphasis>boolean</emphasis></entry>
47292 <entry>Default: <emphasis>false</emphasis></entry>
47293 </row>
47294 </tbody>
47295 </tgroup>
47296 </informaltable>
47297 <para>
47298 If this is set, the contents of the file named by the <option>file</option> option are
47299 subjected to string expansion as they are added to the message.
47300 </para>
47301 <para>
47302 <indexterm role="option">
47303 <primary><option>file_optional</option></primary>
47304 </indexterm>
47305 </para>
47306 <informaltable frame="all">
47307 <tgroup cols="4" colsep="0" rowsep="0">
47308 <colspec colwidth="8*" align="left"/>
47309 <colspec colwidth="6*" align="center"/>
47310 <colspec colwidth="6*" align="center"/>
47311 <colspec colwidth="6*" align="right"/>
47312 <tbody>
47313 <row>
47314 <entry><option>file_optional</option></entry>
47315 <entry>Use: <emphasis>autoreply</emphasis></entry>
47316 <entry>Type: <emphasis>boolean</emphasis></entry>
47317 <entry>Default: <emphasis>false</emphasis></entry>
47318 </row>
47319 </tbody>
47320 </tgroup>
47321 </informaltable>
47322 <para>
47323 If this option is true, no error is generated if the file named by the <option>file</option>
47324 option or passed with the address does not exist or cannot be read.
47325 </para>
47326 <para>
47327 <indexterm role="option">
47328 <primary><option>from</option></primary>
47329 </indexterm>
47330 </para>
47331 <informaltable frame="all">
47332 <tgroup cols="4" colsep="0" rowsep="0">
47333 <colspec colwidth="8*" align="left"/>
47334 <colspec colwidth="6*" align="center"/>
47335 <colspec colwidth="6*" align="center"/>
47336 <colspec colwidth="6*" align="right"/>
47337 <tbody>
47338 <row>
47339 <entry><option>from</option></entry>
47340 <entry>Use: <emphasis>autoreply</emphasis></entry>
47341 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47342 <entry>Default: <emphasis>unset</emphasis></entry>
47343 </row>
47344 </tbody>
47345 </tgroup>
47346 </informaltable>
47347 <para>
47348 This specifies the contents of the <emphasis>From:</emphasis> header when the message is
47349 specified by the transport.
47350 </para>
47351 <para>
47352 <indexterm role="option">
47353 <primary><option>headers</option></primary>
47354 </indexterm>
47355 </para>
47356 <informaltable frame="all">
47357 <tgroup cols="4" colsep="0" rowsep="0">
47358 <colspec colwidth="8*" align="left"/>
47359 <colspec colwidth="6*" align="center"/>
47360 <colspec colwidth="6*" align="center"/>
47361 <colspec colwidth="6*" align="right"/>
47362 <tbody>
47363 <row>
47364 <entry><option>headers</option></entry>
47365 <entry>Use: <emphasis>autoreply</emphasis></entry>
47366 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47367 <entry>Default: <emphasis>unset</emphasis></entry>
47368 </row>
47369 </tbody>
47370 </tgroup>
47371 </informaltable>
47372 <para>
47373 This specifies additional RFC 2822 headers that are to be added to the message
47374 when the message is specified by the transport. Several can be given by using
47375 <quote>\n</quote> to separate them. There is no check on the format.
47376 </para>
47377 <para>
47378 <indexterm role="option">
47379 <primary><option>log</option></primary>
47380 </indexterm>
47381 </para>
47382 <informaltable frame="all">
47383 <tgroup cols="4" colsep="0" rowsep="0">
47384 <colspec colwidth="8*" align="left"/>
47385 <colspec colwidth="6*" align="center"/>
47386 <colspec colwidth="6*" align="center"/>
47387 <colspec colwidth="6*" align="right"/>
47388 <tbody>
47389 <row>
47390 <entry><option>log</option></entry>
47391 <entry>Use: <emphasis>autoreply</emphasis></entry>
47392 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47393 <entry>Default: <emphasis>unset</emphasis></entry>
47394 </row>
47395 </tbody>
47396 </tgroup>
47397 </informaltable>
47398 <para>
47399 This option names a file in which a record of every message sent is logged when
47400 the message is specified by the transport.
47401 </para>
47402 <para>
47403 <indexterm role="option">
47404 <primary><option>mode</option></primary>
47405 </indexterm>
47406 </para>
47407 <informaltable frame="all">
47408 <tgroup cols="4" colsep="0" rowsep="0">
47409 <colspec colwidth="8*" align="left"/>
47410 <colspec colwidth="6*" align="center"/>
47411 <colspec colwidth="6*" align="center"/>
47412 <colspec colwidth="6*" align="right"/>
47413 <tbody>
47414 <row>
47415 <entry><option>mode</option></entry>
47416 <entry>Use: <emphasis>autoreply</emphasis></entry>
47417 <entry>Type: <emphasis>octal integer</emphasis></entry>
47418 <entry>Default: <emphasis>0600</emphasis></entry>
47419 </row>
47420 </tbody>
47421 </tgroup>
47422 </informaltable>
47423 <para>
47424 If either the log file or the <quote>once</quote> file has to be created, this mode is
47425 used.
47426 </para>
47427 <para>
47428 <indexterm role="option">
47429 <primary><option>never_mail</option></primary>
47430 </indexterm>
47431 </para>
47432 <informaltable frame="all">
47433 <tgroup cols="4" colsep="0" rowsep="0">
47434 <colspec colwidth="8*" align="left"/>
47435 <colspec colwidth="6*" align="center"/>
47436 <colspec colwidth="6*" align="center"/>
47437 <colspec colwidth="6*" align="right"/>
47438 <tbody>
47439 <row>
47440 <entry><option>never_mail</option></entry>
47441 <entry>Use: <emphasis>autoreply</emphasis></entry>
47442 <entry>Type: <emphasis>address list</emphasis>&dagger;<emphasis></emphasis></entry>
47443 <entry>Default: <emphasis>unset</emphasis></entry>
47444 </row>
47445 </tbody>
47446 </tgroup>
47447 </informaltable>
47448 <para>
47449 If any run of the transport creates a message with a recipient that matches any
47450 item in the list, that recipient is quietly discarded. If all recipients are
47451 discarded, no message is created. This applies both when the recipients are
47452 generated by a filter and when they are specified in the transport.
47453 </para>
47454 <para>
47455 <indexterm role="option">
47456 <primary><option>once</option></primary>
47457 </indexterm>
47458 </para>
47459 <informaltable frame="all">
47460 <tgroup cols="4" colsep="0" rowsep="0">
47461 <colspec colwidth="8*" align="left"/>
47462 <colspec colwidth="6*" align="center"/>
47463 <colspec colwidth="6*" align="center"/>
47464 <colspec colwidth="6*" align="right"/>
47465 <tbody>
47466 <row>
47467 <entry><option>once</option></entry>
47468 <entry>Use: <emphasis>autoreply</emphasis></entry>
47469 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47470 <entry>Default: <emphasis>unset</emphasis></entry>
47471 </row>
47472 </tbody>
47473 </tgroup>
47474 </informaltable>
47475 <para>
47476 This option names a file or DBM database in which a record of each <emphasis>To:</emphasis>
47477 recipient is kept when the message is specified by the transport. <emphasis role="bold">Note</emphasis>:
47478 This does not apply to <emphasis>Cc:</emphasis> or <emphasis>Bcc:</emphasis> recipients.
47479 </para>
47480 <para>
47481 If <option>once</option> is unset, or is set to an empty string, the message is always sent.
47482 By default, if <option>once</option> is set to a non-empty filename, the message
47483 is not sent if a potential recipient is already listed in the database.
47484 However, if the <option>once_repeat</option> option specifies a time greater than zero, the
47485 message is sent if that much time has elapsed since a message was last sent to
47486 this recipient. A setting of zero time for <option>once_repeat</option> (the default)
47487 prevents a message from being sent a second time &ndash; in this case, zero means
47488 infinity.
47489 </para>
47490 <para>
47491 If <option>once_file_size</option> is zero, a DBM database is used to remember recipients,
47492 and it is allowed to grow as large as necessary. If <option>once_file_size</option> is set
47493 greater than zero, it changes the way Exim implements the <option>once</option> option.
47494 Instead of using a DBM file to record every recipient it sends to, it uses a
47495 regular file, whose size will never get larger than the given value.
47496 </para>
47497 <para>
47498 In the file, Exim keeps a linear list of recipient addresses and the times at
47499 which they were sent messages. If the file is full when a new address needs to
47500 be added, the oldest address is dropped. If <option>once_repeat</option> is not set, this
47501 means that a given recipient may receive multiple messages, but at
47502 unpredictable intervals that depend on the rate of turnover of addresses in the
47503 file. If <option>once_repeat</option> is set, it specifies a maximum time between repeats.
47504 </para>
47505 <para>
47506 <indexterm role="option">
47507 <primary><option>once_file_size</option></primary>
47508 </indexterm>
47509 </para>
47510 <informaltable frame="all">
47511 <tgroup cols="4" colsep="0" rowsep="0">
47512 <colspec colwidth="8*" align="left"/>
47513 <colspec colwidth="6*" align="center"/>
47514 <colspec colwidth="6*" align="center"/>
47515 <colspec colwidth="6*" align="right"/>
47516 <tbody>
47517 <row>
47518 <entry><option>once_file_size</option></entry>
47519 <entry>Use: <emphasis>autoreply</emphasis></entry>
47520 <entry>Type: <emphasis>integer</emphasis></entry>
47521 <entry>Default: <emphasis>0</emphasis></entry>
47522 </row>
47523 </tbody>
47524 </tgroup>
47525 </informaltable>
47526 <para>
47527 See <option>once</option> above.
47528 </para>
47529 <para>
47530 <indexterm role="option">
47531 <primary><option>once_repeat</option></primary>
47532 </indexterm>
47533 </para>
47534 <informaltable frame="all">
47535 <tgroup cols="4" colsep="0" rowsep="0">
47536 <colspec colwidth="8*" align="left"/>
47537 <colspec colwidth="6*" align="center"/>
47538 <colspec colwidth="6*" align="center"/>
47539 <colspec colwidth="6*" align="right"/>
47540 <tbody>
47541 <row>
47542 <entry><option>once_repeat</option></entry>
47543 <entry>Use: <emphasis>autoreply</emphasis></entry>
47544 <entry>Type: <emphasis>time</emphasis>&dagger;<emphasis></emphasis></entry>
47545 <entry>Default: <emphasis>0s</emphasis></entry>
47546 </row>
47547 </tbody>
47548 </tgroup>
47549 </informaltable>
47550 <para>
47551 See <option>once</option> above.
47552 After expansion, the value of this option must be a valid time value.
47553 </para>
47554 <para>
47555 <indexterm role="option">
47556 <primary><option>reply_to</option></primary>
47557 </indexterm>
47558 </para>
47559 <informaltable frame="all">
47560 <tgroup cols="4" colsep="0" rowsep="0">
47561 <colspec colwidth="8*" align="left"/>
47562 <colspec colwidth="6*" align="center"/>
47563 <colspec colwidth="6*" align="center"/>
47564 <colspec colwidth="6*" align="right"/>
47565 <tbody>
47566 <row>
47567 <entry><option>reply_to</option></entry>
47568 <entry>Use: <emphasis>autoreply</emphasis></entry>
47569 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47570 <entry>Default: <emphasis>unset</emphasis></entry>
47571 </row>
47572 </tbody>
47573 </tgroup>
47574 </informaltable>
47575 <para>
47576 This specifies the contents of the <emphasis>Reply-To:</emphasis> header when the message is
47577 specified by the transport.
47578 </para>
47579 <para>
47580 <indexterm role="option">
47581 <primary><option>return_message</option></primary>
47582 </indexterm>
47583 </para>
47584 <informaltable frame="all">
47585 <tgroup cols="4" colsep="0" rowsep="0">
47586 <colspec colwidth="8*" align="left"/>
47587 <colspec colwidth="6*" align="center"/>
47588 <colspec colwidth="6*" align="center"/>
47589 <colspec colwidth="6*" align="right"/>
47590 <tbody>
47591 <row>
47592 <entry><option>return_message</option></entry>
47593 <entry>Use: <emphasis>autoreply</emphasis></entry>
47594 <entry>Type: <emphasis>boolean</emphasis></entry>
47595 <entry>Default: <emphasis>false</emphasis></entry>
47596 </row>
47597 </tbody>
47598 </tgroup>
47599 </informaltable>
47600 <para>
47601 If this is set, a copy of the original message is returned with the new
47602 message, subject to the maximum size set in the <option>return_size_limit</option> global
47603 configuration option.
47604 </para>
47605 <para>
47606 <indexterm role="option">
47607 <primary><option>subject</option></primary>
47608 </indexterm>
47609 </para>
47610 <informaltable frame="all">
47611 <tgroup cols="4" colsep="0" rowsep="0">
47612 <colspec colwidth="8*" align="left"/>
47613 <colspec colwidth="6*" align="center"/>
47614 <colspec colwidth="6*" align="center"/>
47615 <colspec colwidth="6*" align="right"/>
47616 <tbody>
47617 <row>
47618 <entry><option>subject</option></entry>
47619 <entry>Use: <emphasis>autoreply</emphasis></entry>
47620 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47621 <entry>Default: <emphasis>unset</emphasis></entry>
47622 </row>
47623 </tbody>
47624 </tgroup>
47625 </informaltable>
47626 <para>
47627 This specifies the contents of the <emphasis>Subject:</emphasis> header when the message is
47628 specified by the transport. It is tempting to quote the original subject in
47629 automatic responses. For example:
47630 </para>
47631 <literallayout class="monospaced">
47632 subject = Re: $h_subject:
47633 </literallayout>
47634 <para>
47635 There is a danger in doing this, however. It may allow a third party to
47636 subscribe your users to an opt-in mailing list, provided that the list accepts
47637 bounce messages as subscription confirmations. Well-managed lists require a
47638 non-bounce message to confirm a subscription, so the danger is relatively
47639 small.
47640 </para>
47641 <para>
47642 <indexterm role="option">
47643 <primary><option>text</option></primary>
47644 </indexterm>
47645 </para>
47646 <informaltable frame="all">
47647 <tgroup cols="4" colsep="0" rowsep="0">
47648 <colspec colwidth="8*" align="left"/>
47649 <colspec colwidth="6*" align="center"/>
47650 <colspec colwidth="6*" align="center"/>
47651 <colspec colwidth="6*" align="right"/>
47652 <tbody>
47653 <row>
47654 <entry><option>text</option></entry>
47655 <entry>Use: <emphasis>autoreply</emphasis></entry>
47656 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47657 <entry>Default: <emphasis>unset</emphasis></entry>
47658 </row>
47659 </tbody>
47660 </tgroup>
47661 </informaltable>
47662 <para>
47663 This specifies a single string to be used as the body of the message when the
47664 message is specified by the transport. If both <option>text</option> and <option>file</option> are set,
47665 the text comes first.
47666 </para>
47667 <para>
47668 <indexterm role="option">
47669 <primary><option>to</option></primary>
47670 </indexterm>
47671 </para>
47672 <informaltable frame="all">
47673 <tgroup cols="4" colsep="0" rowsep="0">
47674 <colspec colwidth="8*" align="left"/>
47675 <colspec colwidth="6*" align="center"/>
47676 <colspec colwidth="6*" align="center"/>
47677 <colspec colwidth="6*" align="right"/>
47678 <tbody>
47679 <row>
47680 <entry><option>to</option></entry>
47681 <entry>Use: <emphasis>autoreply</emphasis></entry>
47682 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47683 <entry>Default: <emphasis>unset</emphasis></entry>
47684 </row>
47685 </tbody>
47686 </tgroup>
47687 </informaltable>
47688 <para>
47689 This specifies recipients of the message and the contents of the <emphasis>To:</emphasis> header
47690 when the message is specified by the transport.
47691 <indexterm role="concept" startref="IIDauttra1" class="endofrange"/>
47692 <indexterm role="concept" startref="IIDauttra2" class="endofrange"/>
47693 </para>
47694 </section>
47695 </chapter>
47696
47697 <chapter id="CHAPLMTP">
47698 <title>The lmtp transport</title>
47699 <para>
47700 <indexterm role="concept">
47701 <primary>transports</primary>
47702 <secondary><command>lmtp</command></secondary>
47703 </indexterm>
47704 <indexterm role="concept">
47705 <primary><command>lmtp</command> transport</primary>
47706 </indexterm>
47707 <indexterm role="concept">
47708 <primary>LMTP</primary>
47709 <secondary>over a pipe</secondary>
47710 </indexterm>
47711 <indexterm role="concept">
47712 <primary>LMTP</primary>
47713 <secondary>over a socket</secondary>
47714 </indexterm>
47715 The <command>lmtp</command> transport runs the LMTP protocol (RFC 2033) over a pipe to a
47716 specified command
47717 or by interacting with a Unix domain socket.
47718 This transport is something of a cross between the <command>pipe</command> and <command>smtp</command>
47719 transports. Exim also has support for using LMTP over TCP/IP; this is
47720 implemented as an option for the <command>smtp</command> transport. Because LMTP is expected
47721 to be of minority interest, the default build-time configure in <filename>src/EDITME</filename>
47722 has it commented out. You need to ensure that
47723 </para>
47724 <literallayout class="monospaced">
47725 TRANSPORT_LMTP=yes
47726 </literallayout>
47727 <para>
47728 <indexterm role="concept">
47729 <primary>options</primary>
47730 <secondary><command>lmtp</command> transport</secondary>
47731 </indexterm>
47732 is present in your <filename>Local/Makefile</filename> in order to have the <command>lmtp</command> transport
47733 included in the Exim binary. The private options of the <command>lmtp</command> transport are
47734 as follows:
47735 </para>
47736 <para>
47737 <indexterm role="option">
47738 <primary><option>batch_id</option></primary>
47739 </indexterm>
47740 </para>
47741 <informaltable frame="all">
47742 <tgroup cols="4" colsep="0" rowsep="0">
47743 <colspec colwidth="8*" align="left"/>
47744 <colspec colwidth="6*" align="center"/>
47745 <colspec colwidth="6*" align="center"/>
47746 <colspec colwidth="6*" align="right"/>
47747 <tbody>
47748 <row>
47749 <entry><option>batch_id</option></entry>
47750 <entry>Use: <emphasis>lmtp</emphasis></entry>
47751 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47752 <entry>Default: <emphasis>unset</emphasis></entry>
47753 </row>
47754 </tbody>
47755 </tgroup>
47756 </informaltable>
47757 <para>
47758 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
47759 </para>
47760 <para>
47761 <indexterm role="option">
47762 <primary><option>batch_max</option></primary>
47763 </indexterm>
47764 </para>
47765 <informaltable frame="all">
47766 <tgroup cols="4" colsep="0" rowsep="0">
47767 <colspec colwidth="8*" align="left"/>
47768 <colspec colwidth="6*" align="center"/>
47769 <colspec colwidth="6*" align="center"/>
47770 <colspec colwidth="6*" align="right"/>
47771 <tbody>
47772 <row>
47773 <entry><option>batch_max</option></entry>
47774 <entry>Use: <emphasis>lmtp</emphasis></entry>
47775 <entry>Type: <emphasis>integer</emphasis></entry>
47776 <entry>Default: <emphasis>1</emphasis></entry>
47777 </row>
47778 </tbody>
47779 </tgroup>
47780 </informaltable>
47781 <para>
47782 This limits the number of addresses that can be handled in a single delivery.
47783 Most LMTP servers can handle several addresses at once, so it is normally a
47784 good idea to increase this value. See the description of local delivery
47785 batching in chapter <xref linkend="CHAPbatching"/>.
47786 </para>
47787 <para>
47788 <indexterm role="option">
47789 <primary><option>command</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>command</option></entry>
47801 <entry>Use: <emphasis>lmtp</emphasis></entry>
47802 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47803 <entry>Default: <emphasis>unset</emphasis></entry>
47804 </row>
47805 </tbody>
47806 </tgroup>
47807 </informaltable>
47808 <para>
47809 This option must be set if <option>socket</option> is not set. The string is a command which
47810 is run in a separate process. It is split up into a command name and list of
47811 arguments, each of which is separately expanded (so expansion cannot change the
47812 number of arguments). The command is run directly, not via a shell. The message
47813 is passed to the new process using the standard input and output to operate the
47814 LMTP protocol.
47815 </para>
47816 <para>
47817 <indexterm role="option">
47818 <primary><option>ignore_quota</option></primary>
47819 </indexterm>
47820 </para>
47821 <informaltable frame="all">
47822 <tgroup cols="4" colsep="0" rowsep="0">
47823 <colspec colwidth="8*" align="left"/>
47824 <colspec colwidth="6*" align="center"/>
47825 <colspec colwidth="6*" align="center"/>
47826 <colspec colwidth="6*" align="right"/>
47827 <tbody>
47828 <row>
47829 <entry><option>ignore_quota</option></entry>
47830 <entry>Use: <emphasis>lmtp</emphasis></entry>
47831 <entry>Type: <emphasis>boolean</emphasis></entry>
47832 <entry>Default: <emphasis>false</emphasis></entry>
47833 </row>
47834 </tbody>
47835 </tgroup>
47836 </informaltable>
47837 <para>
47838 <indexterm role="concept">
47839 <primary>LMTP</primary>
47840 <secondary>ignoring quota errors</secondary>
47841 </indexterm>
47842 If this option is set true, the string <literal>IGNOREQUOTA</literal> is added to RCPT
47843 commands, provided that the LMTP server has advertised support for IGNOREQUOTA
47844 in its response to the LHLO command.
47845 </para>
47846 <para>
47847 <indexterm role="option">
47848 <primary><option>socket</option></primary>
47849 </indexterm>
47850 </para>
47851 <informaltable frame="all">
47852 <tgroup cols="4" colsep="0" rowsep="0">
47853 <colspec colwidth="8*" align="left"/>
47854 <colspec colwidth="6*" align="center"/>
47855 <colspec colwidth="6*" align="center"/>
47856 <colspec colwidth="6*" align="right"/>
47857 <tbody>
47858 <row>
47859 <entry><option>socket</option></entry>
47860 <entry>Use: <emphasis>lmtp</emphasis></entry>
47861 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
47862 <entry>Default: <emphasis>unset</emphasis></entry>
47863 </row>
47864 </tbody>
47865 </tgroup>
47866 </informaltable>
47867 <para>
47868 This option must be set if <option>command</option> is not set. The result of expansion must
47869 be the name of a Unix domain socket. The transport connects to the socket and
47870 delivers the message to it using the LMTP protocol.
47871 </para>
47872 <para>
47873 <indexterm role="option">
47874 <primary><option>timeout</option></primary>
47875 </indexterm>
47876 </para>
47877 <informaltable frame="all">
47878 <tgroup cols="4" colsep="0" rowsep="0">
47879 <colspec colwidth="8*" align="left"/>
47880 <colspec colwidth="6*" align="center"/>
47881 <colspec colwidth="6*" align="center"/>
47882 <colspec colwidth="6*" align="right"/>
47883 <tbody>
47884 <row>
47885 <entry><option>timeout</option></entry>
47886 <entry>Use: <emphasis>lmtp</emphasis></entry>
47887 <entry>Type: <emphasis>time</emphasis></entry>
47888 <entry>Default: <emphasis>5m</emphasis></entry>
47889 </row>
47890 </tbody>
47891 </tgroup>
47892 </informaltable>
47893 <para>
47894 The transport is aborted if the created process or Unix domain socket does not
47895 respond to LMTP commands or message input within this timeout. Delivery
47896 is deferred, and will be tried again later. Here is an example of a typical
47897 LMTP transport:
47898 </para>
47899 <literallayout class="monospaced">
47900 lmtp:
47901   driver = lmtp
47902   command = /some/local/lmtp/delivery/program
47903   batch_max = 20
47904   user = exim
47905 </literallayout>
47906 <para>
47907 This delivers up to 20 addresses at a time, in a mixture of domains if
47908 necessary, running as the user <emphasis>exim</emphasis>.
47909 </para>
47910 </chapter>
47911
47912 <chapter id="CHAPpipetransport">
47913 <title>The pipe transport</title>
47914 <para>
47915 <indexterm role="concept" id="IIDpiptra1" class="startofrange">
47916 <primary>transports</primary>
47917 <secondary><command>pipe</command></secondary>
47918 </indexterm>
47919 <indexterm role="concept" id="IIDpiptra2" class="startofrange">
47920 <primary><command>pipe</command> transport</primary>
47921 </indexterm>
47922 The <command>pipe</command> transport is used to deliver messages via a pipe to a command
47923 running in another process. One example is the use of <command>pipe</command> as a
47924 pseudo-remote transport for passing messages to some other delivery mechanism
47925 (such as UUCP). Another is the use by individual users to automatically process
47926 their incoming messages. The <command>pipe</command> transport can be used in one of the
47927 following ways:
47928 </para>
47929 <itemizedlist>
47930 <listitem>
47931 <para>
47932 <indexterm role="variable">
47933 <primary><varname>$local_part</varname></primary>
47934 </indexterm>
47935 A router routes one address to a transport in the normal way, and the
47936 transport is configured as a <command>pipe</command> transport. In this case, <varname>$local_part</varname>
47937 contains the local part of the address (as usual), and the command that is run
47938 is specified by the <option>command</option> option on the transport.
47939 </para>
47940 </listitem>
47941 <listitem>
47942 <para>
47943 <indexterm role="variable">
47944 <primary><varname>$pipe_addresses</varname></primary>
47945 </indexterm>
47946 If the <option>batch_max</option> option is set greater than 1 (the default is 1), the
47947 transport can handle more than one address in a single run. In this case, when
47948 more than one address is routed to the transport, <varname>$local_part</varname> is not set
47949 (because it is not unique). However, the pseudo-variable <varname>$pipe_addresses</varname>
47950 (described in section <xref linkend="SECThowcommandrun"/> below) contains all the addresses
47951 that are routed to the transport.
47952 </para>
47953 </listitem>
47954 <listitem>
47955 <para>
47956 <indexterm role="variable">
47957 <primary><varname>$address_pipe</varname></primary>
47958 </indexterm>
47959 A router redirects an address directly to a pipe command (for example, from an
47960 alias or forward file). In this case, <varname>$address_pipe</varname> contains the text of the
47961 pipe command, and the <option>command</option> option on the transport is ignored unless
47962 <option>force_command</option> is set. If only one address is being transported
47963 (<option>batch_max</option> is not greater than one, or only one address was redirected to
47964 this pipe command), <varname>$local_part</varname> contains the local part that was redirected.
47965 </para>
47966 </listitem>
47967 </itemizedlist>
47968 <para>
47969 The <command>pipe</command> transport is a non-interactive delivery method. Exim can also
47970 deliver messages over pipes using the LMTP interactive protocol. This is
47971 implemented by the <command>lmtp</command> transport.
47972 </para>
47973 <para>
47974 In the case when <command>pipe</command> is run as a consequence of an entry in a local user&#x2019;s
47975 <filename>.forward</filename> file, the command runs under the uid and gid of that user. In
47976 other cases, the uid and gid have to be specified explicitly, either on the
47977 transport or on the router that handles the address. Current and <quote>home</quote>
47978 directories are also controllable. See chapter <xref linkend="CHAPenvironment"/> for
47979 details of the local delivery environment and chapter <xref linkend="CHAPbatching"/>
47980 for a discussion of local delivery batching.
47981 </para>
47982 <para>
47983 <indexterm role="concept">
47984 <primary>tainted data</primary>
47985 <secondary>in pipe command</secondary>
47986 </indexterm>
47987 <indexterm role="concept">
47988 <primary>pipe</primary>
47989 <secondary>tainted data</secondary>
47990 </indexterm>
47991 Tainted data may not be used for the command name.
47992 </para>
47993 <section id="SECID140">
47994 <title>Concurrent delivery</title>
47995 <para>
47996 If two messages arrive at almost the same time, and both are routed to a pipe
47997 delivery, the two pipe transports may be run concurrently. You must ensure that
47998 any pipe commands you set up are robust against this happening. If the commands
47999 write to a file, the <option>exim_lock</option> utility might be of use.
48000 Alternatively the <option>max_parallel</option> option could be used with a value
48001 of "1" to enforce serialization.
48002 </para>
48003 </section>
48004 <section id="SECID141">
48005 <title>Returned status and data</title>
48006 <para>
48007 <indexterm role="concept">
48008 <primary><command>pipe</command> transport</primary>
48009 <secondary>returned data</secondary>
48010 </indexterm>
48011 If the command exits with a non-zero return code, the delivery is deemed to
48012 have failed, unless either the <option>ignore_status</option> option is set (in which case
48013 the return code is treated as zero), or the return code is one of those listed
48014 in the <option>temp_errors</option> option, which are interpreted as meaning <quote>try again
48015 later</quote>. In this case, delivery is deferred. Details of a permanent failure are
48016 logged, but are not included in the bounce message, which merely contains
48017 <quote>local delivery failed</quote>.
48018 </para>
48019 <para>
48020 If the command exits on a signal and the <option>freeze_signal</option> option is set then
48021 the message will be frozen in the queue. If that option is not set, a bounce
48022 will be sent as normal.
48023 </para>
48024 <para>
48025 If the return code is greater than 128 and the command being run is a shell
48026 script, it normally means that the script was terminated by a signal whose
48027 value is the return code minus 128. The <option>freeze_signal</option> option does not
48028 apply in this case.
48029 </para>
48030 <para>
48031 If Exim is unable to run the command (that is, if <function>execve()</function> fails), the
48032 return code is set to 127. This is the value that a shell returns if it is
48033 asked to run a non-existent command. The wording for the log line suggests that
48034 a non-existent command may be the problem.
48035 </para>
48036 <para>
48037 The <option>return_output</option> option can affect the result of a pipe delivery. If it is
48038 set and the command produces any output on its standard output or standard
48039 error streams, the command is considered to have failed, even if it gave a zero
48040 return code or if <option>ignore_status</option> is set. The output from the command is
48041 included as part of the bounce message. The <option>return_fail_output</option> option is
48042 similar, except that output is returned only when the command exits with a
48043 failure return code, that is, a value other than zero or a code that matches
48044 <option>temp_errors</option>.
48045 </para>
48046 </section>
48047 <section id="SECThowcommandrun">
48048 <title>How the command is run</title>
48049 <para>
48050 <indexterm role="concept">
48051 <primary><command>pipe</command> transport</primary>
48052 <secondary>path for command</secondary>
48053 </indexterm>
48054 The command line is (by default) broken down into a command name and arguments
48055 by the <command>pipe</command> transport itself. The <option>allow_commands</option> and
48056 <option>restrict_to_path</option> options can be used to restrict the commands that may be
48057 run.
48058 </para>
48059 <para>
48060 <indexterm role="concept">
48061 <primary>quoting</primary>
48062 <secondary>in pipe command</secondary>
48063 </indexterm>
48064 Unquoted arguments are delimited by white space. If an argument appears in
48065 double quotes, backslash is interpreted as an escape character in the usual
48066 way. If an argument appears in single quotes, no escaping is done.
48067 </para>
48068 <para>
48069 String expansion is applied to the command line except when it comes from a
48070 traditional <filename>.forward</filename> file (commands from a filter file are expanded). The
48071 expansion is applied to each argument in turn rather than to the whole line.
48072 For this reason, any string expansion item that contains white space must be
48073 quoted so as to be contained within a single argument. A setting such as
48074 </para>
48075 <literallayout class="monospaced">
48076 command = /some/path ${if eq{$local_part}{postmaster}{xx}{yy}}
48077 </literallayout>
48078 <para>
48079 will not work, because the expansion item gets split between several
48080 arguments. You have to write
48081 </para>
48082 <literallayout class="monospaced">
48083 command = /some/path "${if eq{$local_part}{postmaster}{xx}{yy}}"
48084 </literallayout>
48085 <para>
48086 to ensure that it is all in one argument. The expansion is done in this way,
48087 argument by argument, so that the number of arguments cannot be changed as a
48088 result of expansion, and quotes or backslashes in inserted variables do not
48089 interact with external quoting. However, this leads to problems if you want to
48090 generate multiple arguments (or the command name plus arguments) from a single
48091 expansion. In this situation, the simplest solution is to use a shell. For
48092 example:
48093 </para>
48094 <literallayout class="monospaced">
48095 command = /bin/sh -c ${lookup{$local_part}lsearch{/some/file}}
48096 </literallayout>
48097 <para>
48098 <indexterm role="concept">
48099 <primary>transport</primary>
48100 <secondary>filter</secondary>
48101 </indexterm>
48102 <indexterm role="concept">
48103 <primary>filter</primary>
48104 <secondary>transport filter</secondary>
48105 </indexterm>
48106 <indexterm role="variable">
48107 <primary><varname>$pipe_addresses</varname></primary>
48108 </indexterm>
48109 Special handling takes place when an argument consists of precisely the text
48110 <literal>$pipe_addresses</literal> (no quotes).
48111 This is not a general expansion variable; the only
48112 place this string is recognized is when it appears as an argument for a pipe or
48113 transport filter command. It causes each address that is being handled to be
48114 inserted in the argument list at that point <emphasis>as a separate argument</emphasis>. This
48115 avoids any problems with spaces or shell metacharacters, and is of use when a
48116 <command>pipe</command> transport is handling groups of addresses in a batch.
48117 </para>
48118 <para>
48119 If <option>force_command</option> is enabled on the transport, special handling takes place
48120 for an argument that consists of precisely the text <literal>$address_pipe</literal>.  It
48121 is handled similarly to <varname>$pipe_addresses</varname> above.  It is expanded and each
48122 argument is inserted in the argument list at that point
48123 <emphasis>as a separate argument</emphasis>.  The <literal>$address_pipe</literal> item does not need to be
48124 the only item in the argument; in fact, if it were then <option>force_command</option>
48125 should behave as a no-op.  Rather, it should be used to adjust the command
48126 run while preserving the argument vector separation.
48127 </para>
48128 <para>
48129 After splitting up into arguments and expansion, the resulting command is run
48130 in a subprocess directly from the transport, <emphasis>not</emphasis> under a shell. The
48131 message that is being delivered is supplied on the standard input, and the
48132 standard output and standard error are both connected to a single pipe that is
48133 read by Exim. The <option>max_output</option> option controls how much output the command
48134 may produce, and the <option>return_output</option> and <option>return_fail_output</option> options
48135 control what is done with it.
48136 </para>
48137 <para>
48138 Not running the command under a shell (by default) lessens the security risks
48139 in cases when a command from a user&#x2019;s filter file is built out of data that was
48140 taken from an incoming message. If a shell is required, it can of course be
48141 explicitly specified as the command to be run. However, there are circumstances
48142 where existing commands (for example, in <filename>.forward</filename> files) expect to be run
48143 under a shell and cannot easily be modified. To allow for these cases, there is
48144 an option called <option>use_shell</option>, which changes the way the <command>pipe</command> transport
48145 works. Instead of breaking up the command line as just described, it expands it
48146 as a single string and passes the result to <filename>/bin/sh</filename>. The
48147 <option>restrict_to_path</option> option and the <varname>$pipe_addresses</varname> facility cannot be used
48148 with <option>use_shell</option>, and the whole mechanism is inherently less secure.
48149 </para>
48150 </section>
48151 <section id="SECTpipeenv">
48152 <title>Environment variables</title>
48153 <para>
48154 <indexterm role="concept">
48155 <primary><command>pipe</command> transport</primary>
48156 <secondary>environment for command</secondary>
48157 </indexterm>
48158 <indexterm role="concept">
48159 <primary>environment</primary>
48160 <secondary><command>pipe</command> transport</secondary>
48161 </indexterm>
48162 The environment variables listed below are set up when the command is invoked.
48163 This list is a compromise for maximum compatibility with other MTAs. Note that
48164 the <option>environment</option> option can be used to add additional variables to this
48165 environment. The environment for the <command>pipe</command> transport is not subject
48166 to the <option>add_environment</option> and <option>keep_environment</option> main config options.
48167 </para>
48168 <para revisionflag="changed">
48169 <emphasis role="bold">Note</emphasis>: Using enviroment variables loses track of tainted data.
48170 Writers of <command>pipe</command> transport commands should be wary of data supplied
48171 by potential attackers.
48172 </para>
48173 <literallayout>
48174 <literal>DOMAIN            </literal>   the domain of the address
48175 <literal>HOME              </literal>   the home directory, if set
48176 <literal>HOST              </literal>   the host name when called from a router (see below)
48177 <literal>LOCAL_PART        </literal>   see below
48178 <literal>LOCAL_PART_PREFIX </literal>   see below
48179 <literal>LOCAL_PART_SUFFIX </literal>   see below
48180 <literal>LOGNAME           </literal>   see below
48181 <literal>MESSAGE_ID        </literal>   Exim&#x2019;s local ID for the message
48182 <literal>PATH              </literal>   as specified by the <option>path</option> option below
48183 <literal>QUALIFY_DOMAIN    </literal>   the sender qualification domain
48184 <literal>RECIPIENT         </literal>   the complete recipient address
48185 <literal>SENDER            </literal>   the sender of the message (empty if a bounce)
48186 <literal>SHELL             </literal>   <literal>/bin/sh</literal>
48187 <literal>TZ                </literal>   the value of the <option>timezone</option> option, if set
48188 <literal>USER              </literal>   see below
48189 </literallayout>
48190 <para>
48191 When a <command>pipe</command> transport is called directly from (for example) an <command>accept</command>
48192 router, LOCAL_PART is set to the local part of the address. When it is
48193 called as a result of a forward or alias expansion, LOCAL_PART is set to
48194 the local part of the address that was expanded. In both cases, any affixes are
48195 removed from the local part, and made available in LOCAL_PART_PREFIX and
48196 LOCAL_PART_SUFFIX, respectively. LOGNAME and USER are set to the
48197 same value as LOCAL_PART for compatibility with other MTAs.
48198 </para>
48199 <para>
48200 <indexterm role="concept">
48201 <primary>HOST</primary>
48202 </indexterm>
48203 HOST is set only when a <command>pipe</command> transport is called from a router that
48204 associates hosts with an address, typically when using <command>pipe</command> as a
48205 pseudo-remote transport. HOST is set to the first host name specified by
48206 the router.
48207 </para>
48208 <para>
48209 <indexterm role="concept">
48210 <primary>HOME</primary>
48211 </indexterm>
48212 If the transport&#x2019;s generic <option>home_directory</option> option is set, its value is used
48213 for the HOME environment variable. Otherwise, a home directory may be set
48214 by the router&#x2019;s <option>transport_home_directory</option> option, which defaults to the
48215 user&#x2019;s home directory if <option>check_local_user</option> is set.
48216 </para>
48217 </section>
48218 <section id="SECID142">
48219 <title>Private options for pipe</title>
48220 <para>
48221 <indexterm role="concept">
48222 <primary>options</primary>
48223 <secondary><command>pipe</command> transport</secondary>
48224 </indexterm>
48225 </para>
48226 <para>
48227 <indexterm role="option">
48228 <primary><option>allow_commands</option></primary>
48229 </indexterm>
48230 </para>
48231 <informaltable frame="all">
48232 <tgroup cols="4" colsep="0" rowsep="0">
48233 <colspec colwidth="8*" align="left"/>
48234 <colspec colwidth="6*" align="center"/>
48235 <colspec colwidth="6*" align="center"/>
48236 <colspec colwidth="6*" align="right"/>
48237 <tbody>
48238 <row>
48239 <entry><option>allow_commands</option></entry>
48240 <entry>Use: <emphasis>pipe</emphasis></entry>
48241 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
48242 <entry>Default: <emphasis>unset</emphasis></entry>
48243 </row>
48244 </tbody>
48245 </tgroup>
48246 </informaltable>
48247 <para>
48248 <indexterm role="concept">
48249 <primary><command>pipe</command> transport</primary>
48250 <secondary>permitted commands</secondary>
48251 </indexterm>
48252 The string is expanded, and is then interpreted as a colon-separated list of
48253 permitted commands. If <option>restrict_to_path</option> is not set, the only commands
48254 permitted are those in the <option>allow_commands</option> list. They need not be absolute
48255 paths; the <option>path</option> option is still used for relative paths. If
48256 <option>restrict_to_path</option> is set with <option>allow_commands</option>, the command must either be
48257 in the <option>allow_commands</option> list, or a name without any slashes that is found on
48258 the path. In other words, if neither <option>allow_commands</option> nor
48259 <option>restrict_to_path</option> is set, there is no restriction on the command, but
48260 otherwise only commands that are permitted by one or the other are allowed. For
48261 example, if
48262 </para>
48263 <literallayout class="monospaced">
48264 allow_commands = /usr/bin/vacation
48265 </literallayout>
48266 <para>
48267 and <option>restrict_to_path</option> is not set, the only permitted command is
48268 <filename>/usr/bin/vacation</filename>. The <option>allow_commands</option> option may not be set if
48269 <option>use_shell</option> is set.
48270 </para>
48271 <para>
48272 <indexterm role="option">
48273 <primary><option>batch_id</option></primary>
48274 </indexterm>
48275 </para>
48276 <informaltable frame="all">
48277 <tgroup cols="4" colsep="0" rowsep="0">
48278 <colspec colwidth="8*" align="left"/>
48279 <colspec colwidth="6*" align="center"/>
48280 <colspec colwidth="6*" align="center"/>
48281 <colspec colwidth="6*" align="right"/>
48282 <tbody>
48283 <row>
48284 <entry><option>batch_id</option></entry>
48285 <entry>Use: <emphasis>pipe</emphasis></entry>
48286 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48287 <entry>Default: <emphasis>unset</emphasis></entry>
48288 </row>
48289 </tbody>
48290 </tgroup>
48291 </informaltable>
48292 <para>
48293 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
48294 </para>
48295 <para>
48296 <indexterm role="option">
48297 <primary><option>batch_max</option></primary>
48298 </indexterm>
48299 </para>
48300 <informaltable frame="all">
48301 <tgroup cols="4" colsep="0" rowsep="0">
48302 <colspec colwidth="8*" align="left"/>
48303 <colspec colwidth="6*" align="center"/>
48304 <colspec colwidth="6*" align="center"/>
48305 <colspec colwidth="6*" align="right"/>
48306 <tbody>
48307 <row>
48308 <entry><option>batch_max</option></entry>
48309 <entry>Use: <emphasis>pipe</emphasis></entry>
48310 <entry>Type: <emphasis>integer</emphasis></entry>
48311 <entry>Default: <emphasis>1</emphasis></entry>
48312 </row>
48313 </tbody>
48314 </tgroup>
48315 </informaltable>
48316 <para>
48317 This limits the number of addresses that can be handled in a single delivery.
48318 See the description of local delivery batching in chapter <xref linkend="CHAPbatching"/>.
48319 </para>
48320 <para>
48321 <indexterm role="option">
48322 <primary><option>check_string</option></primary>
48323 </indexterm>
48324 </para>
48325 <informaltable frame="all">
48326 <tgroup cols="4" colsep="0" rowsep="0">
48327 <colspec colwidth="8*" align="left"/>
48328 <colspec colwidth="6*" align="center"/>
48329 <colspec colwidth="6*" align="center"/>
48330 <colspec colwidth="6*" align="right"/>
48331 <tbody>
48332 <row>
48333 <entry><option>check_string</option></entry>
48334 <entry>Use: <emphasis>pipe</emphasis></entry>
48335 <entry>Type: <emphasis>string</emphasis></entry>
48336 <entry>Default: <emphasis>unset</emphasis></entry>
48337 </row>
48338 </tbody>
48339 </tgroup>
48340 </informaltable>
48341 <para>
48342 As <command>pipe</command> writes the message, the start of each line is tested for matching
48343 <option>check_string</option>, and if it does, the initial matching characters are replaced
48344 by the contents of <option>escape_string</option>, provided both are set. The value of
48345 <option>check_string</option> is a literal string, not a regular expression, and the case of
48346 any letters it contains is significant. When <option>use_bsmtp</option> is set, the contents
48347 of <option>check_string</option> and <option>escape_string</option> are forced to values that implement
48348 the SMTP escaping protocol. Any settings made in the configuration file are
48349 ignored.
48350 </para>
48351 <para>
48352 <indexterm role="option">
48353 <primary><option>command</option></primary>
48354 </indexterm>
48355 </para>
48356 <informaltable frame="all">
48357 <tgroup cols="4" colsep="0" rowsep="0">
48358 <colspec colwidth="8*" align="left"/>
48359 <colspec colwidth="6*" align="center"/>
48360 <colspec colwidth="6*" align="center"/>
48361 <colspec colwidth="6*" align="right"/>
48362 <tbody>
48363 <row>
48364 <entry><option>command</option></entry>
48365 <entry>Use: <emphasis>pipe</emphasis></entry>
48366 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48367 <entry>Default: <emphasis>unset</emphasis></entry>
48368 </row>
48369 </tbody>
48370 </tgroup>
48371 </informaltable>
48372 <para>
48373 This option need not be set when <command>pipe</command> is being used to deliver to pipes
48374 obtained directly from address redirections. In other cases, the option must be
48375 set, to provide a command to be run. It need not yield an absolute path (see
48376 the <option>path</option> option below). The command is split up into separate arguments by
48377 Exim, and each argument is separately expanded, as described in section
48378 <xref linkend="SECThowcommandrun"/> above.
48379 </para>
48380 <para revisionflag="changed">
48381 <indexterm role="concept">
48382 <primary>tainted data</primary>
48383 </indexterm>
48384 No part of the resulting command may be tainted.
48385 </para>
48386 <para>
48387 <indexterm role="option">
48388 <primary><option>environment</option></primary>
48389 </indexterm>
48390 </para>
48391 <informaltable frame="all">
48392 <tgroup cols="4" colsep="0" rowsep="0">
48393 <colspec colwidth="8*" align="left"/>
48394 <colspec colwidth="6*" align="center"/>
48395 <colspec colwidth="6*" align="center"/>
48396 <colspec colwidth="6*" align="right"/>
48397 <tbody>
48398 <row>
48399 <entry><option>environment</option></entry>
48400 <entry>Use: <emphasis>pipe</emphasis></entry>
48401 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48402 <entry>Default: <emphasis>unset</emphasis></entry>
48403 </row>
48404 </tbody>
48405 </tgroup>
48406 </informaltable>
48407 <para>
48408 <indexterm role="concept">
48409 <primary><command>pipe</command> transport</primary>
48410 <secondary>environment for command</secondary>
48411 </indexterm>
48412 <indexterm role="concept">
48413 <primary>environment</primary>
48414 <secondary><command>pipe</command> transport</secondary>
48415 </indexterm>
48416 This option is used to add additional variables to the environment in which the
48417 command runs (see section <xref linkend="SECTpipeenv"/> for the default list). Its value is
48418 a string which is expanded, and then interpreted as a colon-separated list of
48419 environment settings of the form &lt;<emphasis>name</emphasis>&gt;=&lt;<emphasis>value</emphasis>&gt;.
48420 </para>
48421 <para>
48422 <indexterm role="option">
48423 <primary><option>escape_string</option></primary>
48424 </indexterm>
48425 </para>
48426 <informaltable frame="all">
48427 <tgroup cols="4" colsep="0" rowsep="0">
48428 <colspec colwidth="8*" align="left"/>
48429 <colspec colwidth="6*" align="center"/>
48430 <colspec colwidth="6*" align="center"/>
48431 <colspec colwidth="6*" align="right"/>
48432 <tbody>
48433 <row>
48434 <entry><option>escape_string</option></entry>
48435 <entry>Use: <emphasis>pipe</emphasis></entry>
48436 <entry>Type: <emphasis>string</emphasis></entry>
48437 <entry>Default: <emphasis>unset</emphasis></entry>
48438 </row>
48439 </tbody>
48440 </tgroup>
48441 </informaltable>
48442 <para>
48443 See <option>check_string</option> above.
48444 </para>
48445 <para>
48446 <indexterm role="option">
48447 <primary><option>freeze_exec_fail</option></primary>
48448 </indexterm>
48449 </para>
48450 <informaltable frame="all">
48451 <tgroup cols="4" colsep="0" rowsep="0">
48452 <colspec colwidth="8*" align="left"/>
48453 <colspec colwidth="6*" align="center"/>
48454 <colspec colwidth="6*" align="center"/>
48455 <colspec colwidth="6*" align="right"/>
48456 <tbody>
48457 <row>
48458 <entry><option>freeze_exec_fail</option></entry>
48459 <entry>Use: <emphasis>pipe</emphasis></entry>
48460 <entry>Type: <emphasis>boolean</emphasis></entry>
48461 <entry>Default: <emphasis>false</emphasis></entry>
48462 </row>
48463 </tbody>
48464 </tgroup>
48465 </informaltable>
48466 <para>
48467 <indexterm role="concept">
48468 <primary>exec failure</primary>
48469 </indexterm>
48470 <indexterm role="concept">
48471 <primary>failure of exec</primary>
48472 </indexterm>
48473 <indexterm role="concept">
48474 <primary><command>pipe</command> transport</primary>
48475 <secondary>failure of exec</secondary>
48476 </indexterm>
48477 Failure to exec the command in a pipe transport is by default treated like
48478 any other failure while running the command. However, if <option>freeze_exec_fail</option>
48479 is set, failure to exec is treated specially, and causes the message to be
48480 frozen, whatever the setting of <option>ignore_status</option>.
48481 </para>
48482 <para>
48483 <indexterm role="option">
48484 <primary><option>freeze_signal</option></primary>
48485 </indexterm>
48486 </para>
48487 <informaltable frame="all">
48488 <tgroup cols="4" colsep="0" rowsep="0">
48489 <colspec colwidth="8*" align="left"/>
48490 <colspec colwidth="6*" align="center"/>
48491 <colspec colwidth="6*" align="center"/>
48492 <colspec colwidth="6*" align="right"/>
48493 <tbody>
48494 <row>
48495 <entry><option>freeze_signal</option></entry>
48496 <entry>Use: <emphasis>pipe</emphasis></entry>
48497 <entry>Type: <emphasis>boolean</emphasis></entry>
48498 <entry>Default: <emphasis>false</emphasis></entry>
48499 </row>
48500 </tbody>
48501 </tgroup>
48502 </informaltable>
48503 <para>
48504 <indexterm role="concept">
48505 <primary>signal exit</primary>
48506 </indexterm>
48507 <indexterm role="concept">
48508 <primary><command>pipe</command> transport</primary>
48509 <secondary>,</secondary>
48510 </indexterm>
48511 Normally if the process run by a command in a pipe transport exits on a signal,
48512 a bounce message is sent. If <option>freeze_signal</option> is set, the message will be
48513 frozen in Exim&#x2019;s queue instead.
48514 </para>
48515 <para>
48516 <indexterm role="option">
48517 <primary><option>force_command</option></primary>
48518 </indexterm>
48519 </para>
48520 <informaltable frame="all">
48521 <tgroup cols="4" colsep="0" rowsep="0">
48522 <colspec colwidth="8*" align="left"/>
48523 <colspec colwidth="6*" align="center"/>
48524 <colspec colwidth="6*" align="center"/>
48525 <colspec colwidth="6*" align="right"/>
48526 <tbody>
48527 <row>
48528 <entry><option>force_command</option></entry>
48529 <entry>Use: <emphasis>pipe</emphasis></entry>
48530 <entry>Type: <emphasis>boolean</emphasis></entry>
48531 <entry>Default: <emphasis>false</emphasis></entry>
48532 </row>
48533 </tbody>
48534 </tgroup>
48535 </informaltable>
48536 <para>
48537 <indexterm role="concept">
48538 <primary>force command</primary>
48539 </indexterm>
48540 <indexterm role="concept">
48541 <primary><command>pipe</command> transport</primary>
48542 <secondary>,</secondary>
48543 </indexterm>
48544 Normally when a router redirects an address directly to a pipe command
48545 the <option>command</option> option on the transport is ignored.  If <option>force_command</option>
48546 is set, the <option>command</option> option will used. This is especially
48547 useful for forcing a wrapper or additional argument to be added to the
48548 command. For example:
48549 </para>
48550 <literallayout class="monospaced">
48551 command = /usr/bin/remote_exec myhost -- $address_pipe
48552 force_command
48553 </literallayout>
48554 <para>
48555 Note that <varname>$address_pipe</varname> is handled specially in <option>command</option> when
48556 <option>force_command</option> is set, expanding out to the original argument vector as
48557 separate items, similarly to a Unix shell <literal>"$@"</literal> construct.
48558 </para>
48559 <para>
48560 <indexterm role="option">
48561 <primary><option>ignore_status</option></primary>
48562 </indexterm>
48563 </para>
48564 <informaltable frame="all">
48565 <tgroup cols="4" colsep="0" rowsep="0">
48566 <colspec colwidth="8*" align="left"/>
48567 <colspec colwidth="6*" align="center"/>
48568 <colspec colwidth="6*" align="center"/>
48569 <colspec colwidth="6*" align="right"/>
48570 <tbody>
48571 <row>
48572 <entry><option>ignore_status</option></entry>
48573 <entry>Use: <emphasis>pipe</emphasis></entry>
48574 <entry>Type: <emphasis>boolean</emphasis></entry>
48575 <entry>Default: <emphasis>false</emphasis></entry>
48576 </row>
48577 </tbody>
48578 </tgroup>
48579 </informaltable>
48580 <para>
48581 If this option is true, the status returned by the subprocess that is set up to
48582 run the command is ignored, and Exim behaves as if zero had been returned.
48583 Otherwise, a non-zero status or termination by signal causes an error return
48584 from the transport unless the status value is one of those listed in
48585 <option>temp_errors</option>; these cause the delivery to be deferred and tried again later.
48586 </para>
48587 <para>
48588 <emphasis role="bold">Note</emphasis>: This option does not apply to timeouts, which do not return a status.
48589 See the <option>timeout_defer</option> option for how timeouts are handled.
48590 </para>
48591 <para>
48592 <indexterm role="option">
48593 <primary><option>log_defer_output</option></primary>
48594 </indexterm>
48595 </para>
48596 <informaltable frame="all">
48597 <tgroup cols="4" colsep="0" rowsep="0">
48598 <colspec colwidth="8*" align="left"/>
48599 <colspec colwidth="6*" align="center"/>
48600 <colspec colwidth="6*" align="center"/>
48601 <colspec colwidth="6*" align="right"/>
48602 <tbody>
48603 <row>
48604 <entry><option>log_defer_output</option></entry>
48605 <entry>Use: <emphasis>pipe</emphasis></entry>
48606 <entry>Type: <emphasis>boolean</emphasis></entry>
48607 <entry>Default: <emphasis>false</emphasis></entry>
48608 </row>
48609 </tbody>
48610 </tgroup>
48611 </informaltable>
48612 <para>
48613 <indexterm role="concept">
48614 <primary><command>pipe</command> transport</primary>
48615 <secondary>logging output</secondary>
48616 </indexterm>
48617 If this option is set, and the status returned by the command is
48618 one of the codes listed in <option>temp_errors</option> (that is, delivery was deferred),
48619 and any output was produced on stdout or stderr, the first line of it is
48620 written to the main log.
48621 </para>
48622 <para>
48623 <indexterm role="option">
48624 <primary><option>log_fail_output</option></primary>
48625 </indexterm>
48626 </para>
48627 <informaltable frame="all">
48628 <tgroup cols="4" colsep="0" rowsep="0">
48629 <colspec colwidth="8*" align="left"/>
48630 <colspec colwidth="6*" align="center"/>
48631 <colspec colwidth="6*" align="center"/>
48632 <colspec colwidth="6*" align="right"/>
48633 <tbody>
48634 <row>
48635 <entry><option>log_fail_output</option></entry>
48636 <entry>Use: <emphasis>pipe</emphasis></entry>
48637 <entry>Type: <emphasis>boolean</emphasis></entry>
48638 <entry>Default: <emphasis>false</emphasis></entry>
48639 </row>
48640 </tbody>
48641 </tgroup>
48642 </informaltable>
48643 <para>
48644 If this option is set, and the command returns any output on stdout or
48645 stderr, and also ends with a return code that is neither zero nor one of
48646 the return codes listed in <option>temp_errors</option> (that is, the delivery
48647 failed), the first line of output is written to the main log. This
48648 option and <option>log_output</option> are mutually exclusive.  Only one of them may
48649 be set.
48650 </para>
48651 <para>
48652 <indexterm role="option">
48653 <primary><option>log_output</option></primary>
48654 </indexterm>
48655 </para>
48656 <informaltable frame="all">
48657 <tgroup cols="4" colsep="0" rowsep="0">
48658 <colspec colwidth="8*" align="left"/>
48659 <colspec colwidth="6*" align="center"/>
48660 <colspec colwidth="6*" align="center"/>
48661 <colspec colwidth="6*" align="right"/>
48662 <tbody>
48663 <row>
48664 <entry><option>log_output</option></entry>
48665 <entry>Use: <emphasis>pipe</emphasis></entry>
48666 <entry>Type: <emphasis>boolean</emphasis></entry>
48667 <entry>Default: <emphasis>false</emphasis></entry>
48668 </row>
48669 </tbody>
48670 </tgroup>
48671 </informaltable>
48672 <para>
48673 If this option is set and the command returns any output on stdout or
48674 stderr, the first line of output is written to the main log, whatever
48675 the return code. This option and <option>log_fail_output</option> are mutually
48676 exclusive. Only one of them may be set.
48677 </para>
48678 <para>
48679 <indexterm role="option">
48680 <primary><option>max_output</option></primary>
48681 </indexterm>
48682 </para>
48683 <informaltable frame="all">
48684 <tgroup cols="4" colsep="0" rowsep="0">
48685 <colspec colwidth="8*" align="left"/>
48686 <colspec colwidth="6*" align="center"/>
48687 <colspec colwidth="6*" align="center"/>
48688 <colspec colwidth="6*" align="right"/>
48689 <tbody>
48690 <row>
48691 <entry><option>max_output</option></entry>
48692 <entry>Use: <emphasis>pipe</emphasis></entry>
48693 <entry>Type: <emphasis>integer</emphasis></entry>
48694 <entry>Default: <emphasis>20K</emphasis></entry>
48695 </row>
48696 </tbody>
48697 </tgroup>
48698 </informaltable>
48699 <para>
48700 This specifies the maximum amount of output that the command may produce on its
48701 standard output and standard error file combined. If the limit is exceeded, the
48702 process running the command is killed. This is intended as a safety measure to
48703 catch runaway processes. The limit is applied independently of the settings of
48704 the options that control what is done with such output (for example,
48705 <option>return_output</option>). Because of buffering effects, the amount of output may
48706 exceed the limit by a small amount before Exim notices.
48707 </para>
48708 <para>
48709 <indexterm role="option">
48710 <primary><option>message_prefix</option></primary>
48711 </indexterm>
48712 </para>
48713 <informaltable frame="all">
48714 <tgroup cols="4" colsep="0" rowsep="0">
48715 <colspec colwidth="8*" align="left"/>
48716 <colspec colwidth="6*" align="center"/>
48717 <colspec colwidth="6*" align="center"/>
48718 <colspec colwidth="6*" align="right"/>
48719 <tbody>
48720 <row>
48721 <entry><option>message_prefix</option></entry>
48722 <entry>Use: <emphasis>pipe</emphasis></entry>
48723 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48724 <entry>Default: <emphasis>see below</emphasis></entry>
48725 </row>
48726 </tbody>
48727 </tgroup>
48728 </informaltable>
48729 <para>
48730 The string specified here is expanded and output at the start of every message.
48731 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is
48732 </para>
48733 <literallayout class="monospaced">
48734 message_prefix = \
48735   From ${if def:return_path{$return_path}{MAILER-DAEMON}}\
48736   ${tod_bsdinbox}\n
48737 </literallayout>
48738 <para>
48739 <indexterm role="concept">
48740 <primary>Cyrus</primary>
48741 </indexterm>
48742 <indexterm role="concept">
48743 <primary><option>tmail</option></primary>
48744 </indexterm>
48745 <indexterm role="concept">
48746 <primary><quote>From</quote> line</primary>
48747 </indexterm>
48748 This is required by the commonly used <filename>/usr/bin/vacation</filename> program.
48749 However, it must <emphasis>not</emphasis> be present if delivery is to the Cyrus IMAP server,
48750 or to the <option>tmail</option> local delivery agent. The prefix can be suppressed by
48751 setting
48752 </para>
48753 <literallayout class="monospaced">
48754 message_prefix =
48755 </literallayout>
48756 <para>
48757 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
48758 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_prefix</option>.
48759 </para>
48760 <para>
48761 <indexterm role="option">
48762 <primary><option>message_suffix</option></primary>
48763 </indexterm>
48764 </para>
48765 <informaltable frame="all">
48766 <tgroup cols="4" colsep="0" rowsep="0">
48767 <colspec colwidth="8*" align="left"/>
48768 <colspec colwidth="6*" align="center"/>
48769 <colspec colwidth="6*" align="center"/>
48770 <colspec colwidth="6*" align="right"/>
48771 <tbody>
48772 <row>
48773 <entry><option>message_suffix</option></entry>
48774 <entry>Use: <emphasis>pipe</emphasis></entry>
48775 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48776 <entry>Default: <emphasis>see below</emphasis></entry>
48777 </row>
48778 </tbody>
48779 </tgroup>
48780 </informaltable>
48781 <para>
48782 The string specified here is expanded and output at the end of every message.
48783 The default is unset if <option>use_bsmtp</option> is set. Otherwise it is a single newline.
48784 The suffix can be suppressed by setting
48785 </para>
48786 <literallayout class="monospaced">
48787 message_suffix =
48788 </literallayout>
48789 <para>
48790 <emphasis role="bold">Note:</emphasis> If you set <option>use_crlf</option> true, you must change any occurrences of
48791 <literal>\n</literal> to <literal>\r\n</literal> in <option>message_suffix</option>.
48792 </para>
48793 <para>
48794 <indexterm role="option">
48795 <primary><option>path</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>path</option></entry>
48807 <entry>Use: <emphasis>pipe</emphasis></entry>
48808 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
48809 <entry>Default: <emphasis>/bin:/usr/bin</emphasis></entry>
48810 </row>
48811 </tbody>
48812 </tgroup>
48813 </informaltable>
48814 <para>
48815 This option is expanded and
48816 specifies the string that is set up in the PATH environment
48817 variable of the subprocess.
48818 If the <option>command</option> option does not yield an absolute path name, the command is
48819 sought in the PATH directories, in the usual way. <emphasis role="bold">Warning</emphasis>: This does not
48820 apply to a command specified as a transport filter.
48821 </para>
48822 <para>
48823 <indexterm role="option">
48824 <primary><option>permit_coredump</option></primary>
48825 </indexterm>
48826 </para>
48827 <informaltable frame="all">
48828 <tgroup cols="4" colsep="0" rowsep="0">
48829 <colspec colwidth="8*" align="left"/>
48830 <colspec colwidth="6*" align="center"/>
48831 <colspec colwidth="6*" align="center"/>
48832 <colspec colwidth="6*" align="right"/>
48833 <tbody>
48834 <row>
48835 <entry><option>permit_coredump</option></entry>
48836 <entry>Use: <emphasis>pipe</emphasis></entry>
48837 <entry>Type: <emphasis>boolean</emphasis></entry>
48838 <entry>Default: <emphasis>false</emphasis></entry>
48839 </row>
48840 </tbody>
48841 </tgroup>
48842 </informaltable>
48843 <para>
48844 Normally Exim inhibits core-dumps during delivery.  If you have a need to get
48845 a core-dump of a pipe command, enable this command.  This enables core-dumps
48846 during delivery and affects both the Exim binary and the pipe command run.
48847 It is recommended that this option remain off unless and until you have a need
48848 for it and that this only be enabled when needed, as the risk of excessive
48849 resource consumption can be quite high.  Note also that Exim is typically
48850 installed as a setuid binary and most operating systems will inhibit coredumps
48851 of these by default, so further OS-specific action may be required.
48852 </para>
48853 <para>
48854 <indexterm role="option">
48855 <primary><option>pipe_as_creator</option></primary>
48856 </indexterm>
48857 </para>
48858 <informaltable frame="all">
48859 <tgroup cols="4" colsep="0" rowsep="0">
48860 <colspec colwidth="8*" align="left"/>
48861 <colspec colwidth="6*" align="center"/>
48862 <colspec colwidth="6*" align="center"/>
48863 <colspec colwidth="6*" align="right"/>
48864 <tbody>
48865 <row>
48866 <entry><option>pipe_as_creator</option></entry>
48867 <entry>Use: <emphasis>pipe</emphasis></entry>
48868 <entry>Type: <emphasis>boolean</emphasis></entry>
48869 <entry>Default: <emphasis>false</emphasis></entry>
48870 </row>
48871 </tbody>
48872 </tgroup>
48873 </informaltable>
48874 <para>
48875 <indexterm role="concept">
48876 <primary>uid (user id)</primary>
48877 <secondary>local delivery</secondary>
48878 </indexterm>
48879 If the generic <option>user</option> option is not set and this option is true, the delivery
48880 process is run under the uid that was in force when Exim was originally called
48881 to accept the message. If the group id is not otherwise set (via the generic
48882 <option>group</option> option), the gid that was in force when Exim was originally called to
48883 accept the message is used.
48884 </para>
48885 <para>
48886 <indexterm role="option">
48887 <primary><option>restrict_to_path</option></primary>
48888 </indexterm>
48889 </para>
48890 <informaltable frame="all">
48891 <tgroup cols="4" colsep="0" rowsep="0">
48892 <colspec colwidth="8*" align="left"/>
48893 <colspec colwidth="6*" align="center"/>
48894 <colspec colwidth="6*" align="center"/>
48895 <colspec colwidth="6*" align="right"/>
48896 <tbody>
48897 <row>
48898 <entry><option>restrict_to_path</option></entry>
48899 <entry>Use: <emphasis>pipe</emphasis></entry>
48900 <entry>Type: <emphasis>boolean</emphasis></entry>
48901 <entry>Default: <emphasis>false</emphasis></entry>
48902 </row>
48903 </tbody>
48904 </tgroup>
48905 </informaltable>
48906 <para>
48907 When this option is set, any command name not listed in <option>allow_commands</option> must
48908 contain no slashes. The command is searched for only in the directories listed
48909 in the <option>path</option> option. This option is intended for use in the case when a pipe
48910 command has been generated from a user&#x2019;s <filename>.forward</filename> file. This is usually
48911 handled by a <command>pipe</command> transport called <option>address_pipe</option>.
48912 </para>
48913 <para>
48914 <indexterm role="option">
48915 <primary><option>return_fail_output</option></primary>
48916 </indexterm>
48917 </para>
48918 <informaltable frame="all">
48919 <tgroup cols="4" colsep="0" rowsep="0">
48920 <colspec colwidth="8*" align="left"/>
48921 <colspec colwidth="6*" align="center"/>
48922 <colspec colwidth="6*" align="center"/>
48923 <colspec colwidth="6*" align="right"/>
48924 <tbody>
48925 <row>
48926 <entry><option>return_fail_output</option></entry>
48927 <entry>Use: <emphasis>pipe</emphasis></entry>
48928 <entry>Type: <emphasis>boolean</emphasis></entry>
48929 <entry>Default: <emphasis>false</emphasis></entry>
48930 </row>
48931 </tbody>
48932 </tgroup>
48933 </informaltable>
48934 <para>
48935 If this option is true, and the command produced any output and ended with a
48936 return code other than zero or one of the codes listed in <option>temp_errors</option> (that
48937 is, the delivery failed), the output is returned in the bounce message.
48938 However, if the message has a null sender (that is, it is itself a bounce
48939 message), output from the command is discarded. This option and
48940 <option>return_output</option> are mutually exclusive. Only one of them may be set.
48941 </para>
48942 <para>
48943 <indexterm role="option">
48944 <primary><option>return_output</option></primary>
48945 </indexterm>
48946 </para>
48947 <informaltable frame="all">
48948 <tgroup cols="4" colsep="0" rowsep="0">
48949 <colspec colwidth="8*" align="left"/>
48950 <colspec colwidth="6*" align="center"/>
48951 <colspec colwidth="6*" align="center"/>
48952 <colspec colwidth="6*" align="right"/>
48953 <tbody>
48954 <row>
48955 <entry><option>return_output</option></entry>
48956 <entry>Use: <emphasis>pipe</emphasis></entry>
48957 <entry>Type: <emphasis>boolean</emphasis></entry>
48958 <entry>Default: <emphasis>false</emphasis></entry>
48959 </row>
48960 </tbody>
48961 </tgroup>
48962 </informaltable>
48963 <para>
48964 If this option is true, and the command produced any output, the delivery is
48965 deemed to have failed whatever the return code from the command, and the output
48966 is returned in the bounce message. Otherwise, the output is just discarded.
48967 However, if the message has a null sender (that is, it is a bounce message),
48968 output from the command is always discarded, whatever the setting of this
48969 option. This option and <option>return_fail_output</option> are mutually exclusive. Only one
48970 of them may be set.
48971 </para>
48972 <para>
48973 <indexterm role="option">
48974 <primary><option>temp_errors</option></primary>
48975 </indexterm>
48976 </para>
48977 <informaltable frame="all">
48978 <tgroup cols="4" colsep="0" rowsep="0">
48979 <colspec colwidth="8*" align="left"/>
48980 <colspec colwidth="6*" align="center"/>
48981 <colspec colwidth="6*" align="center"/>
48982 <colspec colwidth="6*" align="right"/>
48983 <tbody>
48984 <row>
48985 <entry><option>temp_errors</option></entry>
48986 <entry>Use: <emphasis>pipe</emphasis></entry>
48987 <entry>Type: <emphasis>string list</emphasis></entry>
48988 <entry>Default: <emphasis>see below</emphasis></entry>
48989 </row>
48990 </tbody>
48991 </tgroup>
48992 </informaltable>
48993 <para>
48994 <indexterm role="concept">
48995 <primary><command>pipe</command> transport</primary>
48996 <secondary>temporary failure</secondary>
48997 </indexterm>
48998 This option contains either a colon-separated list of numbers, or a single
48999 asterisk. If <option>ignore_status</option> is false
49000 and <option>return_output</option> is not set,
49001 and the command exits with a non-zero return code, the failure is treated as
49002 temporary and the delivery is deferred if the return code matches one of the
49003 numbers, or if the setting is a single asterisk. Otherwise, non-zero return
49004 codes are treated as permanent errors. The default setting contains the codes
49005 defined by EX_TEMPFAIL and EX_CANTCREAT in <filename>sysexits.h</filename>. If Exim is
49006 compiled on a system that does not define these macros, it assumes values of 75
49007 and 73, respectively.
49008 </para>
49009 <para>
49010 <indexterm role="option">
49011 <primary><option>timeout</option></primary>
49012 </indexterm>
49013 </para>
49014 <informaltable frame="all">
49015 <tgroup cols="4" colsep="0" rowsep="0">
49016 <colspec colwidth="8*" align="left"/>
49017 <colspec colwidth="6*" align="center"/>
49018 <colspec colwidth="6*" align="center"/>
49019 <colspec colwidth="6*" align="right"/>
49020 <tbody>
49021 <row>
49022 <entry><option>timeout</option></entry>
49023 <entry>Use: <emphasis>pipe</emphasis></entry>
49024 <entry>Type: <emphasis>time</emphasis></entry>
49025 <entry>Default: <emphasis>1h</emphasis></entry>
49026 </row>
49027 </tbody>
49028 </tgroup>
49029 </informaltable>
49030 <para>
49031 If the command fails to complete within this time, it is killed. This normally
49032 causes the delivery to fail (but see <option>timeout_defer</option>). A zero time interval
49033 specifies no timeout. In order to ensure that any subprocesses created by the
49034 command are also killed, Exim makes the initial process a process group leader,
49035 and kills the whole process group on a timeout. However, this can be defeated
49036 if one of the processes starts a new process group.
49037 </para>
49038 <para>
49039 <indexterm role="option">
49040 <primary><option>timeout_defer</option></primary>
49041 </indexterm>
49042 </para>
49043 <informaltable frame="all">
49044 <tgroup cols="4" colsep="0" rowsep="0">
49045 <colspec colwidth="8*" align="left"/>
49046 <colspec colwidth="6*" align="center"/>
49047 <colspec colwidth="6*" align="center"/>
49048 <colspec colwidth="6*" align="right"/>
49049 <tbody>
49050 <row>
49051 <entry><option>timeout_defer</option></entry>
49052 <entry>Use: <emphasis>pipe</emphasis></entry>
49053 <entry>Type: <emphasis>boolean</emphasis></entry>
49054 <entry>Default: <emphasis>false</emphasis></entry>
49055 </row>
49056 </tbody>
49057 </tgroup>
49058 </informaltable>
49059 <para>
49060 A timeout in a <command>pipe</command> transport, either in the command that the transport
49061 runs, or in a transport filter that is associated with it, is by default
49062 treated as a hard error, and the delivery fails. However, if <option>timeout_defer</option>
49063 is set true, both kinds of timeout become temporary errors, causing the
49064 delivery to be deferred.
49065 </para>
49066 <para>
49067 <indexterm role="option">
49068 <primary><option>umask</option></primary>
49069 </indexterm>
49070 </para>
49071 <informaltable frame="all">
49072 <tgroup cols="4" colsep="0" rowsep="0">
49073 <colspec colwidth="8*" align="left"/>
49074 <colspec colwidth="6*" align="center"/>
49075 <colspec colwidth="6*" align="center"/>
49076 <colspec colwidth="6*" align="right"/>
49077 <tbody>
49078 <row>
49079 <entry><option>umask</option></entry>
49080 <entry>Use: <emphasis>pipe</emphasis></entry>
49081 <entry>Type: <emphasis>octal integer</emphasis></entry>
49082 <entry>Default: <emphasis>022</emphasis></entry>
49083 </row>
49084 </tbody>
49085 </tgroup>
49086 </informaltable>
49087 <para>
49088 This specifies the umask setting for the subprocess that runs the command.
49089 </para>
49090 <para>
49091 <indexterm role="option">
49092 <primary><option>use_bsmtp</option></primary>
49093 </indexterm>
49094 </para>
49095 <informaltable frame="all">
49096 <tgroup cols="4" colsep="0" rowsep="0">
49097 <colspec colwidth="8*" align="left"/>
49098 <colspec colwidth="6*" align="center"/>
49099 <colspec colwidth="6*" align="center"/>
49100 <colspec colwidth="6*" align="right"/>
49101 <tbody>
49102 <row>
49103 <entry><option>use_bsmtp</option></entry>
49104 <entry>Use: <emphasis>pipe</emphasis></entry>
49105 <entry>Type: <emphasis>boolean</emphasis></entry>
49106 <entry>Default: <emphasis>false</emphasis></entry>
49107 </row>
49108 </tbody>
49109 </tgroup>
49110 </informaltable>
49111 <para>
49112 <indexterm role="concept">
49113 <primary>envelope sender</primary>
49114 </indexterm>
49115 If this option is set true, the <command>pipe</command> transport writes messages in <quote>batch
49116 SMTP</quote> format, with the envelope sender and recipient(s) included as SMTP
49117 commands. If you want to include a leading HELO command with such messages,
49118 you can do so by setting the <option>message_prefix</option> option. See section
49119 <xref linkend="SECTbatchSMTP"/> for details of batch SMTP.
49120 </para>
49121 <para>
49122 <indexterm role="option">
49123 <primary><option>use_classresources</option></primary>
49124 </indexterm>
49125 </para>
49126 <informaltable frame="all">
49127 <tgroup cols="4" colsep="0" rowsep="0">
49128 <colspec colwidth="8*" align="left"/>
49129 <colspec colwidth="6*" align="center"/>
49130 <colspec colwidth="6*" align="center"/>
49131 <colspec colwidth="6*" align="right"/>
49132 <tbody>
49133 <row>
49134 <entry><option>use_classresources</option></entry>
49135 <entry>Use: <emphasis>pipe</emphasis></entry>
49136 <entry>Type: <emphasis>boolean</emphasis></entry>
49137 <entry>Default: <emphasis>false</emphasis></entry>
49138 </row>
49139 </tbody>
49140 </tgroup>
49141 </informaltable>
49142 <para>
49143 <indexterm role="concept">
49144 <primary>class resources (BSD)</primary>
49145 </indexterm>
49146 This option is available only when Exim is running on FreeBSD, NetBSD, or
49147 BSD/OS. If it is set true, the <function>setclassresources()</function> function is used to set
49148 resource limits when a <command>pipe</command> transport is run to perform a delivery. The
49149 limits for the uid under which the pipe is to run are obtained from the login
49150 class database.
49151 </para>
49152 <para>
49153 <indexterm role="option">
49154 <primary><option>use_crlf</option></primary>
49155 </indexterm>
49156 </para>
49157 <informaltable frame="all">
49158 <tgroup cols="4" colsep="0" rowsep="0">
49159 <colspec colwidth="8*" align="left"/>
49160 <colspec colwidth="6*" align="center"/>
49161 <colspec colwidth="6*" align="center"/>
49162 <colspec colwidth="6*" align="right"/>
49163 <tbody>
49164 <row>
49165 <entry><option>use_crlf</option></entry>
49166 <entry>Use: <emphasis>pipe</emphasis></entry>
49167 <entry>Type: <emphasis>boolean</emphasis></entry>
49168 <entry>Default: <emphasis>false</emphasis></entry>
49169 </row>
49170 </tbody>
49171 </tgroup>
49172 </informaltable>
49173 <para>
49174 <indexterm role="concept">
49175 <primary>carriage return</primary>
49176 </indexterm>
49177 <indexterm role="concept">
49178 <primary>linefeed</primary>
49179 </indexterm>
49180 This option causes lines to be terminated with the two-character CRLF sequence
49181 (carriage return, linefeed) instead of just a linefeed character. In the case
49182 of batched SMTP, the byte sequence written to the pipe is then an exact image
49183 of what would be sent down a real SMTP connection.
49184 </para>
49185 <para>
49186 The contents of the <option>message_prefix</option> and <option>message_suffix</option> options are
49187 written verbatim, so must contain their own carriage return characters if these
49188 are needed. When <option>use_bsmtp</option> is not set, the default values for both
49189 <option>message_prefix</option> and <option>message_suffix</option> end with a single linefeed, so their
49190 values must be changed to end with <literal>\r\n</literal> if <option>use_crlf</option> is set.
49191 </para>
49192 <para>
49193 <indexterm role="option">
49194 <primary><option>use_shell</option></primary>
49195 </indexterm>
49196 </para>
49197 <informaltable frame="all">
49198 <tgroup cols="4" colsep="0" rowsep="0">
49199 <colspec colwidth="8*" align="left"/>
49200 <colspec colwidth="6*" align="center"/>
49201 <colspec colwidth="6*" align="center"/>
49202 <colspec colwidth="6*" align="right"/>
49203 <tbody>
49204 <row>
49205 <entry><option>use_shell</option></entry>
49206 <entry>Use: <emphasis>pipe</emphasis></entry>
49207 <entry>Type: <emphasis>boolean</emphasis></entry>
49208 <entry>Default: <emphasis>false</emphasis></entry>
49209 </row>
49210 </tbody>
49211 </tgroup>
49212 </informaltable>
49213 <para>
49214 <indexterm role="variable">
49215 <primary><varname>$pipe_addresses</varname></primary>
49216 </indexterm>
49217 If this option is set, it causes the command to be passed to <filename>/bin/sh</filename>
49218 instead of being run directly from the transport, as described in section
49219 <xref linkend="SECThowcommandrun"/>. This is less secure, but is needed in some situations
49220 where the command is expected to be run under a shell and cannot easily be
49221 modified. The <option>allow_commands</option> and <option>restrict_to_path</option> options, and the
49222 <literal>$pipe_addresses</literal> facility are incompatible with <option>use_shell</option>. The
49223 command is expanded as a single string, and handed to <filename>/bin/sh</filename> as data for
49224 its <option>-c</option> option.
49225 </para>
49226 </section>
49227 <section id="SECID143">
49228 <title>Using an external local delivery agent</title>
49229 <para>
49230 <indexterm role="concept">
49231 <primary>local delivery</primary>
49232 <secondary>using an external agent</secondary>
49233 </indexterm>
49234 <indexterm role="concept">
49235 <primary><emphasis>procmail</emphasis></primary>
49236 </indexterm>
49237 <indexterm role="concept">
49238 <primary>external local delivery</primary>
49239 </indexterm>
49240 <indexterm role="concept">
49241 <primary>delivery</primary>
49242 <secondary><emphasis>procmail</emphasis></secondary>
49243 </indexterm>
49244 <indexterm role="concept">
49245 <primary>delivery</primary>
49246 <secondary>by external agent</secondary>
49247 </indexterm>
49248 The <command>pipe</command> transport can be used to pass all messages that require local
49249 delivery to a separate local delivery agent such as <option>procmail</option>. When doing
49250 this, care must be taken to ensure that the pipe is run under an appropriate
49251 uid and gid. In some configurations one wants this to be a uid that is trusted
49252 by the delivery agent to supply the correct sender of the message. It may be
49253 necessary to recompile or reconfigure the delivery agent so that it trusts an
49254 appropriate user. The following is an example transport and router
49255 configuration for <option>procmail</option>:
49256 </para>
49257 <literallayout class="monospaced">
49258 # transport
49259 procmail_pipe:
49260   driver = pipe
49261   command = /usr/local/bin/procmail -d $local_part_data
49262   return_path_add
49263   delivery_date_add
49264   envelope_to_add
49265   check_string = "From "
49266   escape_string = "&gt;From "
49267   umask = 077
49268   user = $local_part_data
49269   group = mail
49270
49271 # router
49272 procmail:
49273   driver = accept
49274   check_local_user
49275   transport = procmail_pipe
49276 </literallayout>
49277 <para>
49278 In this example, the pipe is run as the local user, but with the group set to
49279 <emphasis>mail</emphasis>. An alternative is to run the pipe as a specific user such as <emphasis>mail</emphasis>
49280 or <emphasis>exim</emphasis>, but in this case you must arrange for <option>procmail</option> to trust that
49281 user to supply a correct sender address. If you do not specify either a
49282 <option>group</option> or a <option>user</option> option, the pipe command is run as the local user. The
49283 home directory is the user&#x2019;s home directory by default.
49284 </para>
49285 <para>
49286 <emphasis role="bold">Note</emphasis>: The command that the pipe transport runs does <emphasis>not</emphasis> begin with
49287 </para>
49288 <literallayout class="monospaced">
49289 IFS=" "
49290 </literallayout>
49291 <para>
49292 as shown in some <option>procmail</option> documentation, because Exim does not by default
49293 use a shell to run pipe commands.
49294 </para>
49295 <para>
49296 <indexterm role="concept">
49297 <primary>Cyrus</primary>
49298 </indexterm>
49299 The next example shows a transport and a router for a system where local
49300 deliveries are handled by the Cyrus IMAP server.
49301 </para>
49302 <literallayout class="monospaced">
49303 # transport
49304 local_delivery_cyrus:
49305   driver = pipe
49306   command = /usr/cyrus/bin/deliver \
49307             -- $local_part_data
49308   user = cyrus
49309   group = mail
49310   return_output
49311   log_output
49312   message_prefix =
49313   message_suffix =
49314
49315 # router
49316 local_user_cyrus:
49317   driver = accept
49318   check_local_user
49319   transport = local_delivery_cyrus
49320 </literallayout>
49321 <para>
49322 Note the unsetting of <option>message_prefix</option> and <option>message_suffix</option>, and the use of
49323 <option>return_output</option> to cause any text written by Cyrus to be returned to the
49324 sender.
49325 <indexterm role="concept" startref="IIDpiptra1" class="endofrange"/>
49326 <indexterm role="concept" startref="IIDpiptra2" class="endofrange"/>
49327 </para>
49328 </section>
49329 </chapter>
49330
49331 <chapter id="CHAPsmtptrans">
49332 <title>The smtp transport</title>
49333 <para>
49334 <indexterm role="concept" id="IIDsmttra1" class="startofrange">
49335 <primary>transports</primary>
49336 <secondary><command>smtp</command></secondary>
49337 </indexterm>
49338 <indexterm role="concept" id="IIDsmttra2" class="startofrange">
49339 <primary><command>smtp</command> transport</primary>
49340 </indexterm>
49341 The <command>smtp</command> transport delivers messages over TCP/IP connections using the SMTP
49342 or LMTP protocol. The list of hosts to try can either be taken from the address
49343 that is being processed (having been set up by the router), or specified
49344 explicitly for the transport. Timeout and retry processing (see chapter
49345 <xref linkend="CHAPretry"/>) is applied to each IP address independently.
49346 </para>
49347 <section id="SECID144">
49348 <title>Multiple messages on a single connection</title>
49349 <para>
49350 The sending of multiple messages over a single TCP/IP connection can arise in
49351 two ways:
49352 </para>
49353 <itemizedlist>
49354 <listitem>
49355 <para>
49356 If a message contains more than <option>max_rcpt</option> (see below) addresses that are
49357 routed to the same host, more than one copy of the message has to be sent to
49358 that host. In this situation, multiple copies may be sent in a single run of
49359 the <command>smtp</command> transport over a single TCP/IP connection. (What Exim actually
49360 does when it has too many addresses to send in one message also depends on the
49361 value of the global <option>remote_max_parallel</option> option. Details are given in
49362 section <xref linkend="SECToutSMTPTCP"/>.)
49363 </para>
49364 </listitem>
49365 <listitem>
49366 <para>
49367 <indexterm role="concept">
49368 <primary>hints database</primary>
49369 <secondary>remembering routing</secondary>
49370 </indexterm>
49371 When a message has been successfully delivered over a TCP/IP connection, Exim
49372 looks in its hints database to see if there are any other messages awaiting a
49373 connection to the same host. If there are, a new delivery process is started
49374 for one of them, and the current TCP/IP connection is passed on to it. The new
49375 process may in turn send multiple copies and possibly create yet another
49376 process.
49377 </para>
49378 </listitem>
49379 </itemizedlist>
49380 <para>
49381 For each copy sent over the same TCP/IP connection, a sequence counter is
49382 incremented, and if it ever gets to the value of <option>connection_max_messages</option>,
49383 no further messages are sent over that connection.
49384 </para>
49385 </section>
49386 <section id="SECID145">
49387 <title>Use of the $host and $host_address variables</title>
49388 <para>
49389 <indexterm role="variable">
49390 <primary><varname>$host</varname></primary>
49391 </indexterm>
49392 <indexterm role="variable">
49393 <primary><varname>$host_address</varname></primary>
49394 </indexterm>
49395 At the start of a run of the <command>smtp</command> transport, the values of <varname>$host</varname> and
49396 <varname>$host_address</varname> are the name and IP address of the first host on the host list
49397 passed by the router. However, when the transport is about to connect to a
49398 specific host, and while it is connected to that host, <varname>$host</varname> and
49399 <varname>$host_address</varname> are set to the values for that host. These are the values
49400 that are in force when the <option>helo_data</option>, <option>hosts_try_auth</option>, <option>interface</option>,
49401 <option>serialize_hosts</option>, and the various TLS options are expanded.
49402 </para>
49403 </section>
49404 <section id="usecippeer">
49405 <title>Use of $tls_cipher and $tls_peerdn</title>
49406 <para>
49407 <indexterm role="variable">
49408 <primary><varname>$tls_bits</varname></primary>
49409 </indexterm>
49410 <indexterm role="variable">
49411 <primary><varname>$tls_cipher</varname></primary>
49412 </indexterm>
49413 <indexterm role="variable">
49414 <primary><varname>$tls_peerdn</varname></primary>
49415 </indexterm>
49416 <indexterm role="variable">
49417 <primary><varname>$tls_sni</varname></primary>
49418 </indexterm>
49419 At the start of a run of the <command>smtp</command> transport, the values of <varname>$tls_bits</varname>,
49420 <varname>$tls_cipher</varname>, <varname>$tls_peerdn</varname> and <varname>$tls_sni</varname>
49421 are the values that were set when the message was received.
49422 These are the values that are used for options that are expanded before any
49423 SMTP connections are made. Just before each connection is made, these four
49424 variables are emptied. If TLS is subsequently started, they are set to the
49425 appropriate values for the outgoing connection, and these are the values that
49426 are in force when any authenticators are run and when the
49427 <option>authenticated_sender</option> option is expanded.
49428 </para>
49429 <para>
49430 These variables are deprecated in favour of <varname>$tls_in_cipher</varname> et. al.
49431 and will be removed in a future release.
49432 </para>
49433 </section>
49434 <section id="SECID146">
49435 <title>Private options for smtp</title>
49436 <para>
49437 <indexterm role="concept">
49438 <primary>options</primary>
49439 <secondary><command>smtp</command> transport</secondary>
49440 </indexterm>
49441 The private options of the <command>smtp</command> transport are as follows:
49442 </para>
49443 <para>
49444 <indexterm role="option">
49445 <primary><option>address_retry_include_sender</option></primary>
49446 </indexterm>
49447 </para>
49448 <informaltable frame="all">
49449 <tgroup cols="4" colsep="0" rowsep="0">
49450 <colspec colwidth="8*" align="left"/>
49451 <colspec colwidth="6*" align="center"/>
49452 <colspec colwidth="6*" align="center"/>
49453 <colspec colwidth="6*" align="right"/>
49454 <tbody>
49455 <row>
49456 <entry><option>address_retry_include_sender</option></entry>
49457 <entry>Use: <emphasis>smtp</emphasis></entry>
49458 <entry>Type: <emphasis>boolean</emphasis></entry>
49459 <entry>Default: <emphasis>true</emphasis></entry>
49460 </row>
49461 </tbody>
49462 </tgroup>
49463 </informaltable>
49464 <para>
49465 <indexterm role="concept">
49466 <primary>4<emphasis>xx</emphasis> responses</primary>
49467 <secondary>retrying after</secondary>
49468 </indexterm>
49469 When an address is delayed because of a 4<emphasis>xx</emphasis> response to a RCPT command, it
49470 is the combination of sender and recipient that is delayed in subsequent queue
49471 runs until the retry time is reached. You can delay the recipient without
49472 reference to the sender (which is what earlier versions of Exim did), by
49473 setting <option>address_retry_include_sender</option> false. However, this can lead to
49474 problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT commands.
49475 </para>
49476 <para>
49477 <indexterm role="option">
49478 <primary><option>allow_localhost</option></primary>
49479 </indexterm>
49480 </para>
49481 <informaltable frame="all">
49482 <tgroup cols="4" colsep="0" rowsep="0">
49483 <colspec colwidth="8*" align="left"/>
49484 <colspec colwidth="6*" align="center"/>
49485 <colspec colwidth="6*" align="center"/>
49486 <colspec colwidth="6*" align="right"/>
49487 <tbody>
49488 <row>
49489 <entry><option>allow_localhost</option></entry>
49490 <entry>Use: <emphasis>smtp</emphasis></entry>
49491 <entry>Type: <emphasis>boolean</emphasis></entry>
49492 <entry>Default: <emphasis>false</emphasis></entry>
49493 </row>
49494 </tbody>
49495 </tgroup>
49496 </informaltable>
49497 <para>
49498 <indexterm role="concept">
49499 <primary>local host</primary>
49500 <secondary>sending to</secondary>
49501 </indexterm>
49502 <indexterm role="concept">
49503 <primary>fallback</primary>
49504 <secondary>hosts specified on transport</secondary>
49505 </indexterm>
49506 When a host specified in <option>hosts</option> or <option>fallback_hosts</option> (see below) turns out
49507 to be the local host, or is listed in <option>hosts_treat_as_local</option>, delivery is
49508 deferred by default. However, if <option>allow_localhost</option> is set, Exim goes on to do
49509 the delivery anyway. This should be used only in special cases when the
49510 configuration ensures that no looping will result (for example, a differently
49511 configured Exim is listening on the port to which the message is sent).
49512 </para>
49513 <para>
49514 <indexterm role="option">
49515 <primary><option>authenticated_sender</option></primary>
49516 </indexterm>
49517 </para>
49518 <informaltable frame="all">
49519 <tgroup cols="4" colsep="0" rowsep="0">
49520 <colspec colwidth="8*" align="left"/>
49521 <colspec colwidth="6*" align="center"/>
49522 <colspec colwidth="6*" align="center"/>
49523 <colspec colwidth="6*" align="right"/>
49524 <tbody>
49525 <row>
49526 <entry><option>authenticated_sender</option></entry>
49527 <entry>Use: <emphasis>smtp</emphasis></entry>
49528 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49529 <entry>Default: <emphasis>unset</emphasis></entry>
49530 </row>
49531 </tbody>
49532 </tgroup>
49533 </informaltable>
49534 <para>
49535 <indexterm role="concept">
49536 <primary>Cyrus</primary>
49537 </indexterm>
49538 When Exim has authenticated as a client, or if <option>authenticated_sender_force</option>
49539 is true, this option sets a value for the AUTH= item on outgoing MAIL commands,
49540 overriding any existing authenticated sender value. If the string expansion is
49541 forced to fail, the option is ignored. Other expansion failures cause delivery
49542 to be deferred. If the result of expansion is an empty string, that is also
49543 ignored.
49544 </para>
49545 <para>
49546 The expansion happens after the outgoing connection has been made and TLS
49547 started, if required. This means that the <varname>$host</varname>, <varname>$host_address</varname>,
49548 <varname>$tls_out_cipher</varname>, and <varname>$tls_out_peerdn</varname> variables are set according to the
49549 particular connection.
49550 </para>
49551 <para>
49552 If the SMTP session is not authenticated, the expansion of
49553 <option>authenticated_sender</option> still happens (and can cause the delivery to be
49554 deferred if it fails), but no AUTH= item is added to MAIL commands
49555 unless <option>authenticated_sender_force</option> is true.
49556 </para>
49557 <para>
49558 This option allows you to use the <command>smtp</command> transport in LMTP mode to
49559 deliver mail to Cyrus IMAP and provide the proper local part as the
49560 <quote>authenticated sender</quote>, via a setting such as:
49561 </para>
49562 <literallayout class="monospaced">
49563 authenticated_sender = $local_part
49564 </literallayout>
49565 <para>
49566 This removes the need for IMAP subfolders to be assigned special ACLs to
49567 allow direct delivery to those subfolders.
49568 </para>
49569 <para>
49570 Because of expected uses such as that just described for Cyrus (when no
49571 domain is involved), there is no checking on the syntax of the provided
49572 value.
49573 </para>
49574 <para>
49575 <indexterm role="option">
49576 <primary><option>authenticated_sender_force</option></primary>
49577 </indexterm>
49578 </para>
49579 <informaltable frame="all">
49580 <tgroup cols="4" colsep="0" rowsep="0">
49581 <colspec colwidth="8*" align="left"/>
49582 <colspec colwidth="6*" align="center"/>
49583 <colspec colwidth="6*" align="center"/>
49584 <colspec colwidth="6*" align="right"/>
49585 <tbody>
49586 <row>
49587 <entry><option>authenticated_sender_force</option></entry>
49588 <entry>Use: <emphasis>smtp</emphasis></entry>
49589 <entry>Type: <emphasis>boolean</emphasis></entry>
49590 <entry>Default: <emphasis>false</emphasis></entry>
49591 </row>
49592 </tbody>
49593 </tgroup>
49594 </informaltable>
49595 <para>
49596 If this option is set true, the <option>authenticated_sender</option> option&#x2019;s value
49597 is used for the AUTH= item on outgoing MAIL commands, even if Exim has not
49598 authenticated as a client.
49599 </para>
49600 <para>
49601 <indexterm role="option">
49602 <primary><option>command_timeout</option></primary>
49603 </indexterm>
49604 </para>
49605 <informaltable frame="all">
49606 <tgroup cols="4" colsep="0" rowsep="0">
49607 <colspec colwidth="8*" align="left"/>
49608 <colspec colwidth="6*" align="center"/>
49609 <colspec colwidth="6*" align="center"/>
49610 <colspec colwidth="6*" align="right"/>
49611 <tbody>
49612 <row>
49613 <entry><option>command_timeout</option></entry>
49614 <entry>Use: <emphasis>smtp</emphasis></entry>
49615 <entry>Type: <emphasis>time</emphasis></entry>
49616 <entry>Default: <emphasis>5m</emphasis></entry>
49617 </row>
49618 </tbody>
49619 </tgroup>
49620 </informaltable>
49621 <para>
49622 <indexterm role="concept">
49623 <primary>timeout</primary>
49624 <secondary>smtp transport command</secondary>
49625 </indexterm>
49626 This sets a timeout for receiving a response to an SMTP command that has been
49627 sent out. It is also used when waiting for the initial banner line from the
49628 remote host. Its value must not be zero.
49629 </para>
49630 <para>
49631 <indexterm role="option">
49632 <primary><option>connect_timeout</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>connect_timeout</option></entry>
49644 <entry>Use: <emphasis>smtp</emphasis></entry>
49645 <entry>Type: <emphasis>time</emphasis></entry>
49646 <entry>Default: <emphasis>5m</emphasis></entry>
49647 </row>
49648 </tbody>
49649 </tgroup>
49650 </informaltable>
49651 <para>
49652 <indexterm role="concept">
49653 <primary>timeout</primary>
49654 <secondary>smtp transport connect</secondary>
49655 </indexterm>
49656 This sets a timeout for the <function>connect()</function> function, which sets up a TCP/IP call
49657 to a remote host. A setting of zero allows the system timeout (typically
49658 several minutes) to act. To have any effect, the value of this option must be
49659 less than the system timeout. However, it has been observed that on some
49660 systems there is no system timeout, which is why the default value for this
49661 option is 5 minutes, a value recommended by RFC 1123.
49662 </para>
49663 <para>
49664 <indexterm role="option">
49665 <primary><option>connection_max_messages</option></primary>
49666 </indexterm>
49667 </para>
49668 <informaltable frame="all">
49669 <tgroup cols="4" colsep="0" rowsep="0">
49670 <colspec colwidth="8*" align="left"/>
49671 <colspec colwidth="6*" align="center"/>
49672 <colspec colwidth="6*" align="center"/>
49673 <colspec colwidth="6*" align="right"/>
49674 <tbody>
49675 <row>
49676 <entry><option>connection_max_messages</option></entry>
49677 <entry>Use: <emphasis>smtp</emphasis></entry>
49678 <entry>Type: <emphasis>integer</emphasis></entry>
49679 <entry>Default: <emphasis>500</emphasis></entry>
49680 </row>
49681 </tbody>
49682 </tgroup>
49683 </informaltable>
49684 <para>
49685 <indexterm role="concept">
49686 <primary>SMTP</primary>
49687 <secondary>passed connection</secondary>
49688 </indexterm>
49689 <indexterm role="concept">
49690 <primary>SMTP</primary>
49691 <secondary>multiple deliveries</secondary>
49692 </indexterm>
49693 <indexterm role="concept">
49694 <primary>multiple SMTP deliveries</primary>
49695 </indexterm>
49696 This controls the maximum number of separate message deliveries that are sent
49697 over a single TCP/IP connection. If the value is zero, there is no limit.
49698 For testing purposes, this value can be overridden by the <option>-oB</option> command line
49699 option.
49700 </para>
49701 <para>
49702 <indexterm role="option">
49703 <primary><option>dane_require_tls_ciphers</option></primary>
49704 </indexterm>
49705 </para>
49706 <informaltable frame="all">
49707 <tgroup cols="4" colsep="0" rowsep="0">
49708 <colspec colwidth="8*" align="left"/>
49709 <colspec colwidth="6*" align="center"/>
49710 <colspec colwidth="6*" align="center"/>
49711 <colspec colwidth="6*" align="right"/>
49712 <tbody>
49713 <row>
49714 <entry><option>dane_require_tls_ciphers</option></entry>
49715 <entry>Use: <emphasis>smtp</emphasis></entry>
49716 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49717 <entry>Default: <emphasis>unset</emphasis></entry>
49718 </row>
49719 </tbody>
49720 </tgroup>
49721 </informaltable>
49722 <para>
49723 <indexterm role="concept">
49724 <primary>TLS</primary>
49725 <secondary>requiring specific ciphers for DANE</secondary>
49726 </indexterm>
49727 <indexterm role="concept">
49728 <primary>cipher</primary>
49729 <secondary>requiring specific</secondary>
49730 </indexterm>
49731 <indexterm role="concept">
49732 <primary>DANE</primary>
49733 <secondary>TLS ciphers</secondary>
49734 </indexterm>
49735 This option may be used to override <option>tls_require_ciphers</option> for connections
49736 where DANE has been determined to be in effect.
49737 If not set, then <option>tls_require_ciphers</option> will be used.
49738 Normal SMTP delivery is not able to make strong demands of TLS cipher
49739 configuration, because delivery will fall back to plaintext.  Once DANE has
49740 been determined to be in effect, there is no plaintext fallback and making the
49741 TLS cipherlist configuration stronger will increase security, rather than
49742 counter-intuitively decreasing it.
49743 If the option expands to be empty or is forced to fail, then it will
49744 be treated as unset and <option>tls_require_ciphers</option> will be used instead.
49745 </para>
49746 <para>
49747 <indexterm role="option">
49748 <primary><option>data_timeout</option></primary>
49749 </indexterm>
49750 </para>
49751 <informaltable frame="all">
49752 <tgroup cols="4" colsep="0" rowsep="0">
49753 <colspec colwidth="8*" align="left"/>
49754 <colspec colwidth="6*" align="center"/>
49755 <colspec colwidth="6*" align="center"/>
49756 <colspec colwidth="6*" align="right"/>
49757 <tbody>
49758 <row>
49759 <entry><option>data_timeout</option></entry>
49760 <entry>Use: <emphasis>smtp</emphasis></entry>
49761 <entry>Type: <emphasis>time</emphasis></entry>
49762 <entry>Default: <emphasis>5m</emphasis></entry>
49763 </row>
49764 </tbody>
49765 </tgroup>
49766 </informaltable>
49767 <para>
49768 <indexterm role="concept">
49769 <primary>timeout</primary>
49770 <secondary>for transmitted SMTP data blocks</secondary>
49771 </indexterm>
49772 This sets a timeout for the transmission of each block in the data portion of
49773 the message. As a result, the overall timeout for a message depends on the size
49774 of the message. Its value must not be zero. See also <option>final_timeout</option>.
49775 </para>
49776 <para>
49777 <indexterm role="option">
49778 <primary><option>dkim_canon</option></primary>
49779 </indexterm>
49780 </para>
49781 <informaltable frame="all">
49782 <tgroup cols="4" colsep="0" rowsep="0">
49783 <colspec colwidth="8*" align="left"/>
49784 <colspec colwidth="6*" align="center"/>
49785 <colspec colwidth="6*" align="center"/>
49786 <colspec colwidth="6*" align="right"/>
49787 <tbody>
49788 <row>
49789 <entry><option>dkim_canon</option></entry>
49790 <entry>Use: <emphasis>smtp</emphasis></entry>
49791 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49792 <entry>Default: <emphasis>unset</emphasis></entry>
49793 </row>
49794 </tbody>
49795 </tgroup>
49796 </informaltable>
49797 <para>
49798 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49799 <indexterm role="option">
49800 <primary><option>dkim_domain</option></primary>
49801 </indexterm>
49802 </para>
49803 <informaltable frame="all">
49804 <tgroup cols="4" colsep="0" rowsep="0">
49805 <colspec colwidth="8*" align="left"/>
49806 <colspec colwidth="6*" align="center"/>
49807 <colspec colwidth="6*" align="center"/>
49808 <colspec colwidth="6*" align="right"/>
49809 <tbody>
49810 <row>
49811 <entry><option>dkim_domain</option></entry>
49812 <entry>Use: <emphasis>smtp</emphasis></entry>
49813 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
49814 <entry>Default: <emphasis>unset</emphasis></entry>
49815 </row>
49816 </tbody>
49817 </tgroup>
49818 </informaltable>
49819 <para>
49820 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49821 <indexterm role="option">
49822 <primary><option>dkim_hash</option></primary>
49823 </indexterm>
49824 </para>
49825 <informaltable frame="all">
49826 <tgroup cols="4" colsep="0" rowsep="0">
49827 <colspec colwidth="8*" align="left"/>
49828 <colspec colwidth="6*" align="center"/>
49829 <colspec colwidth="6*" align="center"/>
49830 <colspec colwidth="6*" align="right"/>
49831 <tbody>
49832 <row>
49833 <entry><option>dkim_hash</option></entry>
49834 <entry>Use: <emphasis>smtp</emphasis></entry>
49835 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49836 <entry>Default: <emphasis>sha256</emphasis></entry>
49837 </row>
49838 </tbody>
49839 </tgroup>
49840 </informaltable>
49841 <para>
49842 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49843 <indexterm role="option">
49844 <primary><option>dkim_identity</option></primary>
49845 </indexterm>
49846 </para>
49847 <informaltable frame="all">
49848 <tgroup cols="4" colsep="0" rowsep="0">
49849 <colspec colwidth="8*" align="left"/>
49850 <colspec colwidth="6*" align="center"/>
49851 <colspec colwidth="6*" align="center"/>
49852 <colspec colwidth="6*" align="right"/>
49853 <tbody>
49854 <row>
49855 <entry><option>dkim_identity</option></entry>
49856 <entry>Use: <emphasis>smtp</emphasis></entry>
49857 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49858 <entry>Default: <emphasis>unset</emphasis></entry>
49859 </row>
49860 </tbody>
49861 </tgroup>
49862 </informaltable>
49863 <para>
49864 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49865 <indexterm role="option">
49866 <primary><option>dkim_private_key</option></primary>
49867 </indexterm>
49868 </para>
49869 <informaltable frame="all">
49870 <tgroup cols="4" colsep="0" rowsep="0">
49871 <colspec colwidth="8*" align="left"/>
49872 <colspec colwidth="6*" align="center"/>
49873 <colspec colwidth="6*" align="center"/>
49874 <colspec colwidth="6*" align="right"/>
49875 <tbody>
49876 <row>
49877 <entry><option>dkim_private_key</option></entry>
49878 <entry>Use: <emphasis>smtp</emphasis></entry>
49879 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49880 <entry>Default: <emphasis>unset</emphasis></entry>
49881 </row>
49882 </tbody>
49883 </tgroup>
49884 </informaltable>
49885 <para>
49886 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49887 <indexterm role="option">
49888 <primary><option>dkim_selector</option></primary>
49889 </indexterm>
49890 </para>
49891 <informaltable frame="all">
49892 <tgroup cols="4" colsep="0" rowsep="0">
49893 <colspec colwidth="8*" align="left"/>
49894 <colspec colwidth="6*" align="center"/>
49895 <colspec colwidth="6*" align="center"/>
49896 <colspec colwidth="6*" align="right"/>
49897 <tbody>
49898 <row>
49899 <entry><option>dkim_selector</option></entry>
49900 <entry>Use: <emphasis>smtp</emphasis></entry>
49901 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49902 <entry>Default: <emphasis>unset</emphasis></entry>
49903 </row>
49904 </tbody>
49905 </tgroup>
49906 </informaltable>
49907 <para>
49908 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49909 <indexterm role="option">
49910 <primary><option>dkim_strict</option></primary>
49911 </indexterm>
49912 </para>
49913 <informaltable frame="all">
49914 <tgroup cols="4" colsep="0" rowsep="0">
49915 <colspec colwidth="8*" align="left"/>
49916 <colspec colwidth="6*" align="center"/>
49917 <colspec colwidth="6*" align="center"/>
49918 <colspec colwidth="6*" align="right"/>
49919 <tbody>
49920 <row>
49921 <entry><option>dkim_strict</option></entry>
49922 <entry>Use: <emphasis>smtp</emphasis></entry>
49923 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49924 <entry>Default: <emphasis>unset</emphasis></entry>
49925 </row>
49926 </tbody>
49927 </tgroup>
49928 </informaltable>
49929 <para>
49930 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49931 <indexterm role="option">
49932 <primary><option>dkim_sign_headers</option></primary>
49933 </indexterm>
49934 </para>
49935 <informaltable frame="all">
49936 <tgroup cols="4" colsep="0" rowsep="0">
49937 <colspec colwidth="8*" align="left"/>
49938 <colspec colwidth="6*" align="center"/>
49939 <colspec colwidth="6*" align="center"/>
49940 <colspec colwidth="6*" align="right"/>
49941 <tbody>
49942 <row>
49943 <entry><option>dkim_sign_headers</option></entry>
49944 <entry>Use: <emphasis>smtp</emphasis></entry>
49945 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49946 <entry>Default: <emphasis>per RFC</emphasis></entry>
49947 </row>
49948 </tbody>
49949 </tgroup>
49950 </informaltable>
49951 <para>
49952 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49953 <indexterm role="option">
49954 <primary><option>dkim_timestamps</option></primary>
49955 </indexterm>
49956 </para>
49957 <informaltable frame="all">
49958 <tgroup cols="4" colsep="0" rowsep="0">
49959 <colspec colwidth="8*" align="left"/>
49960 <colspec colwidth="6*" align="center"/>
49961 <colspec colwidth="6*" align="center"/>
49962 <colspec colwidth="6*" align="right"/>
49963 <tbody>
49964 <row>
49965 <entry><option>dkim_timestamps</option></entry>
49966 <entry>Use: <emphasis>smtp</emphasis></entry>
49967 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
49968 <entry>Default: <emphasis>unset</emphasis></entry>
49969 </row>
49970 </tbody>
49971 </tgroup>
49972 </informaltable>
49973 <para>
49974 DKIM signing option.  For details see section <xref linkend="SECDKIMSIGN"/>.
49975 </para>
49976 <para>
49977 <indexterm role="option">
49978 <primary><option>delay_after_cutoff</option></primary>
49979 </indexterm>
49980 </para>
49981 <informaltable frame="all">
49982 <tgroup cols="4" colsep="0" rowsep="0">
49983 <colspec colwidth="8*" align="left"/>
49984 <colspec colwidth="6*" align="center"/>
49985 <colspec colwidth="6*" align="center"/>
49986 <colspec colwidth="6*" align="right"/>
49987 <tbody>
49988 <row>
49989 <entry><option>delay_after_cutoff</option></entry>
49990 <entry>Use: <emphasis>smtp</emphasis></entry>
49991 <entry>Type: <emphasis>boolean</emphasis></entry>
49992 <entry>Default: <emphasis>true</emphasis></entry>
49993 </row>
49994 </tbody>
49995 </tgroup>
49996 </informaltable>
49997 <para>
49998 <indexterm role="concept">
49999 <primary>final cutoff</primary>
50000 <secondary>retries, controlling</secondary>
50001 </indexterm>
50002 <indexterm role="concept">
50003 <primary>retry</primary>
50004 <secondary>final cutoff</secondary>
50005 </indexterm>
50006 This option controls what happens when all remote IP addresses for a given
50007 domain have been inaccessible for so long that they have passed their retry
50008 cutoff times.
50009 </para>
50010 <para>
50011 In the default state, if the next retry time has not been reached for any of
50012 them, the address is bounced without trying any deliveries. In other words,
50013 Exim delays retrying an IP address after the final cutoff time until a new
50014 retry time is reached, and can therefore bounce an address without ever trying
50015 a delivery, when machines have been down for a long time. Some people are
50016 unhappy at this prospect, so...
50017 </para>
50018 <para>
50019 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
50020 addresses are past their final cutoff time, Exim tries to deliver to those
50021 IP addresses that have not been tried since the message arrived. If there are
50022 none, of if they all fail, the address is bounced. In other words, it does not
50023 delay when a new message arrives, but immediately tries those expired IP
50024 addresses that haven&#x2019;t been tried since the message arrived. If there is a
50025 continuous stream of messages for the dead hosts, unsetting
50026 <option>delay_after_cutoff</option> means that there will be many more attempts to deliver
50027 to them.
50028 </para>
50029 <para>
50030 <indexterm role="option">
50031 <primary><option>dns_qualify_single</option></primary>
50032 </indexterm>
50033 </para>
50034 <informaltable frame="all">
50035 <tgroup cols="4" colsep="0" rowsep="0">
50036 <colspec colwidth="8*" align="left"/>
50037 <colspec colwidth="6*" align="center"/>
50038 <colspec colwidth="6*" align="center"/>
50039 <colspec colwidth="6*" align="right"/>
50040 <tbody>
50041 <row>
50042 <entry><option>dns_qualify_single</option></entry>
50043 <entry>Use: <emphasis>smtp</emphasis></entry>
50044 <entry>Type: <emphasis>boolean</emphasis></entry>
50045 <entry>Default: <emphasis>true</emphasis></entry>
50046 </row>
50047 </tbody>
50048 </tgroup>
50049 </informaltable>
50050 <para>
50051 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used,
50052 and the <option>gethostbyname</option> option is false,
50053 the RES_DEFNAMES resolver option is set. See the <option>qualify_single</option> option
50054 in chapter <xref linkend="CHAPdnslookup"/> for more details.
50055 </para>
50056 <para>
50057 <indexterm role="option">
50058 <primary><option>dns_search_parents</option></primary>
50059 </indexterm>
50060 </para>
50061 <informaltable frame="all">
50062 <tgroup cols="4" colsep="0" rowsep="0">
50063 <colspec colwidth="8*" align="left"/>
50064 <colspec colwidth="6*" align="center"/>
50065 <colspec colwidth="6*" align="center"/>
50066 <colspec colwidth="6*" align="right"/>
50067 <tbody>
50068 <row>
50069 <entry><option>dns_search_parents</option></entry>
50070 <entry>Use: <emphasis>smtp</emphasis></entry>
50071 <entry>Type: <emphasis>boolean</emphasis></entry>
50072 <entry>Default: <emphasis>false</emphasis></entry>
50073 </row>
50074 </tbody>
50075 </tgroup>
50076 </informaltable>
50077 <para>
50078 If the <option>hosts</option> or <option>fallback_hosts</option> option is being used, and the
50079 <option>gethostbyname</option> option is false, the RES_DNSRCH resolver option is set.
50080 See the <option>search_parents</option> option in chapter <xref linkend="CHAPdnslookup"/> for more
50081 details.
50082 </para>
50083 <para>
50084 <indexterm role="option">
50085 <primary><option>dnssec_request_domains</option></primary>
50086 </indexterm>
50087 </para>
50088 <informaltable frame="all">
50089 <tgroup cols="4" colsep="0" rowsep="0">
50090 <colspec colwidth="8*" align="left"/>
50091 <colspec colwidth="6*" align="center"/>
50092 <colspec colwidth="6*" align="center"/>
50093 <colspec colwidth="6*" align="right"/>
50094 <tbody>
50095 <row>
50096 <entry><option>dnssec_request_domains</option></entry>
50097 <entry>Use: <emphasis>smtp</emphasis></entry>
50098 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
50099 <entry>Default: <emphasis>*</emphasis></entry>
50100 </row>
50101 </tbody>
50102 </tgroup>
50103 </informaltable>
50104 <para>
50105 <indexterm role="concept">
50106 <primary>MX record</primary>
50107 <secondary>security</secondary>
50108 </indexterm>
50109 <indexterm role="concept">
50110 <primary>DNSSEC</primary>
50111 <secondary>MX lookup</secondary>
50112 </indexterm>
50113 <indexterm role="concept">
50114 <primary>security</primary>
50115 <secondary>MX lookup</secondary>
50116 </indexterm>
50117 <indexterm role="concept">
50118 <primary>DNS</primary>
50119 <secondary>DNSSEC</secondary>
50120 </indexterm>
50121 DNS lookups for domains matching <option>dnssec_request_domains</option> will be done with
50122 the DNSSEC request bit set. Setting this transport option is only useful if the
50123 transport overrides or sets the host names. See the <option>dnssec_request_domains</option>
50124 router option.
50125 </para>
50126 <para>
50127 <indexterm role="option">
50128 <primary><option>dnssec_require_domains</option></primary>
50129 </indexterm>
50130 </para>
50131 <informaltable frame="all">
50132 <tgroup cols="4" colsep="0" rowsep="0">
50133 <colspec colwidth="8*" align="left"/>
50134 <colspec colwidth="6*" align="center"/>
50135 <colspec colwidth="6*" align="center"/>
50136 <colspec colwidth="6*" align="right"/>
50137 <tbody>
50138 <row>
50139 <entry><option>dnssec_require_domains</option></entry>
50140 <entry>Use: <emphasis>smtp</emphasis></entry>
50141 <entry>Type: <emphasis>domain list</emphasis>&dagger;<emphasis></emphasis></entry>
50142 <entry>Default: <emphasis>unset</emphasis></entry>
50143 </row>
50144 </tbody>
50145 </tgroup>
50146 </informaltable>
50147 <para>
50148 <indexterm role="concept">
50149 <primary>MX record</primary>
50150 <secondary>security</secondary>
50151 </indexterm>
50152 <indexterm role="concept">
50153 <primary>DNSSEC</primary>
50154 <secondary>MX lookup</secondary>
50155 </indexterm>
50156 <indexterm role="concept">
50157 <primary>security</primary>
50158 <secondary>MX lookup</secondary>
50159 </indexterm>
50160 <indexterm role="concept">
50161 <primary>DNS</primary>
50162 <secondary>DNSSEC</secondary>
50163 </indexterm>
50164 DNS lookups for domains matching <option>dnssec_require_domains</option> will be done with
50165 the DNSSEC request bit set.  Setting this transport option is only
50166 useful if the transport overrides or sets the host names. See the
50167 <option>dnssec_require_domains</option> router option.
50168 </para>
50169 <para>
50170 <indexterm role="option">
50171 <primary><option>dscp</option></primary>
50172 </indexterm>
50173 </para>
50174 <informaltable frame="all">
50175 <tgroup cols="4" colsep="0" rowsep="0">
50176 <colspec colwidth="8*" align="left"/>
50177 <colspec colwidth="6*" align="center"/>
50178 <colspec colwidth="6*" align="center"/>
50179 <colspec colwidth="6*" align="right"/>
50180 <tbody>
50181 <row>
50182 <entry><option>dscp</option></entry>
50183 <entry>Use: <emphasis>smtp</emphasis></entry>
50184 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50185 <entry>Default: <emphasis>unset</emphasis></entry>
50186 </row>
50187 </tbody>
50188 </tgroup>
50189 </informaltable>
50190 <para>
50191 <indexterm role="concept">
50192 <primary>DCSP</primary>
50193 <secondary>outbound</secondary>
50194 </indexterm>
50195 This option causes the DSCP value associated with a socket to be set to one
50196 of a number of fixed strings or to numeric value.
50197 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
50198 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
50199 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
50200 </para>
50201 <para>
50202 The outbound packets from Exim will be marked with this value in the header
50203 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
50204 that these values will have any effect, not be stripped by networking
50205 equipment, or do much of anything without cooperation with your Network
50206 Engineer and those of all network operators between the source and destination.
50207 </para>
50208 <para>
50209 <indexterm role="option">
50210 <primary><option>fallback_hosts</option></primary>
50211 </indexterm>
50212 </para>
50213 <informaltable frame="all">
50214 <tgroup cols="4" colsep="0" rowsep="0">
50215 <colspec colwidth="8*" align="left"/>
50216 <colspec colwidth="6*" align="center"/>
50217 <colspec colwidth="6*" align="center"/>
50218 <colspec colwidth="6*" align="right"/>
50219 <tbody>
50220 <row>
50221 <entry><option>fallback_hosts</option></entry>
50222 <entry>Use: <emphasis>smtp</emphasis></entry>
50223 <entry>Type: <emphasis>string list</emphasis></entry>
50224 <entry>Default: <emphasis>unset</emphasis></entry>
50225 </row>
50226 </tbody>
50227 </tgroup>
50228 </informaltable>
50229 <para>
50230 <indexterm role="concept">
50231 <primary>fallback</primary>
50232 <secondary>hosts specified on transport</secondary>
50233 </indexterm>
50234 String expansion is not applied to this option. The argument must be a
50235 colon-separated list of host names or IP addresses, optionally also including
50236 port numbers, though the separator can be changed, as described in section
50237 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
50238 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
50239 in section <xref linkend="SECTformatonehostitem"/>.
50240 </para>
50241 <para>
50242 Fallback hosts can also be specified on routers, which associate them with the
50243 addresses they process. As for the <option>hosts</option> option without <option>hosts_override</option>,
50244 <option>fallback_hosts</option> specified on the transport is used only if the address does
50245 not have its own associated fallback host list. Unlike <option>hosts</option>, a setting of
50246 <option>fallback_hosts</option> on an address is not overridden by <option>hosts_override</option>.
50247 However, <option>hosts_randomize</option> does apply to fallback host lists.
50248 </para>
50249 <para>
50250 If Exim is unable to deliver to any of the hosts for a particular address, and
50251 the errors are not permanent rejections, the address is put on a separate
50252 transport queue with its host list replaced by the fallback hosts, unless the
50253 address was routed via MX records and the current host was in the original MX
50254 list. In that situation, the fallback host list is not used.
50255 </para>
50256 <para>
50257 Once normal deliveries are complete, the fallback queue is delivered by
50258 re-running the same transports with the new host lists. If several failing
50259 addresses have the same fallback hosts (and <option>max_rcpt</option> permits it), a single
50260 copy of the message is sent.
50261 </para>
50262 <para>
50263 The resolution of the host names on the fallback list is controlled by the
50264 <option>gethostbyname</option> option, as for the <option>hosts</option> option. Fallback hosts apply
50265 both to cases when the host list comes with the address and when it is taken
50266 from <option>hosts</option>. This option provides a <quote>use a smart host only if delivery
50267 fails</quote> facility.
50268 </para>
50269 <para>
50270 <indexterm role="option">
50271 <primary><option>final_timeout</option></primary>
50272 </indexterm>
50273 </para>
50274 <informaltable frame="all">
50275 <tgroup cols="4" colsep="0" rowsep="0">
50276 <colspec colwidth="8*" align="left"/>
50277 <colspec colwidth="6*" align="center"/>
50278 <colspec colwidth="6*" align="center"/>
50279 <colspec colwidth="6*" align="right"/>
50280 <tbody>
50281 <row>
50282 <entry><option>final_timeout</option></entry>
50283 <entry>Use: <emphasis>smtp</emphasis></entry>
50284 <entry>Type: <emphasis>time</emphasis></entry>
50285 <entry>Default: <emphasis>10m</emphasis></entry>
50286 </row>
50287 </tbody>
50288 </tgroup>
50289 </informaltable>
50290 <para>
50291 <indexterm role="concept">
50292 <primary>timeout</primary>
50293 <secondary>for transmitted SMTP data accept</secondary>
50294 </indexterm>
50295 This is the timeout that applies while waiting for the response to the final
50296 line containing just <quote>.</quote> that terminates a message. Its value must not be
50297 zero.
50298 </para>
50299 <para>
50300 <indexterm role="option">
50301 <primary><option>gethostbyname</option></primary>
50302 </indexterm>
50303 </para>
50304 <informaltable frame="all">
50305 <tgroup cols="4" colsep="0" rowsep="0">
50306 <colspec colwidth="8*" align="left"/>
50307 <colspec colwidth="6*" align="center"/>
50308 <colspec colwidth="6*" align="center"/>
50309 <colspec colwidth="6*" align="right"/>
50310 <tbody>
50311 <row>
50312 <entry><option>gethostbyname</option></entry>
50313 <entry>Use: <emphasis>smtp</emphasis></entry>
50314 <entry>Type: <emphasis>boolean</emphasis></entry>
50315 <entry>Default: <emphasis>false</emphasis></entry>
50316 </row>
50317 </tbody>
50318 </tgroup>
50319 </informaltable>
50320 <para>
50321 If this option is true when the <option>hosts</option> and/or <option>fallback_hosts</option> options are
50322 being used, names are looked up using <function>gethostbyname()</function>
50323 (or <function>getipnodebyname()</function> when available)
50324 instead of using the DNS. Of course, that function may in fact use the DNS, but
50325 it may also consult other sources of information such as <filename>/etc/hosts</filename>.
50326 </para>
50327 <para>
50328 <indexterm role="option">
50329 <primary><option>gnutls_compat_mode</option></primary>
50330 </indexterm>
50331 </para>
50332 <informaltable frame="all">
50333 <tgroup cols="4" colsep="0" rowsep="0">
50334 <colspec colwidth="8*" align="left"/>
50335 <colspec colwidth="6*" align="center"/>
50336 <colspec colwidth="6*" align="center"/>
50337 <colspec colwidth="6*" align="right"/>
50338 <tbody>
50339 <row>
50340 <entry><option>gnutls_compat_mode</option></entry>
50341 <entry>Use: <emphasis>smtp</emphasis></entry>
50342 <entry>Type: <emphasis>boolean</emphasis></entry>
50343 <entry>Default: <emphasis>unset</emphasis></entry>
50344 </row>
50345 </tbody>
50346 </tgroup>
50347 </informaltable>
50348 <para>
50349 This option controls whether GnuTLS is used in compatibility mode in an Exim
50350 server. This reduces security slightly, but improves interworking with older
50351 implementations of TLS.
50352 </para>
50353 <para>
50354 <indexterm role="option">
50355 <primary><option>helo_data</option></primary>
50356 </indexterm>
50357 </para>
50358 <informaltable frame="all">
50359 <tgroup cols="4" colsep="0" rowsep="0">
50360 <colspec colwidth="8*" align="left"/>
50361 <colspec colwidth="6*" align="center"/>
50362 <colspec colwidth="6*" align="center"/>
50363 <colspec colwidth="6*" align="right"/>
50364 <tbody>
50365 <row>
50366 <entry><option>helo_data</option></entry>
50367 <entry>Use: <emphasis>smtp</emphasis></entry>
50368 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
50369 <entry>Default: <emphasis>see below</emphasis></entry>
50370 </row>
50371 </tbody>
50372 </tgroup>
50373 </informaltable>
50374 <para>
50375 <indexterm role="concept">
50376 <primary>HELO</primary>
50377 <secondary>argument, setting</secondary>
50378 </indexterm>
50379 <indexterm role="concept">
50380 <primary>EHLO</primary>
50381 <secondary>argument, setting</secondary>
50382 </indexterm>
50383 <indexterm role="concept">
50384 <primary>LHLO argument setting</primary>
50385 </indexterm>
50386 The value of this option is expanded after a connection to a another host has
50387 been set up. The result is used as the argument for the EHLO, HELO, or LHLO
50388 command that starts the outgoing SMTP or LMTP session. The default value of the
50389 option is:
50390 </para>
50391 <literallayout class="monospaced">
50392 $primary_hostname
50393 </literallayout>
50394 <para>
50395 During the expansion, the variables <varname>$host</varname> and <varname>$host_address</varname> are set to
50396 the identity of the remote host, and the variables <varname>$sending_ip_address</varname> and
50397 <varname>$sending_port</varname> are set to the local IP address and port number that are being
50398 used. These variables can be used to generate different values for different
50399 servers or different local IP addresses. For example, if you want the string
50400 that is used for <option>helo_data</option> to be obtained by a DNS lookup of the outgoing
50401 interface address, you could use this:
50402 </para>
50403 <literallayout class="monospaced">
50404 helo_data = ${lookup dnsdb{ptr=$sending_ip_address} \
50405   {${listextract{1}{&lt;\n $value}}} \
50406   {$primary_hostname}}
50407 </literallayout>
50408 <para>
50409 The use of <option>helo_data</option> applies both to sending messages and when doing
50410 callouts.
50411 </para>
50412 <para revisionflag="changed">
50413 <indexterm role="option">
50414 <primary><option>host_name_extract</option></primary>
50415 </indexterm>
50416 </para>
50417 <informaltable frame="all" revisionflag="changed">
50418 <tgroup cols="4" colsep="0" rowsep="0">
50419 <colspec colwidth="8*" align="left"/>
50420 <colspec colwidth="6*" align="center"/>
50421 <colspec colwidth="6*" align="center"/>
50422 <colspec colwidth="6*" align="right"/>
50423 <tbody>
50424 <row>
50425 <entry><option>host_name_extract</option></entry>
50426 <entry>Use: <emphasis>smtp</emphasis></entry>
50427 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
50428 <entry>Default: <emphasis>see below</emphasis></entry>
50429 </row>
50430 </tbody>
50431 </tgroup>
50432 </informaltable>
50433 <para revisionflag="changed">
50434 <indexterm role="concept">
50435 <primary>load balancer</primary>
50436 <secondary>hosts behind</secondary>
50437 </indexterm>
50438 <indexterm role="concept">
50439 <primary>TLS</primary>
50440 <secondary>resumption</secondary>
50441 </indexterm>
50442 Some mail-accepting sites
50443 (notably Microsoft)
50444 operate many servers behind a network load-balancer.  When this is done,
50445 with separated TLS session caches, TLS session resuption becomes problematic.
50446 It will only succeed when the same server happens to be selected by the
50447 load-balancer, matching the session stored in the client&#x2019;s cache.
50448 </para>
50449 <para revisionflag="changed">
50450 Exim can pull out a server name, if there is one, from the response to the
50451 client&#x2019;s SMTP EHLO command.
50452 The default value of this option:
50453 </para>
50454 <literallayout class="monospaced" revisionflag="changed">
50455     ${if and { {match {$host} {.outlook.com\$}} \
50456                {match {$item} {\N^250-([\w.]+)\s\N}} \
50457              } {$1}}
50458 </literallayout>
50459 <para revisionflag="changed">
50460 suffices for one known case.
50461 During the expansion of this option the <varname>$item</varname> variable will have the
50462 server&#x2019;s EHLO response.
50463 The result of the option expansion is included in the key used to store and
50464 retrieve the TLS session, for session resumption.
50465 </para>
50466 <para revisionflag="changed">
50467 Operators of high-load sites may wish to evaluate their logs for indications
50468 of other destination sites operating load-balancers, and develop a suitable
50469 expression for this option.
50470 The smtp:ehlo event and the <varname>$tls_out_resumption</varname> variable
50471 will be useful for such work.
50472 </para>
50473 <para>
50474 <indexterm role="option">
50475 <primary><option>hosts</option></primary>
50476 </indexterm>
50477 </para>
50478 <informaltable frame="all">
50479 <tgroup cols="4" colsep="0" rowsep="0">
50480 <colspec colwidth="8*" align="left"/>
50481 <colspec colwidth="6*" align="center"/>
50482 <colspec colwidth="6*" align="center"/>
50483 <colspec colwidth="6*" align="right"/>
50484 <tbody>
50485 <row>
50486 <entry><option>hosts</option></entry>
50487 <entry>Use: <emphasis>smtp</emphasis></entry>
50488 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
50489 <entry>Default: <emphasis>unset</emphasis></entry>
50490 </row>
50491 </tbody>
50492 </tgroup>
50493 </informaltable>
50494 <para>
50495 Hosts are associated with an address by a router such as <command>dnslookup</command>, which
50496 finds the hosts by looking up the address domain in the DNS, or by
50497 <command>manualroute</command>, which has lists of hosts in its configuration. However,
50498 email addresses can be passed to the <command>smtp</command> transport by any router, and not
50499 all of them can provide an associated list of hosts.
50500 </para>
50501 <para>
50502 The <option>hosts</option> option specifies a list of hosts to be used if the address being
50503 processed does not have any hosts associated with it. The hosts specified by
50504 <option>hosts</option> are also used, whether or not the address has its own hosts, if
50505 <option>hosts_override</option> is set.
50506 </para>
50507 <para>
50508 The string is first expanded, before being interpreted as a colon-separated
50509 list of host names or IP addresses, possibly including port numbers. The
50510 separator may be changed to something other than colon, as described in section
50511 <xref linkend="SECTlistconstruct"/>. Each individual item in the list is the same as an
50512 item in a <option>route_list</option> setting for the <command>manualroute</command> router, as described
50513 in section <xref linkend="SECTformatonehostitem"/>. However, note that the <literal>/MX</literal> facility
50514 of the <command>manualroute</command> router is not available here.
50515 </para>
50516 <para>
50517 If the expansion fails, delivery is deferred. Unless the failure was caused by
50518 the inability to complete a lookup, the error is logged to the panic log as
50519 well as the main log. Host names are looked up either by searching directly for
50520 address records in the DNS or by calling <function>gethostbyname()</function> (or
50521 <function>getipnodebyname()</function> when available), depending on the setting of the
50522 <option>gethostbyname</option> option. When Exim is compiled with IPv6 support, if a host
50523 that is looked up in the DNS has both IPv4 and IPv6 addresses, both types of
50524 address are used.
50525 </para>
50526 <para>
50527 During delivery, the hosts are tried in order, subject to their retry status,
50528 unless <option>hosts_randomize</option> is set.
50529 </para>
50530 <para>
50531 <indexterm role="option">
50532 <primary><option>hosts_avoid_esmtp</option></primary>
50533 </indexterm>
50534 </para>
50535 <informaltable frame="all">
50536 <tgroup cols="4" colsep="0" rowsep="0">
50537 <colspec colwidth="8*" align="left"/>
50538 <colspec colwidth="6*" align="center"/>
50539 <colspec colwidth="6*" align="center"/>
50540 <colspec colwidth="6*" align="right"/>
50541 <tbody>
50542 <row>
50543 <entry><option>hosts_avoid_esmtp</option></entry>
50544 <entry>Use: <emphasis>smtp</emphasis></entry>
50545 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50546 <entry>Default: <emphasis>unset</emphasis></entry>
50547 </row>
50548 </tbody>
50549 </tgroup>
50550 </informaltable>
50551 <para>
50552 <indexterm role="concept">
50553 <primary>ESMTP, avoiding use of</primary>
50554 </indexterm>
50555 <indexterm role="concept">
50556 <primary>HELO</primary>
50557 <secondary>forcing use of</secondary>
50558 </indexterm>
50559 <indexterm role="concept">
50560 <primary>EHLO</primary>
50561 <secondary>avoiding use of</secondary>
50562 </indexterm>
50563 <indexterm role="concept">
50564 <primary>PIPELINING</primary>
50565 <secondary>avoiding the use of</secondary>
50566 </indexterm>
50567 This option is for use with broken hosts that announce ESMTP facilities (for
50568 example, PIPELINING) and then fail to implement them properly. When a host
50569 matches <option>hosts_avoid_esmtp</option>, Exim sends HELO rather than EHLO at the
50570 start of the SMTP session. This means that it cannot use any of the ESMTP
50571 facilities such as AUTH, PIPELINING, SIZE, and STARTTLS.
50572 </para>
50573 <para>
50574 <indexterm role="option">
50575 <primary><option>hosts_avoid_pipelining</option></primary>
50576 </indexterm>
50577 </para>
50578 <informaltable frame="all">
50579 <tgroup cols="4" colsep="0" rowsep="0">
50580 <colspec colwidth="8*" align="left"/>
50581 <colspec colwidth="6*" align="center"/>
50582 <colspec colwidth="6*" align="center"/>
50583 <colspec colwidth="6*" align="right"/>
50584 <tbody>
50585 <row>
50586 <entry><option>hosts_avoid_pipelining</option></entry>
50587 <entry>Use: <emphasis>smtp</emphasis></entry>
50588 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50589 <entry>Default: <emphasis>unset</emphasis></entry>
50590 </row>
50591 </tbody>
50592 </tgroup>
50593 </informaltable>
50594 <para>
50595 <indexterm role="concept">
50596 <primary>PIPELINING</primary>
50597 <secondary>avoiding the use of</secondary>
50598 </indexterm>
50599 <indexterm role="concept">
50600 <primary>ESMTP extensions</primary>
50601 <secondary>PIPELINING</secondary>
50602 </indexterm>
50603 Exim will not use the ESMTP PIPELINING extension when delivering to any host
50604 that matches this list, even if the server host advertises PIPELINING support.
50605 </para>
50606 <para>
50607 <indexterm role="option">
50608 <primary><option>hosts_pipe_connect</option></primary>
50609 </indexterm>
50610 </para>
50611 <informaltable frame="all">
50612 <tgroup cols="4" colsep="0" rowsep="0">
50613 <colspec colwidth="8*" align="left"/>
50614 <colspec colwidth="6*" align="center"/>
50615 <colspec colwidth="6*" align="center"/>
50616 <colspec colwidth="6*" align="right"/>
50617 <tbody>
50618 <row>
50619 <entry><option>hosts_pipe_connect</option></entry>
50620 <entry>Use: <emphasis>smtp</emphasis></entry>
50621 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50622 <entry>Default: <emphasis>unset</emphasis></entry>
50623 </row>
50624 </tbody>
50625 </tgroup>
50626 </informaltable>
50627 <para>
50628 <indexterm role="concept">
50629 <primary>pipelining</primary>
50630 <secondary>early connection</secondary>
50631 </indexterm>
50632 <indexterm role="concept">
50633 <primary>pipelining</primary>
50634 <secondary>PIPECONNECT</secondary>
50635 </indexterm>
50636 If Exim is built with the SUPPORT_PIPE_CONNECT build option
50637 this option controls which to hosts the facility watched for
50638 and recorded, and used for subsequent connections.
50639 </para>
50640 <para>
50641 The retry hints database is used for the record,
50642 and records are subject to the <option>retry_data_expire</option> option.
50643 When used, the pipelining saves on roundtrip times.
50644 It also turns SMTP into a client-first protocol
50645 so combines well with TCP Fast Open.
50646 </para>
50647 <para>
50648 See also the <option>pipelining_connect_advertise_hosts</option> main option.
50649 </para>
50650 <para>
50651 Note:
50652 </para>
50653 <para revisionflag="changed">
50654 When the facility is used, if the transport <option>interface</option> option is unset
50655 the <option>helo_data</option> option
50656 </para>
50657 <para>
50658 will be expanded before the <varname>$sending_ip_address</varname> variable
50659 is filled in.
50660 A check is made for the use of that variable, without the
50661 presence of a <quote>def:</quote> test on it, but suitably complex coding
50662 can avoid the check and produce unexpected results.
50663 You have been warned.
50664 </para>
50665 <para>
50666 <indexterm role="option">
50667 <primary><option>hosts_avoid_tls</option></primary>
50668 </indexterm>
50669 </para>
50670 <informaltable frame="all">
50671 <tgroup cols="4" colsep="0" rowsep="0">
50672 <colspec colwidth="8*" align="left"/>
50673 <colspec colwidth="6*" align="center"/>
50674 <colspec colwidth="6*" align="center"/>
50675 <colspec colwidth="6*" align="right"/>
50676 <tbody>
50677 <row>
50678 <entry><option>hosts_avoid_tls</option></entry>
50679 <entry>Use: <emphasis>smtp</emphasis></entry>
50680 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50681 <entry>Default: <emphasis>unset</emphasis></entry>
50682 </row>
50683 </tbody>
50684 </tgroup>
50685 </informaltable>
50686 <para>
50687 <indexterm role="concept">
50688 <primary>TLS</primary>
50689 <secondary>avoiding for certain hosts</secondary>
50690 </indexterm>
50691 Exim will not try to start a TLS session when delivering to any host that
50692 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
50693 </para>
50694 <para>
50695 <indexterm role="option">
50696 <primary><option>hosts_verify_avoid_tls</option></primary>
50697 </indexterm>
50698 </para>
50699 <informaltable frame="all">
50700 <tgroup cols="4" colsep="0" rowsep="0">
50701 <colspec colwidth="8*" align="left"/>
50702 <colspec colwidth="6*" align="center"/>
50703 <colspec colwidth="6*" align="center"/>
50704 <colspec colwidth="6*" align="right"/>
50705 <tbody>
50706 <row>
50707 <entry><option>hosts_verify_avoid_tls</option></entry>
50708 <entry>Use: <emphasis>smtp</emphasis></entry>
50709 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50710 <entry>Default: <emphasis>unset</emphasis></entry>
50711 </row>
50712 </tbody>
50713 </tgroup>
50714 </informaltable>
50715 <para>
50716 <indexterm role="concept">
50717 <primary>TLS</primary>
50718 <secondary>avoiding for certain hosts</secondary>
50719 </indexterm>
50720 Exim will not try to start a TLS session for a verify callout,
50721 or when delivering in cutthrough mode,
50722 to any host that matches this list.
50723 </para>
50724 <para>
50725 <indexterm role="option">
50726 <primary><option>hosts_max_try</option></primary>
50727 </indexterm>
50728 </para>
50729 <informaltable frame="all">
50730 <tgroup cols="4" colsep="0" rowsep="0">
50731 <colspec colwidth="8*" align="left"/>
50732 <colspec colwidth="6*" align="center"/>
50733 <colspec colwidth="6*" align="center"/>
50734 <colspec colwidth="6*" align="right"/>
50735 <tbody>
50736 <row>
50737 <entry><option>hosts_max_try</option></entry>
50738 <entry>Use: <emphasis>smtp</emphasis></entry>
50739 <entry>Type: <emphasis>integer</emphasis></entry>
50740 <entry>Default: <emphasis>5</emphasis></entry>
50741 </row>
50742 </tbody>
50743 </tgroup>
50744 </informaltable>
50745 <para>
50746 <indexterm role="concept">
50747 <primary>host</primary>
50748 <secondary>maximum number to try</secondary>
50749 </indexterm>
50750 <indexterm role="concept">
50751 <primary>limit</primary>
50752 <secondary>number of hosts tried</secondary>
50753 </indexterm>
50754 <indexterm role="concept">
50755 <primary>limit</primary>
50756 <secondary>number of MX tried</secondary>
50757 </indexterm>
50758 <indexterm role="concept">
50759 <primary>MX record</primary>
50760 <secondary>maximum tried</secondary>
50761 </indexterm>
50762 This option limits the number of IP addresses that are tried for any one
50763 delivery in cases where there are temporary delivery errors. Section
50764 <xref linkend="SECTvalhosmax"/> describes in detail how the value of this option is used.
50765 </para>
50766 <para>
50767 <indexterm role="option">
50768 <primary><option>hosts_max_try_hardlimit</option></primary>
50769 </indexterm>
50770 </para>
50771 <informaltable frame="all">
50772 <tgroup cols="4" colsep="0" rowsep="0">
50773 <colspec colwidth="8*" align="left"/>
50774 <colspec colwidth="6*" align="center"/>
50775 <colspec colwidth="6*" align="center"/>
50776 <colspec colwidth="6*" align="right"/>
50777 <tbody>
50778 <row>
50779 <entry><option>hosts_max_try_hardlimit</option></entry>
50780 <entry>Use: <emphasis>smtp</emphasis></entry>
50781 <entry>Type: <emphasis>integer</emphasis></entry>
50782 <entry>Default: <emphasis>50</emphasis></entry>
50783 </row>
50784 </tbody>
50785 </tgroup>
50786 </informaltable>
50787 <para>
50788 This is an additional check on the maximum number of IP addresses that Exim
50789 tries for any one delivery. Section <xref linkend="SECTvalhosmax"/> describes its use and
50790 why it exists.
50791 </para>
50792 <para>
50793 <indexterm role="option">
50794 <primary><option>hosts_nopass_tls</option></primary>
50795 </indexterm>
50796 </para>
50797 <informaltable frame="all">
50798 <tgroup cols="4" colsep="0" rowsep="0">
50799 <colspec colwidth="8*" align="left"/>
50800 <colspec colwidth="6*" align="center"/>
50801 <colspec colwidth="6*" align="center"/>
50802 <colspec colwidth="6*" align="right"/>
50803 <tbody>
50804 <row>
50805 <entry><option>hosts_nopass_tls</option></entry>
50806 <entry>Use: <emphasis>smtp</emphasis></entry>
50807 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50808 <entry>Default: <emphasis>unset</emphasis></entry>
50809 </row>
50810 </tbody>
50811 </tgroup>
50812 </informaltable>
50813 <para>
50814 <indexterm role="concept">
50815 <primary>TLS</primary>
50816 <secondary>passing connection</secondary>
50817 </indexterm>
50818 <indexterm role="concept">
50819 <primary>multiple SMTP deliveries</primary>
50820 </indexterm>
50821 <indexterm role="concept">
50822 <primary>TLS</primary>
50823 <secondary>multiple message deliveries</secondary>
50824 </indexterm>
50825 For any host that matches this list, a connection on which a TLS session has
50826 been started will not be passed to a new delivery process for sending another
50827 message on the same connection. See section <xref linkend="SECTmulmessam"/> for an
50828 explanation of when this might be needed.
50829 </para>
50830 <para>
50831 <indexterm role="option">
50832 <primary><option>hosts_noproxy_tls</option></primary>
50833 </indexterm>
50834 </para>
50835 <informaltable frame="all">
50836 <tgroup cols="4" colsep="0" rowsep="0">
50837 <colspec colwidth="8*" align="left"/>
50838 <colspec colwidth="6*" align="center"/>
50839 <colspec colwidth="6*" align="center"/>
50840 <colspec colwidth="6*" align="right"/>
50841 <tbody>
50842 <row>
50843 <entry><option>hosts_noproxy_tls</option></entry>
50844 <entry>Use: <emphasis>smtp</emphasis></entry>
50845 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50846 <entry>Default: <emphasis>unset</emphasis></entry>
50847 </row>
50848 </tbody>
50849 </tgroup>
50850 </informaltable>
50851 <para>
50852 <indexterm role="concept">
50853 <primary>TLS</primary>
50854 <secondary>passing connection</secondary>
50855 </indexterm>
50856 <indexterm role="concept">
50857 <primary>multiple SMTP deliveries</primary>
50858 </indexterm>
50859 <indexterm role="concept">
50860 <primary>TLS</primary>
50861 <secondary>multiple message deliveries</secondary>
50862 </indexterm>
50863 For any host that matches this list, a TLS session which has
50864 been started will not be passed to a new delivery process for sending another
50865 message on the same session.
50866 </para>
50867 <para>
50868 The traditional implementation closes down TLS and re-starts it in the new
50869 process, on the same open TCP connection, for each successive message
50870 sent.  If permitted by this option a pipe to to the new process is set up
50871 instead, and the original process maintains the TLS connection and proxies
50872 the SMTP connection from and to the new process and any subsequents.
50873 The new process has no access to TLS information, so cannot include it in
50874 logging.
50875 </para>
50876 <para>
50877 <indexterm role="option">
50878 <primary><option>hosts_override</option></primary>
50879 </indexterm>
50880 </para>
50881 <informaltable frame="all">
50882 <tgroup cols="4" colsep="0" rowsep="0">
50883 <colspec colwidth="8*" align="left"/>
50884 <colspec colwidth="6*" align="center"/>
50885 <colspec colwidth="6*" align="center"/>
50886 <colspec colwidth="6*" align="right"/>
50887 <tbody>
50888 <row>
50889 <entry><option>hosts_override</option></entry>
50890 <entry>Use: <emphasis>smtp</emphasis></entry>
50891 <entry>Type: <emphasis>boolean</emphasis></entry>
50892 <entry>Default: <emphasis>false</emphasis></entry>
50893 </row>
50894 </tbody>
50895 </tgroup>
50896 </informaltable>
50897 <para>
50898 If this option is set and the <option>hosts</option> option is also set, any hosts that are
50899 attached to the address are ignored, and instead the hosts specified by the
50900 <option>hosts</option> option are always used. This option does not apply to
50901 <option>fallback_hosts</option>.
50902 </para>
50903 <para>
50904 <indexterm role="option">
50905 <primary><option>hosts_randomize</option></primary>
50906 </indexterm>
50907 </para>
50908 <informaltable frame="all">
50909 <tgroup cols="4" colsep="0" rowsep="0">
50910 <colspec colwidth="8*" align="left"/>
50911 <colspec colwidth="6*" align="center"/>
50912 <colspec colwidth="6*" align="center"/>
50913 <colspec colwidth="6*" align="right"/>
50914 <tbody>
50915 <row>
50916 <entry><option>hosts_randomize</option></entry>
50917 <entry>Use: <emphasis>smtp</emphasis></entry>
50918 <entry>Type: <emphasis>boolean</emphasis></entry>
50919 <entry>Default: <emphasis>false</emphasis></entry>
50920 </row>
50921 </tbody>
50922 </tgroup>
50923 </informaltable>
50924 <para>
50925 <indexterm role="concept">
50926 <primary>randomized host list</primary>
50927 </indexterm>
50928 <indexterm role="concept">
50929 <primary>host</primary>
50930 <secondary>list of; randomized</secondary>
50931 </indexterm>
50932 <indexterm role="concept">
50933 <primary>fallback</primary>
50934 <secondary>randomized hosts</secondary>
50935 </indexterm>
50936 If this option is set, and either the list of hosts is taken from the
50937 <option>hosts</option> or the <option>fallback_hosts</option> option, or the hosts supplied by the router
50938 were not obtained from MX records (this includes fallback hosts from the
50939 router), and were not randomized by the router, the order of trying the hosts
50940 is randomized each time the transport runs. Randomizing the order of a host
50941 list can be used to do crude load sharing.
50942 </para>
50943 <para>
50944 When <option>hosts_randomize</option> is true, a host list may be split into groups whose
50945 order is separately randomized. This makes it possible to set up MX-like
50946 behaviour. The boundaries between groups are indicated by an item that is just
50947 <literal>+</literal> in the host list. For example:
50948 </para>
50949 <literallayout class="monospaced">
50950 hosts = host1:host2:host3:+:host4:host5
50951 </literallayout>
50952 <para>
50953 The order of the first three hosts and the order of the last two hosts is
50954 randomized for each use, but the first three always end up before the last two.
50955 If <option>hosts_randomize</option> is not set, a <literal>+</literal> item in the list is ignored.
50956 </para>
50957 <para>
50958 <indexterm role="option">
50959 <primary><option>hosts_require_auth</option></primary>
50960 </indexterm>
50961 </para>
50962 <informaltable frame="all">
50963 <tgroup cols="4" colsep="0" rowsep="0">
50964 <colspec colwidth="8*" align="left"/>
50965 <colspec colwidth="6*" align="center"/>
50966 <colspec colwidth="6*" align="center"/>
50967 <colspec colwidth="6*" align="right"/>
50968 <tbody>
50969 <row>
50970 <entry><option>hosts_require_auth</option></entry>
50971 <entry>Use: <emphasis>smtp</emphasis></entry>
50972 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
50973 <entry>Default: <emphasis>unset</emphasis></entry>
50974 </row>
50975 </tbody>
50976 </tgroup>
50977 </informaltable>
50978 <para>
50979 <indexterm role="concept">
50980 <primary>authentication</primary>
50981 <secondary>required by client</secondary>
50982 </indexterm>
50983 This option provides a list of servers for which authentication must succeed
50984 before Exim will try to transfer a message. If authentication fails for
50985 servers which are not in this list, Exim tries to send unauthenticated. If
50986 authentication fails for one of these servers, delivery is deferred. This
50987 temporary error is detectable in the retry rules, so it can be turned into a
50988 hard failure if required. See also <option>hosts_try_auth</option>, and chapter
50989 <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
50990 </para>
50991 <para>
50992 <indexterm role="option">
50993 <primary><option>hosts_request_ocsp</option></primary>
50994 </indexterm>
50995 </para>
50996 <informaltable frame="all">
50997 <tgroup cols="4" colsep="0" rowsep="0">
50998 <colspec colwidth="8*" align="left"/>
50999 <colspec colwidth="6*" align="center"/>
51000 <colspec colwidth="6*" align="center"/>
51001 <colspec colwidth="6*" align="right"/>
51002 <tbody>
51003 <row>
51004 <entry><option>hosts_request_ocsp</option></entry>
51005 <entry>Use: <emphasis>smtp</emphasis></entry>
51006 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51007 <entry>Default: <emphasis>*</emphasis></entry>
51008 </row>
51009 </tbody>
51010 </tgroup>
51011 </informaltable>
51012 <para>
51013 <indexterm role="concept">
51014 <primary>TLS</primary>
51015 <secondary>requiring for certain servers</secondary>
51016 </indexterm>
51017 Exim will request a Certificate Status on a
51018 TLS session for any host that matches this list.
51019 <option>tls_verify_certificates</option> should also be set for the transport.
51020 </para>
51021 <para>
51022 <indexterm role="option">
51023 <primary><option>hosts_require_alpn</option></primary>
51024 </indexterm>
51025 </para>
51026 <informaltable frame="all">
51027 <tgroup cols="4" colsep="0" rowsep="0">
51028 <colspec colwidth="8*" align="left"/>
51029 <colspec colwidth="6*" align="center"/>
51030 <colspec colwidth="6*" align="center"/>
51031 <colspec colwidth="6*" align="right"/>
51032 <tbody>
51033 <row>
51034 <entry><option>hosts_require_alpn</option></entry>
51035 <entry>Use: <emphasis>smtp</emphasis></entry>
51036 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51037 <entry>Default: <emphasis>unset</emphasis></entry>
51038 </row>
51039 </tbody>
51040 </tgroup>
51041 </informaltable>
51042 <para>
51043 <indexterm role="concept">
51044 <primary>ALPN</primary>
51045 <secondary>require negotiation in client</secondary>
51046 </indexterm>
51047 <indexterm role="concept">
51048 <primary>TLS</primary>
51049 <secondary>ALPN</secondary>
51050 </indexterm>
51051 <indexterm role="concept">
51052 <primary>TLS</primary>
51053 <secondary>Application Layer Protocol Names</secondary>
51054 </indexterm>
51055 If the TLS library supports ALPN
51056 then a successful negotiation of ALPN will be required for any host
51057 matching the list, for TLS to be used.
51058 See also the <option>tls_alpn</option> option.
51059 </para>
51060 <para>
51061 <emphasis role="bold">Note</emphasis>: prevention of fallback to in-clear connection is not
51062 managed by this option; see <option>hosts_require_tls</option>.
51063 </para>
51064 <para>
51065 <indexterm role="option">
51066 <primary><option>hosts_require_dane</option></primary>
51067 </indexterm>
51068 </para>
51069 <informaltable frame="all">
51070 <tgroup cols="4" colsep="0" rowsep="0">
51071 <colspec colwidth="8*" align="left"/>
51072 <colspec colwidth="6*" align="center"/>
51073 <colspec colwidth="6*" align="center"/>
51074 <colspec colwidth="6*" align="right"/>
51075 <tbody>
51076 <row>
51077 <entry><option>hosts_require_dane</option></entry>
51078 <entry>Use: <emphasis>smtp</emphasis></entry>
51079 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51080 <entry>Default: <emphasis>unset</emphasis></entry>
51081 </row>
51082 </tbody>
51083 </tgroup>
51084 </informaltable>
51085 <para>
51086 <indexterm role="concept">
51087 <primary>DANE</primary>
51088 <secondary>transport options</secondary>
51089 </indexterm>
51090 <indexterm role="concept">
51091 <primary>DANE</primary>
51092 <secondary>requiring for certain servers</secondary>
51093 </indexterm>
51094 If built with DANE support, Exim  will require that a DNSSEC-validated
51095 TLSA record is present for any host matching the list,
51096 and that a DANE-verified TLS connection is made.
51097 There will be no fallback to in-clear communication.
51098 See the <option>dnssec_request_domains</option> router and transport options.
51099 See section <xref linkend="SECDANE"/>.
51100 </para>
51101 <para>
51102 <indexterm role="option">
51103 <primary><option>hosts_require_ocsp</option></primary>
51104 </indexterm>
51105 </para>
51106 <informaltable frame="all">
51107 <tgroup cols="4" colsep="0" rowsep="0">
51108 <colspec colwidth="8*" align="left"/>
51109 <colspec colwidth="6*" align="center"/>
51110 <colspec colwidth="6*" align="center"/>
51111 <colspec colwidth="6*" align="right"/>
51112 <tbody>
51113 <row>
51114 <entry><option>hosts_require_ocsp</option></entry>
51115 <entry>Use: <emphasis>smtp</emphasis></entry>
51116 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51117 <entry>Default: <emphasis>unset</emphasis></entry>
51118 </row>
51119 </tbody>
51120 </tgroup>
51121 </informaltable>
51122 <para>
51123 <indexterm role="concept">
51124 <primary>TLS</primary>
51125 <secondary>requiring for certain servers</secondary>
51126 </indexterm>
51127 Exim will request, and check for a valid Certificate Status being given, on a
51128 TLS session for any host that matches this list.
51129 <option>tls_verify_certificates</option> should also be set for the transport.
51130 </para>
51131 <para>
51132 <indexterm role="option">
51133 <primary><option>hosts_require_tls</option></primary>
51134 </indexterm>
51135 </para>
51136 <informaltable frame="all">
51137 <tgroup cols="4" colsep="0" rowsep="0">
51138 <colspec colwidth="8*" align="left"/>
51139 <colspec colwidth="6*" align="center"/>
51140 <colspec colwidth="6*" align="center"/>
51141 <colspec colwidth="6*" align="right"/>
51142 <tbody>
51143 <row>
51144 <entry><option>hosts_require_tls</option></entry>
51145 <entry>Use: <emphasis>smtp</emphasis></entry>
51146 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51147 <entry>Default: <emphasis>unset</emphasis></entry>
51148 </row>
51149 </tbody>
51150 </tgroup>
51151 </informaltable>
51152 <para>
51153 <indexterm role="concept">
51154 <primary>TLS</primary>
51155 <secondary>requiring for certain servers</secondary>
51156 </indexterm>
51157 Exim will insist on using a TLS session when delivering to any host that
51158 matches this list. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
51159 <emphasis role="bold">Note</emphasis>: This option affects outgoing mail only. To insist on TLS for
51160 incoming messages, use an appropriate ACL.
51161 </para>
51162 <para>
51163 <indexterm role="option">
51164 <primary><option>hosts_try_auth</option></primary>
51165 </indexterm>
51166 </para>
51167 <informaltable frame="all">
51168 <tgroup cols="4" colsep="0" rowsep="0">
51169 <colspec colwidth="8*" align="left"/>
51170 <colspec colwidth="6*" align="center"/>
51171 <colspec colwidth="6*" align="center"/>
51172 <colspec colwidth="6*" align="right"/>
51173 <tbody>
51174 <row>
51175 <entry><option>hosts_try_auth</option></entry>
51176 <entry>Use: <emphasis>smtp</emphasis></entry>
51177 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51178 <entry>Default: <emphasis>unset</emphasis></entry>
51179 </row>
51180 </tbody>
51181 </tgroup>
51182 </informaltable>
51183 <para>
51184 <indexterm role="concept">
51185 <primary>authentication</primary>
51186 <secondary>optional in client</secondary>
51187 </indexterm>
51188 This option provides a list of servers to which, provided they announce
51189 authentication support, Exim will attempt to authenticate as a client when it
51190 connects. If authentication fails
51191 and <option>hosts_require_auth</option> permits,
51192 Exim will try to transfer the message unauthenticated.
51193 See also chapter <xref linkend="CHAPSMTPAUTH"/> for details of authentication.
51194 </para>
51195 <para>
51196 <indexterm role="option">
51197 <primary><option>hosts_try_chunking</option></primary>
51198 </indexterm>
51199 </para>
51200 <informaltable frame="all">
51201 <tgroup cols="4" colsep="0" rowsep="0">
51202 <colspec colwidth="8*" align="left"/>
51203 <colspec colwidth="6*" align="center"/>
51204 <colspec colwidth="6*" align="center"/>
51205 <colspec colwidth="6*" align="right"/>
51206 <tbody>
51207 <row>
51208 <entry><option>hosts_try_chunking</option></entry>
51209 <entry>Use: <emphasis>smtp</emphasis></entry>
51210 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51211 <entry>Default: <emphasis>*</emphasis></entry>
51212 </row>
51213 </tbody>
51214 </tgroup>
51215 </informaltable>
51216 <para>
51217 <indexterm role="concept">
51218 <primary>CHUNKING</primary>
51219 <secondary>enabling, in client</secondary>
51220 </indexterm>
51221 <indexterm role="concept">
51222 <primary>BDAT</primary>
51223 <secondary>SMTP command</secondary>
51224 </indexterm>
51225 <indexterm role="concept">
51226 <primary>RFC 3030</primary>
51227 <secondary>CHUNKING</secondary>
51228 </indexterm>
51229 This option provides a list of servers to which, provided they announce
51230 CHUNKING support, Exim will attempt to use BDAT commands rather than DATA.
51231 Unless DKIM signing is being done,
51232 BDAT will not be used in conjunction with a transport filter.
51233 </para>
51234 <para>
51235 <indexterm role="option">
51236 <primary><option>hosts_try_dane</option></primary>
51237 </indexterm>
51238 </para>
51239 <informaltable frame="all">
51240 <tgroup cols="4" colsep="0" rowsep="0">
51241 <colspec colwidth="8*" align="left"/>
51242 <colspec colwidth="6*" align="center"/>
51243 <colspec colwidth="6*" align="center"/>
51244 <colspec colwidth="6*" align="right"/>
51245 <tbody>
51246 <row>
51247 <entry><option>hosts_try_dane</option></entry>
51248 <entry>Use: <emphasis>smtp</emphasis></entry>
51249 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51250 <entry>Default: <emphasis>*</emphasis></entry>
51251 </row>
51252 </tbody>
51253 </tgroup>
51254 </informaltable>
51255 <para>
51256 <indexterm role="concept">
51257 <primary>DANE</primary>
51258 <secondary>transport options</secondary>
51259 </indexterm>
51260 <indexterm role="concept">
51261 <primary>DANE</primary>
51262 <secondary>attempting for certain servers</secondary>
51263 </indexterm>
51264 If built with DANE support, Exim  will look up a
51265 TLSA record for any host matching the list,
51266 If one is found and that lookup was DNSSEC-validated,
51267 then Exim requires that a DANE-verified TLS connection is made for that host;
51268 there will be no fallback to in-clear communication.
51269 See the <option>dnssec_request_domains</option> router and transport options.
51270 See section <xref linkend="SECDANE"/>.
51271 </para>
51272 <para>
51273 <indexterm role="option">
51274 <primary><option>hosts_try_fastopen</option></primary>
51275 </indexterm>
51276 </para>
51277 <informaltable frame="all">
51278 <tgroup cols="4" colsep="0" rowsep="0">
51279 <colspec colwidth="8*" align="left"/>
51280 <colspec colwidth="6*" align="center"/>
51281 <colspec colwidth="6*" align="center"/>
51282 <colspec colwidth="6*" align="right"/>
51283 <tbody>
51284 <row>
51285 <entry><option>hosts_try_fastopen</option></entry>
51286 <entry>Use: <emphasis>smtp</emphasis></entry>
51287 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51288 <entry>Default: <emphasis>*</emphasis></entry>
51289 </row>
51290 </tbody>
51291 </tgroup>
51292 </informaltable>
51293 <para>
51294 <indexterm role="concept">
51295 <primary>fast open, TCP</primary>
51296 <secondary>enabling, in client</secondary>
51297 </indexterm>
51298 <indexterm role="concept">
51299 <primary>TCP Fast Open</primary>
51300 <secondary>enabling, in client</secondary>
51301 </indexterm>
51302 <indexterm role="concept">
51303 <primary>RFC 7413</primary>
51304 <secondary>TCP Fast Open</secondary>
51305 </indexterm>
51306 This option provides a list of servers to which, provided
51307 the facility is supported by this system, Exim will attempt to
51308 perform a TCP Fast Open.
51309 No data is sent on the SYN segment but, if the remote server also
51310 supports the facility, it can send its SMTP banner immediately after
51311 the SYN,ACK segment.  This can save up to one round-trip time.
51312 </para>
51313 <para>
51314 The facility is only active for previously-contacted servers,
51315 as the initiator must present a cookie in the SYN segment.
51316 </para>
51317 <para>
51318 On (at least some) current Linux distributions the facility must be enabled
51319 in the kernel by the sysadmin before the support is usable.
51320 There is no option for control of the server side; if the system supports
51321 it it is always enabled.  Note that lengthy operations in the connect ACL,
51322 such as DNSBL lookups, will still delay the emission of the SMTP banner.
51323 </para>
51324 <para>
51325 <indexterm role="option">
51326 <primary><option>hosts_try_prdr</option></primary>
51327 </indexterm>
51328 </para>
51329 <informaltable frame="all">
51330 <tgroup cols="4" colsep="0" rowsep="0">
51331 <colspec colwidth="8*" align="left"/>
51332 <colspec colwidth="6*" align="center"/>
51333 <colspec colwidth="6*" align="center"/>
51334 <colspec colwidth="6*" align="right"/>
51335 <tbody>
51336 <row>
51337 <entry><option>hosts_try_prdr</option></entry>
51338 <entry>Use: <emphasis>smtp</emphasis></entry>
51339 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51340 <entry>Default: <emphasis>*</emphasis></entry>
51341 </row>
51342 </tbody>
51343 </tgroup>
51344 </informaltable>
51345 <para>
51346 <indexterm role="concept">
51347 <primary>PRDR</primary>
51348 <secondary>enabling, optional in client</secondary>
51349 </indexterm>
51350 <indexterm role="concept">
51351 <primary>ESMTP extensions</primary>
51352 <secondary>PRDR</secondary>
51353 </indexterm>
51354 This option provides a list of servers to which, provided they announce
51355 PRDR support, Exim will attempt to negotiate PRDR
51356 for multi-recipient messages.
51357 The option can usually be left as default.
51358 </para>
51359 <para>
51360 <indexterm role="option">
51361 <primary><option>interface</option></primary>
51362 </indexterm>
51363 </para>
51364 <informaltable frame="all">
51365 <tgroup cols="4" colsep="0" rowsep="0">
51366 <colspec colwidth="8*" align="left"/>
51367 <colspec colwidth="6*" align="center"/>
51368 <colspec colwidth="6*" align="center"/>
51369 <colspec colwidth="6*" align="right"/>
51370 <tbody>
51371 <row>
51372 <entry><option>interface</option></entry>
51373 <entry>Use: <emphasis>smtp</emphasis></entry>
51374 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
51375 <entry>Default: <emphasis>unset</emphasis></entry>
51376 </row>
51377 </tbody>
51378 </tgroup>
51379 </informaltable>
51380 <para>
51381 <indexterm role="concept">
51382 <primary>bind IP address</primary>
51383 </indexterm>
51384 <indexterm role="concept">
51385 <primary>IP address</primary>
51386 <secondary>binding</secondary>
51387 </indexterm>
51388 <indexterm role="variable">
51389 <primary><varname>$host</varname></primary>
51390 </indexterm>
51391 <indexterm role="variable">
51392 <primary><varname>$host_address</varname></primary>
51393 </indexterm>
51394 This option specifies which interface to bind to when making an outgoing SMTP
51395 call. The value is an IP address, not an interface name such as
51396 <literal>eth0</literal>. Do not confuse this with the interface address that was used when a
51397 message was received, which is in <varname>$received_ip_address</varname>, formerly known as
51398 <varname>$interface_address</varname>. The name was changed to minimize confusion with the
51399 outgoing interface address. There is no variable that contains an outgoing
51400 interface address because, unless it is set by this option, its value is
51401 unknown.
51402 </para>
51403 <para>
51404 During the expansion of the <option>interface</option> option the variables <varname>$host</varname> and
51405 <varname>$host_address</varname> refer to the host to which a connection is about to be made
51406 during the expansion of the string. Forced expansion failure, or an empty
51407 string result causes the option to be ignored. Otherwise, after expansion, the
51408 string must be a list of IP addresses, colon-separated by default, but the
51409 separator can be changed in the usual way (<xref linkend="SECTlistsepchange"/>).
51410 For example:
51411 </para>
51412 <literallayout class="monospaced">
51413 interface = &lt;; 192.168.123.123 ; 3ffe:ffff:836f::fe86:a061
51414 </literallayout>
51415 <para>
51416 The first interface of the correct type (IPv4 or IPv6) is used for the outgoing
51417 connection. If none of them are the correct type, the option is ignored. If
51418 <option>interface</option> is not set, or is ignored, the system&#x2019;s IP functions choose which
51419 interface to use if the host has more than one.
51420 </para>
51421 <para>
51422 <indexterm role="option">
51423 <primary><option>keepalive</option></primary>
51424 </indexterm>
51425 </para>
51426 <informaltable frame="all">
51427 <tgroup cols="4" colsep="0" rowsep="0">
51428 <colspec colwidth="8*" align="left"/>
51429 <colspec colwidth="6*" align="center"/>
51430 <colspec colwidth="6*" align="center"/>
51431 <colspec colwidth="6*" align="right"/>
51432 <tbody>
51433 <row>
51434 <entry><option>keepalive</option></entry>
51435 <entry>Use: <emphasis>smtp</emphasis></entry>
51436 <entry>Type: <emphasis>boolean</emphasis></entry>
51437 <entry>Default: <emphasis>true</emphasis></entry>
51438 </row>
51439 </tbody>
51440 </tgroup>
51441 </informaltable>
51442 <para>
51443 <indexterm role="concept">
51444 <primary>keepalive</primary>
51445 <secondary>on outgoing connection</secondary>
51446 </indexterm>
51447 This option controls the setting of SO_KEEPALIVE on outgoing TCP/IP socket
51448 connections. When set, it causes the kernel to probe idle connections
51449 periodically, by sending packets with <quote>old</quote> sequence numbers. The other end
51450 of the connection should send a acknowledgment if the connection is still okay
51451 or a reset if the connection has been aborted. The reason for doing this is
51452 that it has the beneficial effect of freeing up certain types of connection
51453 that can get stuck when the remote host is disconnected without tidying up the
51454 TCP/IP call properly. The keepalive mechanism takes several hours to detect
51455 unreachable hosts.
51456 </para>
51457 <para>
51458 <indexterm role="option">
51459 <primary><option>lmtp_ignore_quota</option></primary>
51460 </indexterm>
51461 </para>
51462 <informaltable frame="all">
51463 <tgroup cols="4" colsep="0" rowsep="0">
51464 <colspec colwidth="8*" align="left"/>
51465 <colspec colwidth="6*" align="center"/>
51466 <colspec colwidth="6*" align="center"/>
51467 <colspec colwidth="6*" align="right"/>
51468 <tbody>
51469 <row>
51470 <entry><option>lmtp_ignore_quota</option></entry>
51471 <entry>Use: <emphasis>smtp</emphasis></entry>
51472 <entry>Type: <emphasis>boolean</emphasis></entry>
51473 <entry>Default: <emphasis>false</emphasis></entry>
51474 </row>
51475 </tbody>
51476 </tgroup>
51477 </informaltable>
51478 <para>
51479 <indexterm role="concept">
51480 <primary>LMTP</primary>
51481 <secondary>ignoring quota errors</secondary>
51482 </indexterm>
51483 If this option is set true when the <option>protocol</option> option is set to <quote>lmtp</quote>, the
51484 string <literal>IGNOREQUOTA</literal> is added to RCPT commands, provided that the LMTP server
51485 has advertised support for IGNOREQUOTA in its response to the LHLO command.
51486 </para>
51487 <para>
51488 <indexterm role="option">
51489 <primary><option>max_rcpt</option></primary>
51490 </indexterm>
51491 </para>
51492 <informaltable frame="all">
51493 <tgroup cols="4" colsep="0" rowsep="0">
51494 <colspec colwidth="8*" align="left"/>
51495 <colspec colwidth="6*" align="center"/>
51496 <colspec colwidth="6*" align="center"/>
51497 <colspec colwidth="6*" align="right"/>
51498 <tbody>
51499 <row>
51500 <entry><option>max_rcpt</option></entry>
51501 <entry>Use: <emphasis>smtp</emphasis></entry>
51502 <entry>Type: <emphasis>integer</emphasis></entry>
51503 <entry>Default: <emphasis>100</emphasis></entry>
51504 </row>
51505 </tbody>
51506 </tgroup>
51507 </informaltable>
51508 <para>
51509 <indexterm role="concept">
51510 <primary>RCPT</primary>
51511 <secondary>maximum number of outgoing</secondary>
51512 </indexterm>
51513 This option limits the number of RCPT commands that are sent in a single
51514 SMTP message transaction. Each set of addresses is treated independently, and
51515 so can cause parallel connections to the same host if <option>remote_max_parallel</option>
51516 permits this. A value setting of zero disables the limit.
51517 </para>
51518 <para>
51519 <indexterm role="option">
51520 <primary><option>message_linelength_limit</option></primary>
51521 </indexterm>
51522 </para>
51523 <informaltable frame="all">
51524 <tgroup cols="4" colsep="0" rowsep="0">
51525 <colspec colwidth="8*" align="left"/>
51526 <colspec colwidth="6*" align="center"/>
51527 <colspec colwidth="6*" align="center"/>
51528 <colspec colwidth="6*" align="right"/>
51529 <tbody>
51530 <row>
51531 <entry><option>message_linelength_limit</option></entry>
51532 <entry>Use: <emphasis>smtp</emphasis></entry>
51533 <entry>Type: <emphasis>integer</emphasis></entry>
51534 <entry>Default: <emphasis>998</emphasis></entry>
51535 </row>
51536 </tbody>
51537 </tgroup>
51538 </informaltable>
51539 <para>
51540 <indexterm role="concept">
51541 <primary>line length</primary>
51542 <secondary>limit</secondary>
51543 </indexterm>
51544 This option sets the maximum line length, in bytes, that the transport
51545 will send.  Any messages with lines exceeding the given value
51546 will fail and a failure-DSN ("bounce") message will if possible be returned
51547 to the sender.
51548 The default value is that defined by the SMTP standards.
51549 </para>
51550 <para>
51551 It is generally wise to also check in the data ACL so that messages
51552 received via SMTP can be refused without producing a bounce.
51553 </para>
51554 <para>
51555 <indexterm role="option">
51556 <primary><option>multi_domain</option></primary>
51557 </indexterm>
51558 </para>
51559 <informaltable frame="all">
51560 <tgroup cols="4" colsep="0" rowsep="0">
51561 <colspec colwidth="8*" align="left"/>
51562 <colspec colwidth="6*" align="center"/>
51563 <colspec colwidth="6*" align="center"/>
51564 <colspec colwidth="6*" align="right"/>
51565 <tbody>
51566 <row>
51567 <entry><option>multi_domain</option></entry>
51568 <entry>Use: <emphasis>smtp</emphasis></entry>
51569 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
51570 <entry>Default: <emphasis>true</emphasis></entry>
51571 </row>
51572 </tbody>
51573 </tgroup>
51574 </informaltable>
51575 <para>
51576 <indexterm role="variable">
51577 <primary><varname>$domain</varname></primary>
51578 </indexterm>
51579 When this option is set, the <command>smtp</command> transport can handle a number of
51580 addresses containing a mixture of different domains provided they all resolve
51581 to the same list of hosts. Turning the option off restricts the transport to
51582 handling only one domain at a time. This is useful if you want to use
51583 <varname>$domain</varname> in an expansion for the transport, because it is set only when there
51584 is a single domain involved in a remote delivery.
51585 </para>
51586 <para>
51587 It is expanded per-address and can depend on any of
51588 <varname>$address_data</varname>, <varname>$domain_data</varname>, <varname>$local_part_data</varname>,
51589 <varname>$host</varname>, <varname>$host_address</varname> and <varname>$host_port</varname>.
51590 </para>
51591 <para>
51592 If the connection is DANE-enabled then this option is ignored;
51593 only messages having the domain used for the DANE TLSA lookup are
51594 sent on the connection.
51595 </para>
51596 <para>
51597 <indexterm role="option">
51598 <primary><option>port</option></primary>
51599 </indexterm>
51600 </para>
51601 <informaltable frame="all">
51602 <tgroup cols="4" colsep="0" rowsep="0">
51603 <colspec colwidth="8*" align="left"/>
51604 <colspec colwidth="6*" align="center"/>
51605 <colspec colwidth="6*" align="center"/>
51606 <colspec colwidth="6*" align="right"/>
51607 <tbody>
51608 <row>
51609 <entry><option>port</option></entry>
51610 <entry>Use: <emphasis>smtp</emphasis></entry>
51611 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51612 <entry>Default: <emphasis>see below</emphasis></entry>
51613 </row>
51614 </tbody>
51615 </tgroup>
51616 </informaltable>
51617 <para>
51618 <indexterm role="concept">
51619 <primary>port</primary>
51620 <secondary>sending TCP/IP</secondary>
51621 </indexterm>
51622 <indexterm role="concept">
51623 <primary>TCP/IP</primary>
51624 <secondary>setting outgoing port</secondary>
51625 </indexterm>
51626 This option specifies the TCP/IP port on the server to which Exim connects.
51627 <emphasis role="bold">Note:</emphasis> Do not confuse this with the port that was used when a message was
51628 received, which is in <varname>$received_port</varname>, formerly known as <varname>$interface_port</varname>.
51629 The name was changed to minimize confusion with the outgoing port. There is no
51630 variable that contains an outgoing port.
51631 </para>
51632 <para>
51633 If the value of this option begins with a digit it is taken as a port number;
51634 otherwise it is looked up using <function>getservbyname()</function>. The default value is
51635 normally <quote>smtp</quote>,
51636 but if <option>protocol</option> is set to <quote>lmtp</quote> the default is <quote>lmtp</quote>
51637 and if <option>protocol</option> is set to <quote>smtps</quote> the default is <quote>smtps</quote>.
51638 If the expansion fails, or if a port number cannot be found, delivery
51639 is deferred.
51640 </para>
51641 <para>
51642 Note that at least one Linux distribution has been seen failing
51643 to put <quote>smtps</quote> in its <quote>/etc/services</quote> file, resulting is such deferrals.
51644 </para>
51645 <para>
51646 <indexterm role="option">
51647 <primary><option>protocol</option></primary>
51648 </indexterm>
51649 </para>
51650 <informaltable frame="all">
51651 <tgroup cols="4" colsep="0" rowsep="0">
51652 <colspec colwidth="8*" align="left"/>
51653 <colspec colwidth="6*" align="center"/>
51654 <colspec colwidth="6*" align="center"/>
51655 <colspec colwidth="6*" align="right"/>
51656 <tbody>
51657 <row>
51658 <entry><option>protocol</option></entry>
51659 <entry>Use: <emphasis>smtp</emphasis></entry>
51660 <entry>Type: <emphasis>string</emphasis></entry>
51661 <entry>Default: <emphasis>smtp</emphasis></entry>
51662 </row>
51663 </tbody>
51664 </tgroup>
51665 </informaltable>
51666 <para>
51667 <indexterm role="concept">
51668 <primary>LMTP</primary>
51669 <secondary>over TCP/IP</secondary>
51670 </indexterm>
51671 <indexterm role="concept">
51672 <primary>ssmtp protocol</primary>
51673 <secondary>outbound</secondary>
51674 </indexterm>
51675 <indexterm role="concept">
51676 <primary>TLS</primary>
51677 <secondary>SSL-on-connect outbound</secondary>
51678 </indexterm>
51679 <indexterm role="variable">
51680 <primary><varname>$port</varname></primary>
51681 </indexterm>
51682 If this option is set to <quote>lmtp</quote> instead of <quote>smtp</quote>, the default value for
51683 the <option>port</option> option changes to <quote>lmtp</quote>, and the transport operates the LMTP
51684 protocol (RFC 2033) instead of SMTP. This protocol is sometimes used for local
51685 deliveries into closed message stores. Exim also has support for running LMTP
51686 over a pipe to a local process &ndash; see chapter <xref linkend="CHAPLMTP"/>.
51687 </para>
51688 <para>
51689 If this option is set to <quote>smtps</quote>, the default value for the <option>port</option> option
51690 changes to <quote>smtps</quote>, and the transport initiates TLS immediately after
51691 connecting, as an outbound SSL-on-connect, instead of using STARTTLS to upgrade.
51692 The Internet standards bodies used to strongly discourage use of this mode,
51693 but as of RFC 8314 it is preferred over STARTTLS for message submission
51694 (as distinct from MTA-MTA communication).
51695 </para>
51696 <para>
51697 <indexterm role="option">
51698 <primary><option>retry_include_ip_address</option></primary>
51699 </indexterm>
51700 </para>
51701 <informaltable frame="all">
51702 <tgroup cols="4" colsep="0" rowsep="0">
51703 <colspec colwidth="8*" align="left"/>
51704 <colspec colwidth="6*" align="center"/>
51705 <colspec colwidth="6*" align="center"/>
51706 <colspec colwidth="6*" align="right"/>
51707 <tbody>
51708 <row>
51709 <entry><option>retry_include_ip_address</option></entry>
51710 <entry>Use: <emphasis>smtp</emphasis></entry>
51711 <entry>Type: <emphasis>boolean</emphasis>&dagger;<emphasis></emphasis></entry>
51712 <entry>Default: <emphasis>true</emphasis></entry>
51713 </row>
51714 </tbody>
51715 </tgroup>
51716 </informaltable>
51717 <para>
51718 Exim normally includes both the host name and the IP address in the key it
51719 constructs for indexing retry data after a temporary delivery failure. This
51720 means that when one of several IP addresses for a host is failing, it gets
51721 tried periodically (controlled by the retry rules), but use of the other IP
51722 addresses is not affected.
51723 </para>
51724 <para>
51725 However, in some dialup environments hosts are assigned a different IP address
51726 each time they connect. In this situation the use of the IP address as part of
51727 the retry key leads to undesirable behaviour. Setting this option false causes
51728 Exim to use only the host name.
51729 Since it is expanded it can be made to depend on the host or domain.
51730 </para>
51731 <para>
51732 <indexterm role="option">
51733 <primary><option>serialize_hosts</option></primary>
51734 </indexterm>
51735 </para>
51736 <informaltable frame="all">
51737 <tgroup cols="4" colsep="0" rowsep="0">
51738 <colspec colwidth="8*" align="left"/>
51739 <colspec colwidth="6*" align="center"/>
51740 <colspec colwidth="6*" align="center"/>
51741 <colspec colwidth="6*" align="right"/>
51742 <tbody>
51743 <row>
51744 <entry><option>serialize_hosts</option></entry>
51745 <entry>Use: <emphasis>smtp</emphasis></entry>
51746 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
51747 <entry>Default: <emphasis>unset</emphasis></entry>
51748 </row>
51749 </tbody>
51750 </tgroup>
51751 </informaltable>
51752 <para>
51753 <indexterm role="concept">
51754 <primary>serializing connections</primary>
51755 </indexterm>
51756 <indexterm role="concept">
51757 <primary>host</primary>
51758 <secondary>serializing connections</secondary>
51759 </indexterm>
51760 Because Exim operates in a distributed manner, if several messages for the same
51761 host arrive at around the same time, more than one simultaneous connection to
51762 the remote host can occur. This is not usually a problem except when there is a
51763 slow link between the hosts. In that situation it may be helpful to restrict
51764 Exim to one connection at a time. This can be done by setting
51765 <option>serialize_hosts</option> to match the relevant hosts.
51766 </para>
51767 <para>
51768 <indexterm role="concept">
51769 <primary>hints database</primary>
51770 <secondary>serializing deliveries to a host</secondary>
51771 </indexterm>
51772 Exim implements serialization by means of a hints database in which a record is
51773 written whenever a process connects to one of the restricted hosts. The record
51774 is deleted when the connection is completed. Obviously there is scope for
51775 records to get left lying around if there is a system or program crash. To
51776 guard against this, Exim ignores any records that are more than six hours old.
51777 </para>
51778 <para>
51779 If you set up this kind of serialization, you should also arrange to delete the
51780 relevant hints database whenever your system reboots. The names of the files
51781 start with <filename>misc</filename> and they are kept in the <filename>spool/db</filename> directory. There
51782 may be one or two files, depending on the type of DBM in use. The same files
51783 are used for ETRN serialization.
51784 </para>
51785 <para>
51786 See also the <option>max_parallel</option> generic transport option.
51787 </para>
51788 <para>
51789 <indexterm role="option">
51790 <primary><option>size_addition</option></primary>
51791 </indexterm>
51792 </para>
51793 <informaltable frame="all">
51794 <tgroup cols="4" colsep="0" rowsep="0">
51795 <colspec colwidth="8*" align="left"/>
51796 <colspec colwidth="6*" align="center"/>
51797 <colspec colwidth="6*" align="center"/>
51798 <colspec colwidth="6*" align="right"/>
51799 <tbody>
51800 <row>
51801 <entry><option>size_addition</option></entry>
51802 <entry>Use: <emphasis>smtp</emphasis></entry>
51803 <entry>Type: <emphasis>integer</emphasis></entry>
51804 <entry>Default: <emphasis>1024</emphasis></entry>
51805 </row>
51806 </tbody>
51807 </tgroup>
51808 </informaltable>
51809 <para>
51810 <indexterm role="concept">
51811 <primary>SIZE</primary>
51812 <secondary>ESMTP extension</secondary>
51813 </indexterm>
51814 <indexterm role="concept">
51815 <primary>message</primary>
51816 <secondary>size issue for transport filter</secondary>
51817 </indexterm>
51818 <indexterm role="concept">
51819 <primary>size</primary>
51820 <secondary>of message</secondary>
51821 </indexterm>
51822 <indexterm role="concept">
51823 <primary>transport</primary>
51824 <secondary>filter</secondary>
51825 </indexterm>
51826 <indexterm role="concept">
51827 <primary>filter</primary>
51828 <secondary>transport filter</secondary>
51829 </indexterm>
51830 If a remote SMTP server indicates that it supports the SIZE option of the
51831 MAIL command, Exim uses this to pass over the message size at the start of
51832 an SMTP transaction. It adds the value of <option>size_addition</option> to the value it
51833 sends, to allow for headers and other text that may be added during delivery by
51834 configuration options or in a transport filter. It may be necessary to increase
51835 this if a lot of text is added to messages.
51836 </para>
51837 <para>
51838 Alternatively, if the value of <option>size_addition</option> is set negative, it disables
51839 the use of the SIZE option altogether.
51840 </para>
51841 <para>
51842 <indexterm role="option">
51843 <primary><option>socks_proxy</option></primary>
51844 </indexterm>
51845 </para>
51846 <informaltable frame="all">
51847 <tgroup cols="4" colsep="0" rowsep="0">
51848 <colspec colwidth="8*" align="left"/>
51849 <colspec colwidth="6*" align="center"/>
51850 <colspec colwidth="6*" align="center"/>
51851 <colspec colwidth="6*" align="right"/>
51852 <tbody>
51853 <row>
51854 <entry><option>socks_proxy</option></entry>
51855 <entry>Use: <emphasis>smtp</emphasis></entry>
51856 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51857 <entry>Default: <emphasis>unset</emphasis></entry>
51858 </row>
51859 </tbody>
51860 </tgroup>
51861 </informaltable>
51862 <para>
51863 <indexterm role="concept">
51864 <primary>proxy</primary>
51865 <secondary>SOCKS</secondary>
51866 </indexterm>
51867 This option enables use of SOCKS proxies for connections made by the
51868 transport.  For details see section <xref linkend="SECTproxySOCKS"/>.
51869 </para>
51870 <para>
51871 <indexterm role="option">
51872 <primary><option>tls_alpn</option></primary>
51873 </indexterm>
51874 </para>
51875 <informaltable frame="all">
51876 <tgroup cols="4" colsep="0" rowsep="0">
51877 <colspec colwidth="8*" align="left"/>
51878 <colspec colwidth="6*" align="center"/>
51879 <colspec colwidth="6*" align="center"/>
51880 <colspec colwidth="6*" align="right"/>
51881 <tbody>
51882 <row>
51883 <entry><option>tls_alpn</option></entry>
51884 <entry>Use: <emphasis>smtp</emphasis></entry>
51885 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51886 <entry>Default: <emphasis>unset</emphasis></entry>
51887 </row>
51888 </tbody>
51889 </tgroup>
51890 </informaltable>
51891 <para>
51892 <indexterm role="concept">
51893 <primary>TLS</primary>
51894 <secondary>Application Layer Protocol Names</secondary>
51895 </indexterm>
51896 <indexterm role="concept">
51897 <primary>TLS</primary>
51898 <secondary>ALPN</secondary>
51899 </indexterm>
51900 <indexterm role="concept">
51901 <primary>ALPN</primary>
51902 <secondary>set name in client</secondary>
51903 </indexterm>
51904 If this option is set
51905 and the TLS library supports ALPN,
51906 the value given is used.
51907 </para>
51908 <para>
51909 As of writing no value has been standardised for email use.
51910 The authors suggest using <quote>smtp</quote>.
51911 </para>
51912 <para>
51913 <indexterm role="option">
51914 <primary><option>tls_certificate</option></primary>
51915 </indexterm>
51916 </para>
51917 <informaltable frame="all">
51918 <tgroup cols="4" colsep="0" rowsep="0">
51919 <colspec colwidth="8*" align="left"/>
51920 <colspec colwidth="6*" align="center"/>
51921 <colspec colwidth="6*" align="center"/>
51922 <colspec colwidth="6*" align="right"/>
51923 <tbody>
51924 <row>
51925 <entry><option>tls_certificate</option></entry>
51926 <entry>Use: <emphasis>smtp</emphasis></entry>
51927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51928 <entry>Default: <emphasis>unset</emphasis></entry>
51929 </row>
51930 </tbody>
51931 </tgroup>
51932 </informaltable>
51933 <para>
51934 <indexterm role="concept">
51935 <primary>TLS</primary>
51936 <secondary>client certificate, location of</secondary>
51937 </indexterm>
51938 <indexterm role="concept">
51939 <primary>certificate</primary>
51940 <secondary>client, location of</secondary>
51941 </indexterm>
51942 <indexterm role="variable">
51943 <primary><varname>$host</varname></primary>
51944 </indexterm>
51945 <indexterm role="variable">
51946 <primary><varname>$host_address</varname></primary>
51947 </indexterm>
51948 The value of this option must be the absolute path to a file which contains the
51949 client&#x2019;s certificate, for possible use when sending a message over an encrypted
51950 connection. The values of <varname>$host</varname> and <varname>$host_address</varname> are set to the name and
51951 address of the server during the expansion. See chapter <xref linkend="CHAPTLS"/> for
51952 details of TLS.
51953 </para>
51954 <para>
51955 <emphasis role="bold">Note</emphasis>: This option must be set if you want Exim to be able to use a TLS
51956 certificate when sending messages as a client. The global option of the same
51957 name specifies the certificate for Exim as a server; it is not automatically
51958 assumed that the same certificate should be used when Exim is operating as a
51959 client.
51960 </para>
51961 <para>
51962 <indexterm role="option">
51963 <primary><option>tls_crl</option></primary>
51964 </indexterm>
51965 </para>
51966 <informaltable frame="all">
51967 <tgroup cols="4" colsep="0" rowsep="0">
51968 <colspec colwidth="8*" align="left"/>
51969 <colspec colwidth="6*" align="center"/>
51970 <colspec colwidth="6*" align="center"/>
51971 <colspec colwidth="6*" align="right"/>
51972 <tbody>
51973 <row>
51974 <entry><option>tls_crl</option></entry>
51975 <entry>Use: <emphasis>smtp</emphasis></entry>
51976 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
51977 <entry>Default: <emphasis>unset</emphasis></entry>
51978 </row>
51979 </tbody>
51980 </tgroup>
51981 </informaltable>
51982 <para>
51983 <indexterm role="concept">
51984 <primary>TLS</primary>
51985 <secondary>client certificate revocation list</secondary>
51986 </indexterm>
51987 <indexterm role="concept">
51988 <primary>certificate</primary>
51989 <secondary>revocation list for client</secondary>
51990 </indexterm>
51991 This option specifies a certificate revocation list. The expanded value must
51992 be the name of a file that contains a CRL in PEM format.
51993 </para>
51994 <para>
51995 <indexterm role="option">
51996 <primary><option>tls_dh_min_bits</option></primary>
51997 </indexterm>
51998 </para>
51999 <informaltable frame="all">
52000 <tgroup cols="4" colsep="0" rowsep="0">
52001 <colspec colwidth="8*" align="left"/>
52002 <colspec colwidth="6*" align="center"/>
52003 <colspec colwidth="6*" align="center"/>
52004 <colspec colwidth="6*" align="right"/>
52005 <tbody>
52006 <row>
52007 <entry><option>tls_dh_min_bits</option></entry>
52008 <entry>Use: <emphasis>smtp</emphasis></entry>
52009 <entry>Type: <emphasis>integer</emphasis></entry>
52010 <entry>Default: <emphasis>1024</emphasis></entry>
52011 </row>
52012 </tbody>
52013 </tgroup>
52014 </informaltable>
52015 <para>
52016 <indexterm role="concept">
52017 <primary>TLS</primary>
52018 <secondary>Diffie-Hellman minimum acceptable size</secondary>
52019 </indexterm>
52020 When establishing a TLS session, if a ciphersuite which uses Diffie-Hellman
52021 key agreement is negotiated, the server will provide a large prime number
52022 for use.  This option establishes the minimum acceptable size of that number.
52023 If the parameter offered by the server is too small, then the TLS handshake
52024 will fail.
52025 </para>
52026 <para>
52027 Only supported when using GnuTLS.
52028 </para>
52029 <para>
52030 <indexterm role="option">
52031 <primary><option>tls_privatekey</option></primary>
52032 </indexterm>
52033 </para>
52034 <informaltable frame="all">
52035 <tgroup cols="4" colsep="0" rowsep="0">
52036 <colspec colwidth="8*" align="left"/>
52037 <colspec colwidth="6*" align="center"/>
52038 <colspec colwidth="6*" align="center"/>
52039 <colspec colwidth="6*" align="right"/>
52040 <tbody>
52041 <row>
52042 <entry><option>tls_privatekey</option></entry>
52043 <entry>Use: <emphasis>smtp</emphasis></entry>
52044 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52045 <entry>Default: <emphasis>unset</emphasis></entry>
52046 </row>
52047 </tbody>
52048 </tgroup>
52049 </informaltable>
52050 <para>
52051 <indexterm role="concept">
52052 <primary>TLS</primary>
52053 <secondary>client private key, location of</secondary>
52054 </indexterm>
52055 <indexterm role="variable">
52056 <primary><varname>$host</varname></primary>
52057 </indexterm>
52058 <indexterm role="variable">
52059 <primary><varname>$host_address</varname></primary>
52060 </indexterm>
52061 The value of this option must be the absolute path to a file which contains the
52062 client&#x2019;s private key. This is used when sending a message over an encrypted
52063 connection using a client certificate. The values of <varname>$host</varname> and
52064 <varname>$host_address</varname> are set to the name and address of the server during the
52065 expansion. If this option is unset, or the expansion is forced to fail, or the
52066 result is an empty string, the private key is assumed to be in the same file as
52067 the certificate. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
52068 </para>
52069 <para>
52070 <indexterm role="option">
52071 <primary><option>tls_require_ciphers</option></primary>
52072 </indexterm>
52073 </para>
52074 <informaltable frame="all">
52075 <tgroup cols="4" colsep="0" rowsep="0">
52076 <colspec colwidth="8*" align="left"/>
52077 <colspec colwidth="6*" align="center"/>
52078 <colspec colwidth="6*" align="center"/>
52079 <colspec colwidth="6*" align="right"/>
52080 <tbody>
52081 <row>
52082 <entry><option>tls_require_ciphers</option></entry>
52083 <entry>Use: <emphasis>smtp</emphasis></entry>
52084 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52085 <entry>Default: <emphasis>unset</emphasis></entry>
52086 </row>
52087 </tbody>
52088 </tgroup>
52089 </informaltable>
52090 <para>
52091 <indexterm role="concept">
52092 <primary>TLS</primary>
52093 <secondary>requiring specific ciphers</secondary>
52094 </indexterm>
52095 <indexterm role="concept">
52096 <primary>cipher</primary>
52097 <secondary>requiring specific</secondary>
52098 </indexterm>
52099 <indexterm role="variable">
52100 <primary><varname>$host</varname></primary>
52101 </indexterm>
52102 <indexterm role="variable">
52103 <primary><varname>$host_address</varname></primary>
52104 </indexterm>
52105 The value of this option must be a list of permitted cipher suites, for use
52106 when setting up an outgoing encrypted connection. (There is a global option of
52107 the same name for controlling incoming connections.) The values of <varname>$host</varname> and
52108 <varname>$host_address</varname> are set to the name and address of the server during the
52109 expansion. See chapter <xref linkend="CHAPTLS"/> for details of TLS; note that this option
52110 is used in different ways by OpenSSL and GnuTLS (see sections
52111 <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>). For GnuTLS, the order of the
52112 ciphers is a preference order.
52113 </para>
52114 <para>
52115 <indexterm role="option">
52116 <primary><option>tls_resumption_hosts</option></primary>
52117 </indexterm>
52118 </para>
52119 <informaltable frame="all">
52120 <tgroup cols="4" colsep="0" rowsep="0">
52121 <colspec colwidth="8*" align="left"/>
52122 <colspec colwidth="6*" align="center"/>
52123 <colspec colwidth="6*" align="center"/>
52124 <colspec colwidth="6*" align="right"/>
52125 <tbody>
52126 <row>
52127 <entry><option>tls_resumption_hosts</option></entry>
52128 <entry>Use: <emphasis>smtp</emphasis></entry>
52129 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
52130 <entry>Default: <emphasis>unset</emphasis></entry>
52131 </row>
52132 </tbody>
52133 </tgroup>
52134 </informaltable>
52135 <para>
52136 <indexterm role="concept">
52137 <primary>TLS</primary>
52138 <secondary>resumption</secondary>
52139 </indexterm>
52140 This option controls which connections to use the TLS resumption feature.
52141 See <xref linkend="SECTresumption"/> for details.
52142 </para>
52143 <para>
52144 <indexterm role="option">
52145 <primary><option>tls_sni</option></primary>
52146 </indexterm>
52147 </para>
52148 <informaltable frame="all">
52149 <tgroup cols="4" colsep="0" rowsep="0">
52150 <colspec colwidth="8*" align="left"/>
52151 <colspec colwidth="6*" align="center"/>
52152 <colspec colwidth="6*" align="center"/>
52153 <colspec colwidth="6*" align="right"/>
52154 <tbody>
52155 <row>
52156 <entry><option>tls_sni</option></entry>
52157 <entry>Use: <emphasis>smtp</emphasis></entry>
52158 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52159 <entry>Default: <emphasis>unset</emphasis></entry>
52160 </row>
52161 </tbody>
52162 </tgroup>
52163 </informaltable>
52164 <para>
52165 <indexterm role="concept">
52166 <primary>TLS</primary>
52167 <secondary>Server Name Indication</secondary>
52168 </indexterm>
52169 <indexterm role="concept">
52170 <primary>TLS</primary>
52171 <secondary>SNI</secondary>
52172 </indexterm>
52173 <indexterm role="concept">
52174 <primary>SNI</primary>
52175 <secondary>setting in client</secondary>
52176 </indexterm>
52177 <indexterm role="variable">
52178 <primary><varname>$tls_sni</varname></primary>
52179 </indexterm>
52180 If this option is set
52181 and the connection is not DANE-validated
52182 then it sets the $tls_out_sni variable and causes any
52183 TLS session to pass this value as the Server Name Indication extension to
52184 the remote side, which can be used by the remote side to select an appropriate
52185 certificate and private key for the session.
52186 </para>
52187 <para>
52188 See <xref linkend="SECTtlssni"/> for more information.
52189 </para>
52190 <para>
52191 Note that for OpenSSL, this feature requires a build of OpenSSL that supports
52192 TLS extensions.
52193 </para>
52194 <para>
52195 <indexterm role="option">
52196 <primary><option>tls_tempfail_tryclear</option></primary>
52197 </indexterm>
52198 </para>
52199 <informaltable frame="all">
52200 <tgroup cols="4" colsep="0" rowsep="0">
52201 <colspec colwidth="8*" align="left"/>
52202 <colspec colwidth="6*" align="center"/>
52203 <colspec colwidth="6*" align="center"/>
52204 <colspec colwidth="6*" align="right"/>
52205 <tbody>
52206 <row>
52207 <entry><option>tls_tempfail_tryclear</option></entry>
52208 <entry>Use: <emphasis>smtp</emphasis></entry>
52209 <entry>Type: <emphasis>boolean</emphasis></entry>
52210 <entry>Default: <emphasis>true</emphasis></entry>
52211 </row>
52212 </tbody>
52213 </tgroup>
52214 </informaltable>
52215 <para>
52216 <indexterm role="concept">
52217 <primary>4<emphasis>xx</emphasis> responses</primary>
52218 <secondary>to STARTTLS</secondary>
52219 </indexterm>
52220 When the server host is not in <option>hosts_require_tls</option>, and there is a problem in
52221 setting up a TLS session, this option determines whether or not Exim should try
52222 to deliver the message unencrypted. If it is set false, delivery to the
52223 current host is deferred; if there are other hosts, they are tried. If this
52224 option is set true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis>
52225 response to STARTTLS. Also, if STARTTLS is accepted, but the subsequent
52226 TLS negotiation fails, Exim closes the current connection (because it is in an
52227 unknown state), opens a new one to the same host, and then tries the delivery
52228 in clear.
52229 </para>
52230 <para>
52231 <indexterm role="option">
52232 <primary><option>tls_try_verify_hosts</option></primary>
52233 </indexterm>
52234 </para>
52235 <informaltable frame="all">
52236 <tgroup cols="4" colsep="0" rowsep="0">
52237 <colspec colwidth="8*" align="left"/>
52238 <colspec colwidth="6*" align="center"/>
52239 <colspec colwidth="6*" align="center"/>
52240 <colspec colwidth="6*" align="right"/>
52241 <tbody>
52242 <row>
52243 <entry><option>tls_try_verify_hosts</option></entry>
52244 <entry>Use: <emphasis>smtp</emphasis></entry>
52245 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
52246 <entry>Default: <emphasis>*</emphasis></entry>
52247 </row>
52248 </tbody>
52249 </tgroup>
52250 </informaltable>
52251 <para>
52252 <indexterm role="concept">
52253 <primary>TLS</primary>
52254 <secondary>server certificate verification</secondary>
52255 </indexterm>
52256 <indexterm role="concept">
52257 <primary>certificate</primary>
52258 <secondary>verification of server</secondary>
52259 </indexterm>
52260 This option gives a list of hosts for which, on encrypted connections,
52261 certificate verification will be tried but need not succeed.
52262 The <option>tls_verify_certificates</option> option must also be set.
52263 Note that unless the host is in this list
52264 TLS connections will be denied to hosts using self-signed certificates
52265 when <option>tls_verify_certificates</option> is matched.
52266 The <varname>$tls_out_certificate_verified</varname> variable is set when
52267 certificate verification succeeds.
52268 </para>
52269 <para>
52270 <indexterm role="option">
52271 <primary><option>tls_verify_cert_hostnames</option></primary>
52272 </indexterm>
52273 </para>
52274 <informaltable frame="all">
52275 <tgroup cols="4" colsep="0" rowsep="0">
52276 <colspec colwidth="8*" align="left"/>
52277 <colspec colwidth="6*" align="center"/>
52278 <colspec colwidth="6*" align="center"/>
52279 <colspec colwidth="6*" align="right"/>
52280 <tbody>
52281 <row>
52282 <entry><option>tls_verify_cert_hostnames</option></entry>
52283 <entry>Use: <emphasis>smtp</emphasis></entry>
52284 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
52285 <entry>Default: <emphasis>*</emphasis></entry>
52286 </row>
52287 </tbody>
52288 </tgroup>
52289 </informaltable>
52290 <para>
52291 <indexterm role="concept">
52292 <primary>TLS</primary>
52293 <secondary>server certificate hostname verification</secondary>
52294 </indexterm>
52295 <indexterm role="concept">
52296 <primary>certificate</primary>
52297 <secondary>verification of server</secondary>
52298 </indexterm>
52299 This option give a list of hosts for which,
52300 while verifying the server certificate,
52301 checks will be included on the host name
52302 (note that this will generally be the result of a DNS MX lookup)
52303 versus Subject and Subject-Alternate-Name fields.  Wildcard names are permitted
52304 limited to being the initial component of a 3-or-more component FQDN.
52305 </para>
52306 <para>
52307 There is no equivalent checking on client certificates.
52308 </para>
52309 <para>
52310 <indexterm role="option">
52311 <primary><option>tls_verify_certificates</option></primary>
52312 </indexterm>
52313 </para>
52314 <informaltable frame="all">
52315 <tgroup cols="4" colsep="0" rowsep="0">
52316 <colspec colwidth="8*" align="left"/>
52317 <colspec colwidth="6*" align="center"/>
52318 <colspec colwidth="6*" align="center"/>
52319 <colspec colwidth="6*" align="right"/>
52320 <tbody>
52321 <row>
52322 <entry><option>tls_verify_certificates</option></entry>
52323 <entry>Use: <emphasis>smtp</emphasis></entry>
52324 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
52325 <entry>Default: <emphasis>system</emphasis></entry>
52326 </row>
52327 </tbody>
52328 </tgroup>
52329 </informaltable>
52330 <para>
52331 <indexterm role="concept">
52332 <primary>TLS</primary>
52333 <secondary>server certificate verification</secondary>
52334 </indexterm>
52335 <indexterm role="concept">
52336 <primary>certificate</primary>
52337 <secondary>verification of server</secondary>
52338 </indexterm>
52339 <indexterm role="variable">
52340 <primary><varname>$host</varname></primary>
52341 </indexterm>
52342 <indexterm role="variable">
52343 <primary><varname>$host_address</varname></primary>
52344 </indexterm>
52345 The value of this option must be either the
52346 word "system"
52347 or the absolute path to
52348 a file or directory containing permitted certificates for servers,
52349 for use when setting up an encrypted connection.
52350 </para>
52351 <para>
52352 The "system" value for the option will use a location compiled into the SSL library.
52353 This is not available for GnuTLS versions preceding 3.0.20; a value of "system"
52354 is taken as empty and an explicit location
52355 must be specified.
52356 </para>
52357 <para>
52358 The use of a directory for the option value is not available for GnuTLS versions
52359 preceding 3.3.6 and a single file must be used.
52360 </para>
52361 <para>
52362 With OpenSSL the certificates specified
52363 explicitly
52364 either by file or directory
52365 are added to those given by the system default location.
52366 </para>
52367 <para>
52368 The values of <varname>$host</varname> and
52369 <varname>$host_address</varname> are set to the name and address of the server during the
52370 expansion of this option. See chapter <xref linkend="CHAPTLS"/> for details of TLS.
52371 </para>
52372 <para>
52373 For back-compatibility,
52374 if neither tls_verify_hosts nor tls_try_verify_hosts are set
52375 (a single-colon empty list counts as being set)
52376 and certificate verification fails the TLS connection is closed.
52377 </para>
52378 <para>
52379 <indexterm role="option">
52380 <primary><option>tls_verify_hosts</option></primary>
52381 </indexterm>
52382 </para>
52383 <informaltable frame="all">
52384 <tgroup cols="4" colsep="0" rowsep="0">
52385 <colspec colwidth="8*" align="left"/>
52386 <colspec colwidth="6*" align="center"/>
52387 <colspec colwidth="6*" align="center"/>
52388 <colspec colwidth="6*" align="right"/>
52389 <tbody>
52390 <row>
52391 <entry><option>tls_verify_hosts</option></entry>
52392 <entry>Use: <emphasis>smtp</emphasis></entry>
52393 <entry>Type: <emphasis>host list</emphasis>&dagger;<emphasis></emphasis></entry>
52394 <entry>Default: <emphasis>unset</emphasis></entry>
52395 </row>
52396 </tbody>
52397 </tgroup>
52398 </informaltable>
52399 <para>
52400 <indexterm role="concept">
52401 <primary>TLS</primary>
52402 <secondary>server certificate verification</secondary>
52403 </indexterm>
52404 <indexterm role="concept">
52405 <primary>certificate</primary>
52406 <secondary>verification of server</secondary>
52407 </indexterm>
52408 This option gives a list of hosts for which, on encrypted connections,
52409 certificate verification must succeed.
52410 The <option>tls_verify_certificates</option> option must also be set.
52411 If both this option and <option>tls_try_verify_hosts</option> are unset
52412 operation is as if this option selected all hosts.
52413 <emphasis role="bold">Warning</emphasis>: Including a host in <option>tls_verify_hosts</option> does not require
52414 that connections use TLS.
52415 Fallback to in-clear communication will be done unless restricted by 
52416 the <option>hosts_require_tls</option> option.
52417 </para>
52418 <para>
52419 <indexterm role="option">
52420 <primary><option>utf8_downconvert</option></primary>
52421 </indexterm>
52422 </para>
52423 <informaltable frame="all">
52424 <tgroup cols="4" colsep="0" rowsep="0">
52425 <colspec colwidth="8*" align="left"/>
52426 <colspec colwidth="6*" align="center"/>
52427 <colspec colwidth="6*" align="center"/>
52428 <colspec colwidth="6*" align="right"/>
52429 <tbody>
52430 <row>
52431 <entry><option>utf8_downconvert</option></entry>
52432 <entry>Use: <emphasis>smtp</emphasis></entry>
52433 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
52434 <entry>Default: <emphasis>-1</emphasis></entry>
52435 </row>
52436 </tbody>
52437 </tgroup>
52438 </informaltable>
52439 <para>
52440 <indexterm role="concept">
52441 <primary>utf8</primary>
52442 <secondary>address downconversion</secondary>
52443 </indexterm>
52444 <indexterm role="concept">
52445 <primary>i18n</primary>
52446 <secondary>utf8 address downconversion</secondary>
52447 </indexterm>
52448 If built with internationalization support,
52449 this option controls conversion of UTF-8 in message envelope addresses
52450 to a-label form.
52451 If, after expansion, the value is 1, 0, or -1 then this value overrides
52452 any value previously set for the message.  Otherwise, any previously
52453 set value is used.  To permit use of a previous value,
52454 set this option to an empty string.
52455 For details on the values see section <xref linkend="SECTi18nMTA"/>.
52456 </para>
52457 </section>
52458 <section id="SECTvalhosmax">
52459 <title>How the limits for the number of hosts to try are used</title>
52460 <para>
52461 <indexterm role="concept">
52462 <primary>host</primary>
52463 <secondary>maximum number to try</secondary>
52464 </indexterm>
52465 <indexterm role="concept">
52466 <primary>limit</primary>
52467 <secondary>hosts; maximum number tried</secondary>
52468 </indexterm>
52469 There are two options that are concerned with the number of hosts that are
52470 tried when an SMTP delivery takes place. They are <option>hosts_max_try</option> and
52471 <option>hosts_max_try_hardlimit</option>.
52472 </para>
52473 <para>
52474 The <option>hosts_max_try</option> option limits the number of hosts that are tried
52475 for a single delivery. However, despite the term <quote>host</quote> in its name, the
52476 option actually applies to each IP address independently. In other words, a
52477 multihomed host is treated as several independent hosts, just as it is for
52478 retrying.
52479 </para>
52480 <para>
52481 Many of the larger ISPs have multiple MX records which often point to
52482 multihomed hosts. As a result, a list of a dozen or more IP addresses may be
52483 created as a result of routing one of these domains.
52484 </para>
52485 <para>
52486 Trying every single IP address on such a long list does not seem sensible; if
52487 several at the top of the list fail, it is reasonable to assume there is some
52488 problem that is likely to affect all of them. Roughly speaking, the value of
52489 <option>hosts_max_try</option> is the maximum number that are tried before deferring the
52490 delivery. However, the logic cannot be quite that simple.
52491 </para>
52492 <para>
52493 Firstly, IP addresses that are skipped because their retry times have not
52494 arrived do not count, and in addition, addresses that are past their retry
52495 limits are also not counted, even when they are tried. This means that when
52496 some IP addresses are past their retry limits, more than the value of
52497 <option>hosts_max_retry</option> may be tried. The reason for this behaviour is to ensure
52498 that all IP addresses are considered before timing out an email address (but
52499 see below for an exception).
52500 </para>
52501 <para>
52502 Secondly, when the <option>hosts_max_try</option> limit is reached, Exim looks down the host
52503 list to see if there is a subsequent host with a different (higher valued) MX.
52504 If there is, that host is considered next, and the current IP address is used
52505 but not counted. This behaviour helps in the case of a domain with a retry rule
52506 that hardly ever delays any hosts, as is now explained:
52507 </para>
52508 <para>
52509 Consider the case of a long list of hosts with one MX value, and a few with a
52510 higher MX value. If <option>hosts_max_try</option> is small (the default is 5) only a few
52511 hosts at the top of the list are tried at first. With the default retry rule,
52512 which specifies increasing retry times, the higher MX hosts are eventually
52513 tried when those at the top of the list are skipped because they have not
52514 reached their retry times.
52515 </para>
52516 <para>
52517 However, it is common practice to put a fixed short retry time on domains for
52518 large ISPs, on the grounds that their servers are rarely down for very long.
52519 Unfortunately, these are exactly the domains that tend to resolve to long lists
52520 of hosts. The short retry time means that the lowest MX hosts are tried every
52521 time. The attempts may be in a different order because of random sorting, but
52522 without the special MX check, the higher MX hosts would never be tried until
52523 all the lower MX hosts had timed out (which might be several days), because
52524 there are always some lower MX hosts that have reached their retry times. With
52525 the special check, Exim considers at least one IP address from each MX value at
52526 every delivery attempt, even if the <option>hosts_max_try</option> limit has already been
52527 reached.
52528 </para>
52529 <para>
52530 The above logic means that <option>hosts_max_try</option> is not a hard limit, and in
52531 particular, Exim normally eventually tries all the IP addresses before timing
52532 out an email address. When <option>hosts_max_try</option> was implemented, this seemed a
52533 reasonable thing to do. Recently, however, some lunatic DNS configurations have
52534 been set up with hundreds of IP addresses for some domains. It can
52535 take a very long time indeed for an address to time out in these cases.
52536 </para>
52537 <para>
52538 The <option>hosts_max_try_hardlimit</option> option was added to help with this problem.
52539 Exim never tries more than this number of IP addresses; if it hits this limit
52540 and they are all timed out, the email address is bounced, even though not all
52541 possible IP addresses have been tried.
52542 <indexterm role="concept" startref="IIDsmttra1" class="endofrange"/>
52543 <indexterm role="concept" startref="IIDsmttra2" class="endofrange"/>
52544 </para>
52545 </section>
52546 </chapter>
52547
52548 <chapter id="CHAPrewrite">
52549 <title>Address rewriting</title>
52550 <para>
52551 <indexterm role="concept" id="IIDaddrew" class="startofrange">
52552 <primary>rewriting</primary>
52553 <secondary>addresses</secondary>
52554 </indexterm>
52555 There are some circumstances in which Exim automatically rewrites domains in
52556 addresses. The two most common are when an address is given without a domain
52557 (referred to as an <quote>unqualified address</quote>) or when an address contains an
52558 abbreviated domain that is expanded by DNS lookup.
52559 </para>
52560 <para>
52561 Unqualified envelope addresses are accepted only for locally submitted
52562 messages, or for messages that are received from hosts matching
52563 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
52564 appropriate. Unqualified addresses in header lines are qualified if they are in
52565 locally submitted messages, or messages from hosts that are permitted to send
52566 unqualified envelope addresses. Otherwise, unqualified addresses in header
52567 lines are neither qualified nor rewritten.
52568 </para>
52569 <para>
52570 One situation in which Exim does <emphasis>not</emphasis> automatically rewrite a domain is
52571 when it is the name of a CNAME record in the DNS. The older RFCs suggest that
52572 such a domain should be rewritten using the <quote>canonical</quote> name, and some MTAs
52573 do this. The new RFCs do not contain this suggestion.
52574 </para>
52575 <section id="SECID147">
52576 <title>Explicitly configured address rewriting</title>
52577 <para>
52578 This chapter describes the rewriting rules that can be used in the
52579 main rewrite section of the configuration file, and also in the generic
52580 <option>headers_rewrite</option> option that can be set on any transport.
52581 </para>
52582 <para>
52583 Some people believe that configured address rewriting is a Mortal Sin.
52584 Others believe that life is not possible without it. Exim provides the
52585 facility; you do not have to use it.
52586 </para>
52587 <para>
52588 The main rewriting rules that appear in the <quote>rewrite</quote> section of the
52589 configuration file are applied to addresses in incoming messages, both envelope
52590 addresses and addresses in header lines. Each rule specifies the types of
52591 address to which it applies.
52592 </para>
52593 <para>
52594 Whether or not addresses in header lines are rewritten depends on the origin of
52595 the headers and the type of rewriting. Global rewriting, that is, rewriting
52596 rules from the rewrite section of the configuration file, is applied only to
52597 those headers that were received with the message. Header lines that are added
52598 by ACLs or by a system filter or by individual routers or transports (which
52599 are specific to individual recipient addresses) are not rewritten by the global
52600 rules.
52601 </para>
52602 <para>
52603 Rewriting at transport time, by means of the <option>headers_rewrite</option> option,
52604 applies all headers except those added by routers and transports. That is, as
52605 well as the headers that were received with the message, it also applies to
52606 headers that were added by an ACL or a system filter.
52607 </para>
52608 <para>
52609 In general, rewriting addresses from your own system or domain has some
52610 legitimacy. Rewriting other addresses should be done only with great care and
52611 in special circumstances. The author of Exim believes that rewriting should be
52612 used sparingly, and mainly for <quote>regularizing</quote> addresses in your own domains.
52613 Although it can sometimes be used as a routing tool, this is very strongly
52614 discouraged.
52615 </para>
52616 <para>
52617 There are two commonly encountered circumstances where rewriting is used, as
52618 illustrated by these examples:
52619 </para>
52620 <itemizedlist>
52621 <listitem>
52622 <para>
52623 The company whose domain is <emphasis>hitch.fict.example</emphasis> has a number of hosts that
52624 exchange mail with each other behind a firewall, but there is only a single
52625 gateway to the outer world. The gateway rewrites <emphasis>*.hitch.fict.example</emphasis> as
52626 <emphasis>hitch.fict.example</emphasis> when sending mail off-site.
52627 </para>
52628 </listitem>
52629 <listitem>
52630 <para>
52631 A host rewrites the local parts of its own users so that, for example,
52632 <emphasis>fp42@hitch.fict.example</emphasis> becomes <emphasis>Ford.Prefect@hitch.fict.example</emphasis>.
52633 </para>
52634 </listitem>
52635 </itemizedlist>
52636 </section>
52637 <section id="SECID148">
52638 <title>When does rewriting happen?</title>
52639 <para>
52640 <indexterm role="concept">
52641 <primary>rewriting</primary>
52642 <secondary>timing of</secondary>
52643 </indexterm>
52644 <indexterm role="concept">
52645 <primary>access control lists (ACLs)</primary>
52646 <secondary>rewriting addresses in</secondary>
52647 </indexterm>
52648 Configured address rewriting can take place at several different stages of a
52649 message&#x2019;s processing.
52650 </para>
52651 <para>
52652 <indexterm role="variable">
52653 <primary><varname>$sender_address</varname></primary>
52654 </indexterm>
52655 At the start of an ACL for MAIL, the sender address may have been rewritten
52656 by a special SMTP-time rewrite rule (see section <xref linkend="SECTrewriteS"/>), but no
52657 ordinary rewrite rules have yet been applied. If, however, the sender address
52658 is verified in the ACL, it is rewritten before verification, and remains
52659 rewritten thereafter. The subsequent value of <varname>$sender_address</varname> is the
52660 rewritten address. This also applies if sender verification happens in a
52661 RCPT ACL. Otherwise, when the sender address is not verified, it is
52662 rewritten as soon as a message&#x2019;s header lines have been received.
52663 </para>
52664 <para>
52665 <indexterm role="variable">
52666 <primary><varname>$domain</varname></primary>
52667 </indexterm>
52668 <indexterm role="variable">
52669 <primary><varname>$local_part</varname></primary>
52670 </indexterm>
52671 Similarly, at the start of an ACL for RCPT, the current recipient&#x2019;s address
52672 may have been rewritten by a special SMTP-time rewrite rule, but no ordinary
52673 rewrite rules have yet been applied to it. However, the behaviour is different
52674 from the sender address when a recipient is verified. The address is rewritten
52675 for the verification, but the rewriting is not remembered at this stage. The
52676 value of <varname>$local_part</varname> and <varname>$domain</varname> after verification are always the same
52677 as they were before (that is, they contain the unrewritten &ndash; except for
52678 SMTP-time rewriting &ndash; address).
52679 </para>
52680 <para>
52681 As soon as a message&#x2019;s header lines have been received, all the envelope
52682 recipient addresses are permanently rewritten, and rewriting is also applied to
52683 the addresses in the header lines (if configured). This happens before adding
52684 any header lines that were specified in MAIL or RCPT ACLs, and
52685 <indexterm role="concept">
52686 <primary><function>local_scan()</function> function</primary>
52687 <secondary>address rewriting; timing of</secondary>
52688 </indexterm>
52689 before the DATA ACL and <function>local_scan()</function> functions are run.
52690 </para>
52691 <para>
52692 When an address is being routed, either for delivery or for verification,
52693 rewriting is applied immediately to child addresses that are generated by
52694 redirection, unless <option>no_rewrite</option> is set on the router.
52695 </para>
52696 <para>
52697 <indexterm role="concept">
52698 <primary>envelope from</primary>
52699 </indexterm>
52700 <indexterm role="concept">
52701 <primary>envelope sender</primary>
52702 <secondary>rewriting at transport time</secondary>
52703 </indexterm>
52704 <indexterm role="concept">
52705 <primary>rewriting</primary>
52706 <secondary>at transport time</secondary>
52707 </indexterm>
52708 <indexterm role="concept">
52709 <primary>header lines</primary>
52710 <secondary>rewriting at transport time</secondary>
52711 </indexterm>
52712 At transport time, additional rewriting of addresses in header lines can be
52713 specified by setting the generic <option>headers_rewrite</option> option on a transport.
52714 This option contains rules that are identical in form to those in the rewrite
52715 section of the configuration file. They are applied to the original message
52716 header lines and any that were added by ACLs or a system filter. They are not
52717 applied to header lines that are added by routers or the transport.
52718 </para>
52719 <para>
52720 The outgoing envelope sender can be rewritten by means of the <option>return_path</option>
52721 transport option. However, it is not possible to rewrite envelope recipients at
52722 transport time.
52723 </para>
52724 </section>
52725 <section id="SECID149">
52726 <title>Testing the rewriting rules that apply on input</title>
52727 <para>
52728 <indexterm role="concept">
52729 <primary>rewriting</primary>
52730 <secondary>testing</secondary>
52731 </indexterm>
52732 <indexterm role="concept">
52733 <primary>testing</primary>
52734 <secondary>rewriting</secondary>
52735 </indexterm>
52736 Exim&#x2019;s input rewriting configuration appears in a part of the runtime
52737 configuration file headed by <quote>begin rewrite</quote>. It can be tested by the
52738 <option>-brw</option> command line option. This takes an address (which can be a full RFC
52739 2822 address) as its argument. The output is a list of how the address would be
52740 transformed by the rewriting rules for each of the different places it might
52741 appear in an incoming message, that is, for each different header and for the
52742 envelope sender and recipient fields. For example,
52743 </para>
52744 <literallayout class="monospaced">
52745 exim -brw ph10@exim.workshop.example
52746 </literallayout>
52747 <para>
52748 might produce the output
52749 </para>
52750 <literallayout class="monospaced">
52751 sender: Philip.Hazel@exim.workshop.example
52752 from: Philip.Hazel@exim.workshop.example
52753 to: ph10@exim.workshop.example
52754 cc: ph10@exim.workshop.example
52755 bcc: ph10@exim.workshop.example
52756 reply-to: Philip.Hazel@exim.workshop.example
52757 env-from: Philip.Hazel@exim.workshop.example
52758 env-to: ph10@exim.workshop.example
52759 </literallayout>
52760 <para>
52761 which shows that rewriting has been set up for that address when used in any of
52762 the source fields, but not when it appears as a recipient address. At the
52763 present time, there is no equivalent way of testing rewriting rules that are
52764 set for a particular transport.
52765 </para>
52766 </section>
52767 <section id="SECID150">
52768 <title>Rewriting rules</title>
52769 <para>
52770 <indexterm role="concept">
52771 <primary>rewriting</primary>
52772 <secondary>rules</secondary>
52773 </indexterm>
52774 The rewrite section of the configuration file consists of lines of rewriting
52775 rules in the form
52776 </para>
52777 <literallayout>
52778 &lt;<emphasis>source pattern</emphasis>&gt;  &lt;<emphasis>replacement</emphasis>&gt;  &lt;<emphasis>flags</emphasis>&gt;
52779 </literallayout>
52780 <para>
52781 Rewriting rules that are specified for the <option>headers_rewrite</option> generic
52782 transport option are given as a colon-separated list. Each item in the list
52783 takes the same form as a line in the main rewriting configuration (except that
52784 any colons must be doubled, of course).
52785 </para>
52786 <para>
52787 The formats of source patterns and replacement strings are described below.
52788 Each is terminated by white space, unless enclosed in double quotes, in which
52789 case normal quoting conventions apply inside the quotes. The flags are single
52790 characters which may appear in any order. Spaces and tabs between them are
52791 ignored.
52792 </para>
52793 <para>
52794 For each address that could potentially be rewritten, the rules are scanned in
52795 order, and replacements for the address from earlier rules can themselves be
52796 replaced by later rules (but see the <quote>q</quote> and <quote>R</quote> flags).
52797 </para>
52798 <para>
52799 The order in which addresses are rewritten is undefined, may change between
52800 releases, and must not be relied on, with one exception: when a message is
52801 received, the envelope sender is always rewritten first, before any header
52802 lines are rewritten. For example, the replacement string for a rewrite of an
52803 address in <emphasis>To:</emphasis> must not assume that the message&#x2019;s address in <emphasis>From:</emphasis> has
52804 (or has not) already been rewritten. However, a rewrite of <emphasis>From:</emphasis> may assume
52805 that the envelope sender has already been rewritten.
52806 </para>
52807 <para>
52808 <indexterm role="variable">
52809 <primary><varname>$domain</varname></primary>
52810 </indexterm>
52811 <indexterm role="variable">
52812 <primary><varname>$local_part</varname></primary>
52813 </indexterm>
52814 The variables <varname>$local_part</varname> and <varname>$domain</varname> can be used in the replacement
52815 string to refer to the address that is being rewritten. Note that lookup-driven
52816 rewriting can be done by a rule of the form
52817 </para>
52818 <literallayout class="monospaced">
52819 *@*   ${lookup ...
52820 </literallayout>
52821 <para>
52822 where the lookup key uses <varname>$1</varname> and <varname>$2</varname> or <varname>$local_part</varname> and <varname>$domain</varname> to
52823 refer to the address that is being rewritten.
52824 </para>
52825 </section>
52826 <section id="SECID151">
52827 <title>Rewriting patterns</title>
52828 <para>
52829 <indexterm role="concept">
52830 <primary>rewriting</primary>
52831 <secondary>patterns</secondary>
52832 </indexterm>
52833 <indexterm role="concept">
52834 <primary>address list</primary>
52835 <secondary>in a rewriting pattern</secondary>
52836 </indexterm>
52837 The source pattern in a rewriting rule is any item which may appear in an
52838 address list (see section <xref linkend="SECTaddresslist"/>). It is in fact processed as a
52839 single-item address list, which means that it is expanded before being tested
52840 against the address. As always, if you use a regular expression as a pattern,
52841 you must take care to escape dollar and backslash characters, or use the <literal>\N</literal>
52842 facility to suppress string expansion within the regular expression.
52843 </para>
52844 <para>
52845 Domains in patterns should be given in lower case. Local parts in patterns are
52846 case-sensitive. If you want to do case-insensitive matching of local parts, you
52847 can use a regular expression that starts with <literal>^(?i)</literal>.
52848 </para>
52849 <para>
52850 <indexterm role="concept">
52851 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
52852 <secondary>in rewriting rules</secondary>
52853 </indexterm>
52854 After matching, the numerical variables <varname>$1</varname>, <varname>$2</varname>, etc. may be set,
52855 depending on the type of match which occurred. These can be used in the
52856 replacement string to insert portions of the incoming address. <varname>$0</varname> always
52857 refers to the complete incoming address. When a regular expression is used, the
52858 numerical variables are set from its capturing subexpressions. For other types
52859 of pattern they are set as follows:
52860 </para>
52861 <itemizedlist>
52862 <listitem>
52863 <para>
52864 If a local part or domain starts with an asterisk, the numerical variables
52865 refer to the character strings matched by asterisks, with <varname>$1</varname> associated with
52866 the first asterisk, and <varname>$2</varname> with the second, if present. For example, if the
52867 pattern
52868 </para>
52869 <literallayout class="monospaced">
52870 *queen@*.fict.example
52871 </literallayout>
52872 <para>
52873 is matched against the address <emphasis>hearts-queen@wonderland.fict.example</emphasis> then
52874 </para>
52875 <literallayout class="monospaced">
52876 $0 = hearts-queen@wonderland.fict.example
52877 $1 = hearts-
52878 $2 = wonderland
52879 </literallayout>
52880 <para>
52881 Note that if the local part does not start with an asterisk, but the domain
52882 does, it is <varname>$1</varname> that contains the wild part of the domain.
52883 </para>
52884 </listitem>
52885 <listitem>
52886 <para>
52887 If the domain part of the pattern is a partial lookup, the wild and fixed parts
52888 of the domain are placed in the next available numerical variables. Suppose,
52889 for example, that the address <emphasis>foo@bar.baz.example</emphasis> is processed by a
52890 rewriting rule of the form
52891 </para>
52892 <literallayout>
52893 <literal>*@partial-dbm;/some/dbm/file</literal>    &lt;<emphasis>replacement string</emphasis>&gt;
52894 </literallayout>
52895 <para>
52896 and the key in the file that matches the domain is <literal>*.baz.example</literal>. Then
52897 </para>
52898 <literallayout class="monospaced">
52899 $1 = foo
52900 $2 = bar
52901 $3 = baz.example
52902 </literallayout>
52903 <para>
52904 If the address <emphasis>foo@baz.example</emphasis> is looked up, this matches the same
52905 wildcard file entry, and in this case <varname>$2</varname> is set to the empty string, but
52906 <varname>$3</varname> is still set to <emphasis>baz.example</emphasis>. If a non-wild key is matched in a
52907 partial lookup, <varname>$2</varname> is again set to the empty string and <varname>$3</varname> is set to the
52908 whole domain. For non-partial domain lookups, no numerical variables are set.
52909 </para>
52910 </listitem>
52911 </itemizedlist>
52912 </section>
52913 <section id="SECID152">
52914 <title>Rewriting replacements</title>
52915 <para>
52916 <indexterm role="concept">
52917 <primary>rewriting</primary>
52918 <secondary>replacements</secondary>
52919 </indexterm>
52920 If the replacement string for a rule is a single asterisk, addresses that
52921 match the pattern and the flags are <emphasis>not</emphasis> rewritten, and no subsequent
52922 rewriting rules are scanned. For example,
52923 </para>
52924 <literallayout class="monospaced">
52925 hatta@lookingglass.fict.example  *  f
52926 </literallayout>
52927 <para>
52928 specifies that <emphasis>hatta@lookingglass.fict.example</emphasis> is never to be rewritten in
52929 <emphasis>From:</emphasis> headers.
52930 </para>
52931 <para>
52932 <indexterm role="variable">
52933 <primary><varname>$domain</varname></primary>
52934 </indexterm>
52935 <indexterm role="variable">
52936 <primary><varname>$local_part</varname></primary>
52937 </indexterm>
52938 If the replacement string is not a single asterisk, it is expanded, and must
52939 yield a fully qualified address. Within the expansion, the variables
52940 <varname>$local_part</varname> and <varname>$domain</varname> refer to the address that is being rewritten.
52941 Any letters they contain retain their original case &ndash; they are not lower
52942 cased. The numerical variables are set up according to the type of pattern that
52943 matched the address, as described above. If the expansion is forced to fail by
52944 the presence of <quote>fail</quote> in a conditional or lookup item, rewriting by the
52945 current rule is abandoned, but subsequent rules may take effect. Any other
52946 expansion failure causes the entire rewriting operation to be abandoned, and an
52947 entry written to the panic log.
52948 </para>
52949 </section>
52950 <section id="SECID153">
52951 <title>Rewriting flags</title>
52952 <para>
52953 There are three different kinds of flag that may appear on rewriting rules:
52954 </para>
52955 <itemizedlist>
52956 <listitem>
52957 <para>
52958 Flags that specify which headers and envelope addresses to rewrite: E, F, T, b,
52959 c, f, h, r, s, t.
52960 </para>
52961 </listitem>
52962 <listitem>
52963 <para>
52964 A flag that specifies rewriting at SMTP time: S.
52965 </para>
52966 </listitem>
52967 <listitem>
52968 <para>
52969 Flags that control the rewriting process: Q, q, R, w.
52970 </para>
52971 </listitem>
52972 </itemizedlist>
52973 <para>
52974 For rules that are part of the <option>headers_rewrite</option> generic transport option,
52975 E, F, T, and S are not permitted.
52976 </para>
52977 </section>
52978 <section id="SECID154">
52979 <title>Flags specifying which headers and envelope addresses to rewrite</title>
52980 <para>
52981 <indexterm role="concept">
52982 <primary>rewriting</primary>
52983 <secondary>flags</secondary>
52984 </indexterm>
52985 If none of the following flag letters, nor the <quote>S</quote> flag (see section
52986 <xref linkend="SECTrewriteS"/>) are present, a main rewriting rule applies to all headers
52987 and to both the sender and recipient fields of the envelope, whereas a
52988 transport-time rewriting rule just applies to all headers. Otherwise, the
52989 rewriting rule is skipped unless the relevant addresses are being processed.
52990 </para>
52991 <literallayout>
52992 <literal>E</literal>       rewrite all envelope fields
52993 <literal>F</literal>       rewrite the envelope From field
52994 <literal>T</literal>       rewrite the envelope To field
52995 <literal>b</literal>       rewrite the <emphasis>Bcc:</emphasis> header
52996 <literal>c</literal>       rewrite the <emphasis>Cc:</emphasis> header
52997 <literal>f</literal>       rewrite the <emphasis>From:</emphasis> header
52998 <literal>h</literal>       rewrite all headers
52999 <literal>r</literal>       rewrite the <emphasis>Reply-To:</emphasis> header
53000 <literal>s</literal>       rewrite the <emphasis>Sender:</emphasis> header
53001 <literal>t</literal>       rewrite the <emphasis>To:</emphasis> header
53002 </literallayout>
53003 <para>
53004 "All headers" means all of the headers listed above that can be selected
53005 individually, plus their <emphasis>Resent-</emphasis> versions. It does not include
53006 other headers such as <emphasis>Subject:</emphasis> etc.
53007 </para>
53008 <para>
53009 You should be particularly careful about rewriting <emphasis>Sender:</emphasis> headers, and
53010 restrict this to special known cases in your own domains.
53011 </para>
53012 </section>
53013 <section id="SECTrewriteS">
53014 <title>The SMTP-time rewriting flag</title>
53015 <para>
53016 <indexterm role="concept">
53017 <primary>SMTP</primary>
53018 <secondary>rewriting malformed addresses</secondary>
53019 </indexterm>
53020 <indexterm role="concept">
53021 <primary>RCPT</primary>
53022 <secondary>rewriting argument of</secondary>
53023 </indexterm>
53024 <indexterm role="concept">
53025 <primary>MAIL</primary>
53026 <secondary>rewriting argument of</secondary>
53027 </indexterm>
53028 The rewrite flag <quote>S</quote> specifies a rewrite of incoming envelope addresses at
53029 SMTP time, as soon as an address is received in a MAIL or RCPT command, and
53030 before any other processing; even before syntax checking. The pattern is
53031 required to be a regular expression, and it is matched against the whole of the
53032 data for the command, including any surrounding angle brackets.
53033 </para>
53034 <para>
53035 <indexterm role="variable">
53036 <primary><varname>$domain</varname></primary>
53037 </indexterm>
53038 <indexterm role="variable">
53039 <primary><varname>$local_part</varname></primary>
53040 </indexterm>
53041 This form of rewrite rule allows for the handling of addresses that are not
53042 compliant with RFCs 2821 and 2822 (for example, <quote>bang paths</quote> in batched SMTP
53043 input). Because the input is not required to be a syntactically valid address,
53044 the variables <varname>$local_part</varname> and <varname>$domain</varname> are not available during the
53045 expansion of the replacement string. The result of rewriting replaces the
53046 original address in the MAIL or RCPT command.
53047 </para>
53048 </section>
53049 <section id="SECID155">
53050 <title>Flags controlling the rewriting process</title>
53051 <para>
53052 There are four flags which control the way the rewriting process works. These
53053 take effect only when a rule is invoked, that is, when the address is of the
53054 correct type (matches the flags) and matches the pattern:
53055 </para>
53056 <itemizedlist>
53057 <listitem>
53058 <para>
53059 If the <quote>Q</quote> flag is set on a rule, the rewritten address is permitted to be an
53060 unqualified local part. It is qualified with <option>qualify_recipient</option>. In the
53061 absence of <quote>Q</quote> the rewritten address must always include a domain.
53062 </para>
53063 </listitem>
53064 <listitem>
53065 <para>
53066 If the <quote>q</quote> flag is set on a rule, no further rewriting rules are considered,
53067 even if no rewriting actually takes place because of a <quote>fail</quote> in the
53068 expansion. The <quote>q</quote> flag is not effective if the address is of the wrong type
53069 (does not match the flags) or does not match the pattern.
53070 </para>
53071 </listitem>
53072 <listitem>
53073 <para>
53074 The <quote>R</quote> flag causes a successful rewriting rule to be re-applied to the new
53075 address, up to ten times. It can be combined with the <quote>q</quote> flag, to stop
53076 rewriting once it fails to match (after at least one successful rewrite).
53077 </para>
53078 </listitem>
53079 <listitem>
53080 <para>
53081 <indexterm role="concept">
53082 <primary>rewriting</primary>
53083 <secondary>whole addresses</secondary>
53084 </indexterm>
53085 When an address in a header is rewritten, the rewriting normally applies only
53086 to the working part of the address, with any comments and RFC 2822 <quote>phrase</quote>
53087 left unchanged. For example, rewriting might change
53088 </para>
53089 <literallayout class="monospaced">
53090 From: Ford Prefect &lt;fp42@restaurant.hitch.fict.example&gt;
53091 </literallayout>
53092 <para>
53093 into
53094 </para>
53095 <literallayout class="monospaced">
53096 From: Ford Prefect &lt;prefectf@hitch.fict.example&gt;
53097 </literallayout>
53098 <para>
53099 <indexterm role="concept">
53100 <primary>RFC 2047</primary>
53101 </indexterm>
53102 Sometimes there is a need to replace the whole address item, and this can be
53103 done by adding the flag letter <quote>w</quote> to a rule. If this is set on a rule that
53104 causes an address in a header line to be rewritten, the entire address is
53105 replaced, not just the working part. The replacement must be a complete RFC
53106 2822 address, including the angle brackets if necessary. If text outside angle
53107 brackets contains a character whose value is greater than 126 or less than 32
53108 (except for tab), the text is encoded according to RFC 2047. The character set
53109 is taken from <option>headers_charset</option>, which gets its default at build time.
53110 </para>
53111 <para>
53112 When the <quote>w</quote> flag is set on a rule that causes an envelope address to be
53113 rewritten, all but the working part of the replacement address is discarded.
53114 </para>
53115 </listitem>
53116 </itemizedlist>
53117 </section>
53118 <section id="SECID156">
53119 <title>Rewriting examples</title>
53120 <para>
53121 Here is an example of the two common rewriting paradigms:
53122 </para>
53123 <literallayout class="monospaced">
53124 *@*.hitch.fict.example  $1@hitch.fict.example
53125 *@hitch.fict.example    ${lookup{$1}dbm{/etc/realnames}\
53126                      {$value}fail}@hitch.fict.example bctfrF
53127 </literallayout>
53128 <para>
53129 Note the use of <quote>fail</quote> in the lookup expansion in the second rule, forcing
53130 the string expansion to fail if the lookup does not succeed. In this context it
53131 has the effect of leaving the original address unchanged, but Exim goes on to
53132 consider subsequent rewriting rules, if any, because the <quote>q</quote> flag is not
53133 present in that rule. An alternative to <quote>fail</quote> would be to supply <varname>$1</varname>
53134 explicitly, which would cause the rewritten address to be the same as before,
53135 at the cost of a small bit of processing. Not supplying either of these is an
53136 error, since the rewritten address would then contain no local part.
53137 </para>
53138 <para>
53139 The first example above replaces the domain with a superior, more general
53140 domain. This may not be desirable for certain local parts. If the rule
53141 </para>
53142 <literallayout class="monospaced">
53143 root@*.hitch.fict.example  *
53144 </literallayout>
53145 <para>
53146 were inserted before the first rule, rewriting would be suppressed for the
53147 local part <emphasis>root</emphasis> at any domain ending in <emphasis>hitch.fict.example</emphasis>.
53148 </para>
53149 <para>
53150 Rewriting can be made conditional on a number of tests, by making use of
53151 <varname>${if</varname> in the expansion item. For example, to apply a rewriting rule only to
53152 messages that originate outside the local host:
53153 </para>
53154 <literallayout class="monospaced">
53155 *@*.hitch.fict.example  "${if !eq {$sender_host_address}{}\
53156                          {$1@hitch.fict.example}fail}"
53157 </literallayout>
53158 <para>
53159 The replacement string is quoted in this example because it contains white
53160 space.
53161 </para>
53162 <para>
53163 <indexterm role="concept">
53164 <primary>rewriting</primary>
53165 <secondary>bang paths</secondary>
53166 </indexterm>
53167 <indexterm role="concept">
53168 <primary>bang paths</primary>
53169 <secondary>rewriting</secondary>
53170 </indexterm>
53171 Exim does not handle addresses in the form of <quote>bang paths</quote>. If it sees such
53172 an address it treats it as an unqualified local part which it qualifies with
53173 the local qualification domain (if the source of the message is local or if the
53174 remote host is permitted to send unqualified addresses). Rewriting can
53175 sometimes be used to handle simple bang paths with a fixed number of
53176 components. For example, the rule
53177 </para>
53178 <literallayout class="monospaced">
53179 \N^([^!]+)!(.*)@your.domain.example$\N   $2@$1
53180 </literallayout>
53181 <para>
53182 rewrites a two-component bang path <emphasis>host.name!user</emphasis> as the domain address
53183 <emphasis>user@host.name</emphasis>. However, there is a security implication in using this as
53184 a global rewriting rule for envelope addresses. It can provide a backdoor
53185 method for using your system as a relay, because the incoming addresses appear
53186 to be local. If the bang path addresses are received via SMTP, it is safer to
53187 use the <quote>S</quote> flag to rewrite them as they are received, so that relay checking
53188 can be done on the rewritten addresses.
53189 <indexterm role="concept" startref="IIDaddrew" class="endofrange"/>
53190 </para>
53191 </section>
53192 </chapter>
53193
53194 <chapter id="CHAPretry">
53195 <title>Retry configuration</title>
53196 <para>
53197 <indexterm role="concept" id="IIDretconf1" class="startofrange">
53198 <primary>retry</primary>
53199 <secondary>configuration, description of</secondary>
53200 </indexterm>
53201 <indexterm role="concept" id="IIDregconf2" class="startofrange">
53202 <primary>configuration file</primary>
53203 <secondary>retry section</secondary>
53204 </indexterm>
53205 The <quote>retry</quote> section of the runtime configuration file contains a list of
53206 retry rules that control how often Exim tries to deliver messages that cannot
53207 be delivered at the first attempt. If there are no retry rules (the section is
53208 empty or not present), there are no retries. In this situation, temporary
53209 errors are treated as permanent. The default configuration contains a single,
53210 general-purpose retry rule (see section <xref linkend="SECID57"/>). The <option>-brt</option> command
53211 line option can be used to test which retry rule will be used for a given
53212 address, domain and error.
53213 </para>
53214 <para>
53215 The most common cause of retries is temporary failure to deliver to a remote
53216 host because the host is down, or inaccessible because of a network problem.
53217 Exim&#x2019;s retry processing in this case is applied on a per-host (strictly, per IP
53218 address) basis, not on a per-message basis. Thus, if one message has recently
53219 been delayed, delivery of a new message to the same host is not immediately
53220 tried, but waits for the host&#x2019;s retry time to arrive. If the <option>retry_defer</option>
53221 log selector is set, the message
53222 <indexterm role="concept">
53223 <primary>retry</primary>
53224 <secondary>time not reached</secondary>
53225 </indexterm>
53226 <quote>retry time not reached</quote> is written to the main log whenever a delivery is
53227 skipped for this reason. Section <xref linkend="SECToutSMTPerr"/> contains more details of
53228 the handling of errors during remote deliveries.
53229 </para>
53230 <para>
53231 Retry processing applies to routing as well as to delivering, except as covered
53232 in the next paragraph. The retry rules do not distinguish between these
53233 actions. It is not possible, for example, to specify different behaviour for
53234 failures to route the domain <emphasis>snark.fict.example</emphasis> and failures to deliver to
53235 the host <emphasis>snark.fict.example</emphasis>. I didn&#x2019;t think anyone would ever need this
53236 added complication, so did not implement it. However, although they share the
53237 same retry rule, the actual retry times for routing and transporting a given
53238 domain are maintained independently.
53239 </para>
53240 <para>
53241 When a delivery is not part of a queue run (typically an immediate delivery on
53242 receipt of a message), the routers are always run, and local deliveries are
53243 always attempted, even if retry times are set for them. This makes for better
53244 behaviour if one particular message is causing problems (for example, causing
53245 quota overflow, or provoking an error in a filter file). If such a delivery
53246 suffers a temporary failure, the retry data is updated as normal, and
53247 subsequent delivery attempts from queue runs occur only when the retry time for
53248 the local address is reached.
53249 </para>
53250 <section id="SECID157">
53251 <title>Changing retry rules</title>
53252 <para>
53253 If you change the retry rules in your configuration, you should consider
53254 whether or not to delete the retry data that is stored in Exim&#x2019;s spool area in
53255 files with names like <filename>db/retry</filename>. Deleting any of Exim&#x2019;s hints files is
53256 always safe; that is why they are called <quote>hints</quote>.
53257 </para>
53258 <para>
53259 The hints retry data contains suggested retry times based on the previous
53260 rules. In the case of a long-running problem with a remote host, it might
53261 record the fact that the host has timed out. If your new rules increase the
53262 timeout time for such a host, you should definitely remove the old retry data
53263 and let Exim recreate it, based on the new rules. Otherwise Exim might bounce
53264 messages that it should now be retaining.
53265 </para>
53266 </section>
53267 <section id="SECID158">
53268 <title>Format of retry rules</title>
53269 <para>
53270 <indexterm role="concept">
53271 <primary>retry</primary>
53272 <secondary>rules</secondary>
53273 </indexterm>
53274 Each retry rule occupies one line and consists of three or four parts,
53275 separated by white space: a pattern, an error name, an optional list of sender
53276 addresses, and a list of retry parameters. The pattern and sender lists must be
53277 enclosed in double quotes if they contain white space. The rules are searched
53278 in order until one is found where the pattern, error name, and sender list (if
53279 present) match the failing host or address, the error that occurred, and the
53280 message&#x2019;s sender, respectively.
53281 </para>
53282 <para>
53283 The pattern is any single item that may appear in an address list (see section
53284 <xref linkend="SECTaddresslist"/>). It is in fact processed as a one-item address list,
53285 which means that it is expanded before being tested against the address that
53286 has been delayed. A negated address list item is permitted. Address
53287 list processing treats a plain domain name as if it were preceded by <quote>*@</quote>,
53288 which makes it possible for many retry rules to start with just a domain. For
53289 example,
53290 </para>
53291 <literallayout class="monospaced">
53292 lookingglass.fict.example        *  F,24h,30m;
53293 </literallayout>
53294 <para>
53295 provides a rule for any address in the <emphasis>lookingglass.fict.example</emphasis> domain,
53296 whereas
53297 </para>
53298 <literallayout class="monospaced">
53299 alice@lookingglass.fict.example  *  F,24h,30m;
53300 </literallayout>
53301 <para>
53302 applies only to temporary failures involving the local part <option>alice</option>.
53303 In practice, almost all rules start with a domain name pattern without a local
53304 part.
53305 </para>
53306 <para>
53307 <indexterm role="concept">
53308 <primary>regular expressions</primary>
53309 <secondary>in retry rules</secondary>
53310 </indexterm>
53311 <emphasis role="bold">Warning</emphasis>: If you use a regular expression in a retry rule pattern, it
53312 must match a complete address, not just a domain, because that is how regular
53313 expressions work in address lists.
53314 </para>
53315 <literallayout>
53316 <literal>^\Nxyz\d+\.abc\.example$\N        *  G,1h,10m,2</literal>     <option>Wrong</option>
53317 <literal>^\N[^@]+@xyz\d+\.abc\.example$\N  *  G,1h,10m,2</literal>     <option>Right</option>
53318 </literallayout>
53319 </section>
53320 <section id="SECID159">
53321 <title>Choosing which retry rule to use for address errors</title>
53322 <para>
53323 When Exim is looking for a retry rule after a routing attempt has failed (for
53324 example, after a DNS timeout), each line in the retry configuration is tested
53325 against the complete address only if <option>retry_use_local_part</option> is set for the
53326 router. Otherwise, only the domain is used, except when matching against a
53327 regular expression, when the local part of the address is replaced with <quote>*</quote>.
53328 A domain on its own can match a domain pattern, or a pattern that starts with
53329 <quote>*@</quote>. By default, <option>retry_use_local_part</option> is true for routers where
53330 <option>check_local_user</option> is true, and false for other routers.
53331 </para>
53332 <para>
53333 Similarly, when Exim is looking for a retry rule after a local delivery has
53334 failed (for example, after a mailbox full error), each line in the retry
53335 configuration is tested against the complete address only if
53336 <option>retry_use_local_part</option> is set for the transport (it defaults true for all
53337 local transports).
53338 </para>
53339 <para>
53340 <indexterm role="concept">
53341 <primary>4<emphasis>xx</emphasis> responses</primary>
53342 <secondary>retry rules for</secondary>
53343 </indexterm>
53344 However, when Exim is looking for a retry rule after a remote delivery attempt
53345 suffers an address error (a 4<emphasis>xx</emphasis> SMTP response for a recipient address), the
53346 whole address is always used as the key when searching the retry rules. The
53347 rule that is found is used to create a retry time for the combination of the
53348 failing address and the message&#x2019;s sender. It is the combination of sender and
53349 recipient that is delayed in subsequent queue runs until its retry time is
53350 reached. You can delay the recipient without regard to the sender by setting
53351 <option>address_retry_include_sender</option> false in the <command>smtp</command> transport but this can
53352 lead to problems with servers that regularly issue 4<emphasis>xx</emphasis> responses to RCPT
53353 commands.
53354 </para>
53355 </section>
53356 <section id="SECID160">
53357 <title>Choosing which retry rule to use for host and message errors</title>
53358 <para>
53359 For a temporary error that is not related to an individual address (for
53360 example, a connection timeout), each line in the retry configuration is checked
53361 twice. First, the name of the remote host is used as a domain name (preceded by
53362 <quote>*@</quote> when matching a regular expression). If this does not match the line,
53363 the domain from the email address is tried in a similar fashion. For example,
53364 suppose the MX records for <emphasis>a.b.c.example</emphasis> are
53365 </para>
53366 <literallayout class="monospaced">
53367 a.b.c.example  MX  5  x.y.z.example
53368                MX  6  p.q.r.example
53369                MX  7  m.n.o.example
53370 </literallayout>
53371 <para>
53372 and the retry rules are
53373 </para>
53374 <literallayout class="monospaced">
53375 p.q.r.example    *      F,24h,30m;
53376 a.b.c.example    *      F,4d,45m;
53377 </literallayout>
53378 <para>
53379 and a delivery to the host <emphasis>x.y.z.example</emphasis> suffers a connection failure. The
53380 first rule matches neither the host nor the domain, so Exim looks at the second
53381 rule. This does not match the host, but it does match the domain, so it is used
53382 to calculate the retry time for the host <emphasis>x.y.z.example</emphasis>. Meanwhile, Exim
53383 tries to deliver to <emphasis>p.q.r.example</emphasis>. If this also suffers a host error, the
53384 first retry rule is used, because it matches the host.
53385 </para>
53386 <para>
53387 In other words, temporary failures to deliver to host <emphasis>p.q.r.example</emphasis> use the
53388 first rule to determine retry times, but for all the other hosts for the domain
53389 <emphasis>a.b.c.example</emphasis>, the second rule is used. The second rule is also used if
53390 routing to <emphasis>a.b.c.example</emphasis> suffers a temporary failure.
53391 </para>
53392 <para>
53393 <emphasis role="bold">Note</emphasis>: The host name is used when matching the patterns, not its IP address.
53394 However, if a message is routed directly to an IP address without the use of a
53395 host name, for example, if a <command>manualroute</command> router contains a setting such as:
53396 </para>
53397 <literallayout class="monospaced">
53398 route_list = *.a.example  192.168.34.23
53399 </literallayout>
53400 <para>
53401 then the <quote>host name</quote> that is used when searching for a retry rule is the
53402 textual form of the IP address.
53403 </para>
53404 </section>
53405 <section id="SECID161">
53406 <title>Retry rules for specific errors</title>
53407 <para>
53408 <indexterm role="concept">
53409 <primary>retry</primary>
53410 <secondary>specific errors; specifying</secondary>
53411 </indexterm>
53412 The second field in a retry rule is the name of a particular error, or an
53413 asterisk, which matches any error. The errors that can be tested for are:
53414 </para>
53415 <variablelist>
53416 <varlistentry>
53417 <term><option>auth_failed</option></term>
53418 <listitem>
53419 <para>
53420 Authentication failed when trying to send to a host in the
53421 <option>hosts_require_auth</option> list in an <command>smtp</command> transport.
53422 </para>
53423 </listitem></varlistentry>
53424 <varlistentry>
53425 <term><option>data_4xx</option></term>
53426 <listitem>
53427 <para>
53428 A 4<emphasis>xx</emphasis> error was received for an outgoing DATA command, either immediately
53429 after the command, or after sending the message&#x2019;s data.
53430 </para>
53431 </listitem></varlistentry>
53432 <varlistentry>
53433 <term><option>mail_4xx</option></term>
53434 <listitem>
53435 <para>
53436 A 4<emphasis>xx</emphasis> error was received for an outgoing MAIL command.
53437 </para>
53438 </listitem></varlistentry>
53439 <varlistentry>
53440 <term><option>rcpt_4xx</option></term>
53441 <listitem>
53442 <para>
53443 A 4<emphasis>xx</emphasis> error was received for an outgoing RCPT command.
53444 </para>
53445 </listitem></varlistentry>
53446 </variablelist>
53447 <para>
53448 For the three 4<emphasis>xx</emphasis> errors, either the first or both of the x&#x2019;s can be given
53449 as specific digits, for example: <literal>mail_45x</literal> or <literal>rcpt_436</literal>. For example, to
53450 recognize 452 errors given to RCPT commands for addresses in a certain domain,
53451 and have retries every ten minutes with a one-hour timeout, you could set up a
53452 retry rule of this form:
53453 </para>
53454 <literallayout class="monospaced">
53455 the.domain.name  rcpt_452   F,1h,10m
53456 </literallayout>
53457 <para>
53458 These errors apply to both outgoing SMTP (the <command>smtp</command> transport) and outgoing
53459 LMTP (either the <command>lmtp</command> transport, or the <command>smtp</command> transport in LMTP mode).
53460 </para>
53461 <variablelist>
53462 <varlistentry>
53463 <term><option>lost_connection</option></term>
53464 <listitem>
53465 <para>
53466 A server unexpectedly closed the SMTP connection. There may, of course,
53467 legitimate reasons for this (host died, network died), but if it repeats a lot
53468 for the same host, it indicates something odd.
53469 </para>
53470 </listitem></varlistentry>
53471 <varlistentry>
53472 <term><option>lookup</option></term>
53473 <listitem>
53474 <para>
53475 A DNS lookup for a host failed.
53476 Note that a <option>dnslookup</option> router will need to have matched
53477 its <option>fail_defer_domains</option> option for this retry type to be usable.
53478 Also note that a <option>manualroute</option> router will probably need
53479 its <option>host_find_failed</option> option set to <option>defer</option>.
53480 </para>
53481 </listitem></varlistentry>
53482 <varlistentry>
53483 <term><option>refused_MX</option></term>
53484 <listitem>
53485 <para>
53486 A connection to a host obtained from an MX record was refused.
53487 </para>
53488 </listitem></varlistentry>
53489 <varlistentry>
53490 <term><option>refused_A</option></term>
53491 <listitem>
53492 <para>
53493 A connection to a host not obtained from an MX record was refused.
53494 </para>
53495 </listitem></varlistentry>
53496 <varlistentry>
53497 <term><option>refused</option></term>
53498 <listitem>
53499 <para>
53500 A connection was refused.
53501 </para>
53502 </listitem></varlistentry>
53503 <varlistentry>
53504 <term><option>timeout_connect_MX</option></term>
53505 <listitem>
53506 <para>
53507 A connection attempt to a host obtained from an MX record timed out.
53508 </para>
53509 </listitem></varlistentry>
53510 <varlistentry>
53511 <term><option>timeout_connect_A</option></term>
53512 <listitem>
53513 <para>
53514 A connection attempt to a host not obtained from an MX record timed out.
53515 </para>
53516 </listitem></varlistentry>
53517 <varlistentry>
53518 <term><option>timeout_connect</option></term>
53519 <listitem>
53520 <para>
53521 A connection attempt timed out.
53522 </para>
53523 </listitem></varlistentry>
53524 <varlistentry>
53525 <term><option>timeout_MX</option></term>
53526 <listitem>
53527 <para>
53528 There was a timeout while connecting or during an SMTP session with a host
53529 obtained from an MX record.
53530 </para>
53531 </listitem></varlistentry>
53532 <varlistentry>
53533 <term><option>timeout_A</option></term>
53534 <listitem>
53535 <para>
53536 There was a timeout while connecting or during an SMTP session with a host not
53537 obtained from an MX record.
53538 </para>
53539 </listitem></varlistentry>
53540 <varlistentry>
53541 <term><option>timeout</option></term>
53542 <listitem>
53543 <para>
53544 There was a timeout while connecting or during an SMTP session.
53545 </para>
53546 </listitem></varlistentry>
53547 <varlistentry>
53548 <term><option>tls_required</option></term>
53549 <listitem>
53550 <para>
53551 The server was required to use TLS (it matched <option>hosts_require_tls</option> in the
53552 <command>smtp</command> transport), but either did not offer TLS, or it responded with 4<emphasis>xx</emphasis>
53553 to STARTTLS, or there was a problem setting up the TLS connection.
53554 </para>
53555 </listitem></varlistentry>
53556 <varlistentry>
53557 <term><option>quota</option></term>
53558 <listitem>
53559 <para>
53560 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
53561 transport.
53562 </para>
53563 </listitem></varlistentry>
53564 <varlistentry>
53565 <term><option>quota_</option>&lt;<emphasis>time</emphasis>&gt;</term>
53566 <listitem>
53567 <para>
53568 <indexterm role="concept">
53569 <primary>quota</primary>
53570 <secondary>error testing in retry rule</secondary>
53571 </indexterm>
53572 <indexterm role="concept">
53573 <primary>retry</primary>
53574 <secondary>quota error testing</secondary>
53575 </indexterm>
53576 A mailbox quota was exceeded in a local delivery by the <command>appendfile</command>
53577 transport, and the mailbox has not been accessed for &lt;<emphasis>time</emphasis>&gt;. For example,
53578 <emphasis>quota_4d</emphasis> applies to a quota error when the mailbox has not been accessed
53579 for four days.
53580 </para>
53581 </listitem></varlistentry>
53582 </variablelist>
53583 <para>
53584 <indexterm role="concept">
53585 <primary>mailbox</primary>
53586 <secondary>time of last read</secondary>
53587 </indexterm>
53588 The idea of <option>quota_</option>&lt;<emphasis>time</emphasis>&gt; is to make it possible to have shorter
53589 timeouts when the mailbox is full and is not being read by its owner. Ideally,
53590 it should be based on the last time that the user accessed the mailbox.
53591 However, it is not always possible to determine this. Exim uses the following
53592 heuristic rules:
53593 </para>
53594 <itemizedlist>
53595 <listitem>
53596 <para>
53597 If the mailbox is a single file, the time of last access (the <quote>atime</quote>) is
53598 used. As no new messages are being delivered (because the mailbox is over
53599 quota), Exim does not access the file, so this is the time of last user access.
53600 </para>
53601 </listitem>
53602 <listitem>
53603 <para>
53604 <indexterm role="concept">
53605 <primary>maildir format</primary>
53606 <secondary>time of last read</secondary>
53607 </indexterm>
53608 For a maildir delivery, the time of last modification of the <filename>new</filename>
53609 subdirectory is used. As the mailbox is over quota, no new files are created in
53610 the <filename>new</filename> subdirectory, because no new messages are being delivered. Any
53611 change to the <filename>new</filename> subdirectory is therefore assumed to be the result of an
53612 MUA moving a new message to the <filename>cur</filename> directory when it is first read. The
53613 time that is used is therefore the last time that the user read a new message.
53614 </para>
53615 </listitem>
53616 <listitem>
53617 <para>
53618 For other kinds of multi-file mailbox, the time of last access cannot be
53619 obtained, so a retry rule that uses this type of error field is never matched.
53620 </para>
53621 </listitem>
53622 </itemizedlist>
53623 <para>
53624 The quota errors apply both to system-enforced quotas and to Exim&#x2019;s own quota
53625 mechanism in the <command>appendfile</command> transport. The <emphasis>quota</emphasis> error also applies
53626 when a local delivery is deferred because a partition is full (the ENOSPC
53627 error).
53628 </para>
53629 </section>
53630 <section id="SECID162">
53631 <title>Retry rules for specified senders</title>
53632 <para>
53633 <indexterm role="concept">
53634 <primary>retry</primary>
53635 <secondary>rules; sender-specific</secondary>
53636 </indexterm>
53637 You can specify retry rules that apply only when the failing message has a
53638 specific sender. In particular, this can be used to define retry rules that
53639 apply only to bounce messages. The third item in a retry rule can be of this
53640 form:
53641 </para>
53642 <literallayout>
53643 <literal>senders=</literal>&lt;<emphasis>address list</emphasis>&gt;
53644 </literallayout>
53645 <para>
53646 The retry timings themselves are then the fourth item. For example:
53647 </para>
53648 <literallayout class="monospaced">
53649 *   rcpt_4xx   senders=:   F,1h,30m
53650 </literallayout>
53651 <para>
53652 matches recipient 4<emphasis>xx</emphasis> errors for bounce messages sent to any address at any
53653 host. If the address list contains white space, it must be enclosed in quotes.
53654 For example:
53655 </para>
53656 <literallayout class="monospaced">
53657 a.domain  rcpt_452  senders="xb.dom : yc.dom"  G,8h,10m,1.5
53658 </literallayout>
53659 <para>
53660 <emphasis role="bold">Warning</emphasis>: This facility can be unhelpful if it is used for host errors
53661 (which do not depend on the recipient). The reason is that the sender is used
53662 only to match the retry rule. Once the rule has been found for a host error,
53663 its contents are used to set a retry time for the host, and this will apply to
53664 all messages, not just those with specific senders.
53665 </para>
53666 <para>
53667 When testing retry rules using <option>-brt</option>, you can supply a sender using the
53668 <option>-f</option> command line option, like this:
53669 </para>
53670 <literallayout class="monospaced">
53671 exim -f "" -brt user@dom.ain
53672 </literallayout>
53673 <para>
53674 If you do not set <option>-f</option> with <option>-brt</option>, a retry rule that contains a senders
53675 list is never matched.
53676 </para>
53677 </section>
53678 <section id="SECID163">
53679 <title>Retry parameters</title>
53680 <para>
53681 <indexterm role="concept">
53682 <primary>retry</primary>
53683 <secondary>parameters in rules</secondary>
53684 </indexterm>
53685 The third (or fourth, if a senders list is present) field in a retry rule is a
53686 sequence of retry parameter sets, separated by semicolons. Each set consists of
53687 </para>
53688 <literallayout>
53689 &lt;<emphasis>letter</emphasis>&gt;,&lt;<emphasis>cutoff time</emphasis>&gt;,&lt;<emphasis>arguments</emphasis>&gt;
53690 </literallayout>
53691 <para>
53692 The letter identifies the algorithm for computing a new retry time; the cutoff
53693 time is the time beyond which this algorithm no longer applies, and the
53694 arguments vary the algorithm&#x2019;s action. The cutoff time is measured from the
53695 time that the first failure for the domain (combined with the local part if
53696 relevant) was detected, not from the time the message was received.
53697 </para>
53698 <para>
53699 <indexterm role="concept">
53700 <primary>retry</primary>
53701 <secondary>algorithms</secondary>
53702 </indexterm>
53703 <indexterm role="concept">
53704 <primary>retry</primary>
53705 <secondary>fixed intervals</secondary>
53706 </indexterm>
53707 <indexterm role="concept">
53708 <primary>retry</primary>
53709 <secondary>increasing intervals</secondary>
53710 </indexterm>
53711 <indexterm role="concept">
53712 <primary>retry</primary>
53713 <secondary>random intervals</secondary>
53714 </indexterm>
53715 The available algorithms are:
53716 </para>
53717 <itemizedlist>
53718 <listitem>
53719 <para>
53720 <emphasis>F</emphasis>: retry at fixed intervals. There is a single time parameter specifying
53721 the interval.
53722 </para>
53723 </listitem>
53724 <listitem>
53725 <para>
53726 <emphasis>G</emphasis>: retry at geometrically increasing intervals. The first argument
53727 specifies a starting value for the interval, and the second a multiplier, which
53728 is used to increase the size of the interval at each retry.
53729 </para>
53730 </listitem>
53731 <listitem>
53732 <para>
53733 <emphasis>H</emphasis>: retry at randomized intervals. The arguments are as for <emphasis>G</emphasis>. For each
53734 retry, the previous interval is multiplied by the factor in order to get a
53735 maximum for the next interval. The minimum interval is the first argument of
53736 the parameter, and an actual interval is chosen randomly between them. Such a
53737 rule has been found to be helpful in cluster configurations when all the
53738 members of the cluster restart at once, and may therefore synchronize their
53739 queue processing times.
53740 </para>
53741 </listitem>
53742 </itemizedlist>
53743 <para>
53744 When computing the next retry time, the algorithm definitions are scanned in
53745 order until one whose cutoff time has not yet passed is reached. This is then
53746 used to compute a new retry time that is later than the current time. In the
53747 case of fixed interval retries, this simply means adding the interval to the
53748 current time. For geometrically increasing intervals, retry intervals are
53749 computed from the rule&#x2019;s parameters until one that is greater than the previous
53750 interval is found. The main configuration variable
53751 <indexterm role="concept">
53752 <primary>limit</primary>
53753 <secondary>retry interval</secondary>
53754 </indexterm>
53755 <indexterm role="concept">
53756 <primary>retry</primary>
53757 <secondary>interval, maximum</secondary>
53758 </indexterm>
53759 <indexterm role="option">
53760 <primary><option>retry_interval_max</option></primary>
53761 </indexterm>
53762 <option>retry_interval_max</option> limits the maximum interval between retries. It
53763 cannot be set greater than <literal>24h</literal>, which is its default value.
53764 </para>
53765 <para>
53766 A single remote domain may have a number of hosts associated with it, and each
53767 host may have more than one IP address. Retry algorithms are selected on the
53768 basis of the domain name, but are applied to each IP address independently. If,
53769 for example, a host has two IP addresses and one is unusable, Exim will
53770 generate retry times for it and will not try to use it until its next retry
53771 time comes. Thus the good IP address is likely to be tried first most of the
53772 time.
53773 </para>
53774 <para>
53775 <indexterm role="concept">
53776 <primary>hints database</primary>
53777 <secondary>use for retrying</secondary>
53778 </indexterm>
53779 Retry times are hints rather than promises. Exim does not make any attempt to
53780 run deliveries exactly at the computed times. Instead, a queue runner process
53781 starts delivery processes for delayed messages periodically, and these attempt
53782 new deliveries only for those addresses that have passed their next retry time.
53783 If a new message arrives for a deferred address, an immediate delivery attempt
53784 occurs only if the address has passed its retry time. In the absence of new
53785 messages, the minimum time between retries is the interval between queue runner
53786 processes. There is not much point in setting retry times of five minutes if
53787 your queue runners happen only once an hour, unless there are a significant
53788 number of incoming messages (which might be the case on a system that is
53789 sending everything to a smart host, for example).
53790 </para>
53791 <para>
53792 The data in the retry hints database can be inspected by using the
53793 <emphasis>exim_dumpdb</emphasis> or <emphasis>exim_fixdb</emphasis> utility programs (see chapter
53794 <xref linkend="CHAPutils"/>). The latter utility can also be used to change the data. The
53795 <emphasis>exinext</emphasis> utility script can be used to find out what the next retry times
53796 are for the hosts associated with a particular mail domain, and also for local
53797 deliveries that have been deferred.
53798 </para>
53799 </section>
53800 <section id="SECID164">
53801 <title>Retry rule examples</title>
53802 <para>
53803 Here are some example retry rules:
53804 </para>
53805 <literallayout class="monospaced">
53806 alice@wonderland.fict.example quota_5d  F,7d,3h
53807 wonderland.fict.example       quota_5d
53808 wonderland.fict.example       *         F,1h,15m; G,2d,1h,2;
53809 lookingglass.fict.example     *         F,24h,30m;
53810 *                 refused_A   F,2h,20m;
53811 *                 *           F,2h,15m; G,16h,1h,1.5; F,5d,8h
53812 </literallayout>
53813 <para>
53814 The first rule sets up special handling for mail to
53815 <emphasis>alice@wonderland.fict.example</emphasis> when there is an over-quota error and the
53816 mailbox has not been read for at least 5 days. Retries continue every three
53817 hours for 7 days. The second rule handles over-quota errors for all other local
53818 parts at <emphasis>wonderland.fict.example</emphasis>; the absence of a local part has the same
53819 effect as supplying <quote>*@</quote>. As no retry algorithms are supplied, messages that
53820 fail are bounced immediately if the mailbox has not been read for at least 5
53821 days.
53822 </para>
53823 <para>
53824 The third rule handles all other errors at <emphasis>wonderland.fict.example</emphasis>; retries
53825 happen every 15 minutes for an hour, then with geometrically increasing
53826 intervals until two days have passed since a delivery first failed. After the
53827 first hour there is a delay of one hour, then two hours, then four hours, and
53828 so on (this is a rather extreme example).
53829 </para>
53830 <para>
53831 The fourth rule controls retries for the domain <emphasis>lookingglass.fict.example</emphasis>.
53832 They happen every 30 minutes for 24 hours only. The remaining two rules handle
53833 all other domains, with special action for connection refusal from hosts that
53834 were not obtained from an MX record.
53835 </para>
53836 <para>
53837 The final rule in a retry configuration should always have asterisks in the
53838 first two fields so as to provide a general catch-all for any addresses that do
53839 not have their own special handling. This example tries every 15 minutes for 2
53840 hours, then with intervals starting at one hour and increasing by a factor of
53841 1.5 up to 16 hours, then every 8 hours up to 5 days.
53842 </para>
53843 </section>
53844 <section id="SECID165">
53845 <title>Timeout of retry data</title>
53846 <para>
53847 <indexterm role="concept">
53848 <primary>timeout</primary>
53849 <secondary>of retry data</secondary>
53850 </indexterm>
53851 <indexterm role="option">
53852 <primary><option>retry_data_expire</option></primary>
53853 </indexterm>
53854 <indexterm role="concept">
53855 <primary>hints database</primary>
53856 <secondary>data expiry</secondary>
53857 </indexterm>
53858 <indexterm role="concept">
53859 <primary>retry</primary>
53860 <secondary>timeout of data</secondary>
53861 </indexterm>
53862 Exim timestamps the data that it writes to its retry hints database. When it
53863 consults the data during a delivery it ignores any that is older than the value
53864 set in <option>retry_data_expire</option> (default 7 days). If, for example, a host hasn&#x2019;t
53865 been tried for 7 days, Exim will try to deliver to it immediately a message
53866 arrives, and if that fails, it will calculate a retry time as if it were
53867 failing for the first time.
53868 </para>
53869 <para>
53870 This improves the behaviour for messages routed to rarely-used hosts such as MX
53871 backups. If such a host was down at one time, and happens to be down again when
53872 Exim tries a month later, using the old retry data would imply that it had been
53873 down all the time, which is not a justified assumption.
53874 </para>
53875 <para>
53876 If a host really is permanently dead, this behaviour causes a burst of retries
53877 every now and again, but only if messages routed to it are rare. If there is a
53878 message at least once every 7 days the retry data never expires.
53879 </para>
53880 </section>
53881 <section id="SECID166">
53882 <title>Long-term failures</title>
53883 <para>
53884 <indexterm role="concept">
53885 <primary>delivery failure, long-term</primary>
53886 </indexterm>
53887 <indexterm role="concept">
53888 <primary>retry</primary>
53889 <secondary>after long-term failure</secondary>
53890 </indexterm>
53891 Special processing happens when an email address has been failing for so long
53892 that the cutoff time for the last algorithm is reached. For example, using the
53893 default retry rule:
53894 </para>
53895 <literallayout class="monospaced">
53896 * * F,2h,15m; G,16h,1h,1.5; F,4d,6h
53897 </literallayout>
53898 <para>
53899 the cutoff time is four days. Reaching the retry cutoff is independent of how
53900 long any specific message has been failing; it is the length of continuous
53901 failure for the recipient address that counts.
53902 </para>
53903 <para>
53904 When the cutoff time is reached for a local delivery, or for all the IP
53905 addresses associated with a remote delivery, a subsequent delivery failure
53906 causes Exim to give up on the address, and a bounce message is generated.
53907 In order to cater for new messages that use the failing address, a next retry
53908 time is still computed from the final algorithm, and is used as follows:
53909 </para>
53910 <para>
53911 For local deliveries, one delivery attempt is always made for any subsequent
53912 messages. If this delivery fails, the address fails immediately. The
53913 post-cutoff retry time is not used.
53914 </para>
53915 <para>
53916 <indexterm role="concept">
53917 <primary>final cutoff</primary>
53918 <secondary>retries, controlling</secondary>
53919 </indexterm>
53920 <indexterm role="concept">
53921 <primary>retry</primary>
53922 <secondary>final cutoff</secondary>
53923 </indexterm>
53924 If the delivery is remote, there are two possibilities, controlled by the
53925 <indexterm role="option">
53926 <primary><option>delay_after_cutoff</option></primary>
53927 </indexterm>
53928 <option>delay_after_cutoff</option> option of the <command>smtp</command> transport. The option is true by
53929 default. Until the post-cutoff retry time for one of the IP addresses,
53930 as set by the <option>retry_data_expire</option> option, is
53931 reached, the failing email address is bounced immediately, without a delivery
53932 attempt taking place. After that time, one new delivery attempt is made to
53933 those IP addresses that are past their retry times, and if that still fails,
53934 the address is bounced and new retry times are computed.
53935 </para>
53936 <para>
53937 In other words, when all the hosts for a given email address have been failing
53938 for a long time, Exim bounces rather then defers until one of the hosts&#x2019; retry
53939 times is reached. Then it tries once, and bounces if that attempt fails. This
53940 behaviour ensures that few resources are wasted in repeatedly trying to deliver
53941 to a broken destination, but if the host does recover, Exim will eventually
53942 notice.
53943 </para>
53944 <para>
53945 If <option>delay_after_cutoff</option> is set false, Exim behaves differently. If all IP
53946 addresses are past their final cutoff time, Exim tries to deliver to those IP
53947 addresses that have not been tried since the message arrived. If there are
53948 no suitable IP addresses, or if they all fail, the address is bounced. In other
53949 words, it does not delay when a new message arrives, but tries the expired
53950 addresses immediately, unless they have been tried since the message arrived.
53951 If there is a continuous stream of messages for the failing domains, setting
53952 <option>delay_after_cutoff</option> false means that there will be many more attempts to
53953 deliver to permanently failing IP addresses than when <option>delay_after_cutoff</option> is
53954 true.
53955 </para>
53956 </section>
53957 <section id="SECID167">
53958 <title>Deliveries that work intermittently</title>
53959 <para>
53960 <indexterm role="concept">
53961 <primary>retry</primary>
53962 <secondary>intermittently working deliveries</secondary>
53963 </indexterm>
53964 Some additional logic is needed to cope with cases where a host is
53965 intermittently available, or when a message has some attribute that prevents
53966 its delivery when others to the same address get through. In this situation,
53967 because some messages are successfully delivered, the <quote>retry clock</quote> for the
53968 host or address keeps getting reset by the successful deliveries, and so
53969 failing messages remain in the queue for ever because the cutoff time is never
53970 reached.
53971 </para>
53972 <para>
53973 Two exceptional actions are applied to prevent this happening. The first
53974 applies to errors that are related to a message rather than a remote host.
53975 Section <xref linkend="SECToutSMTPerr"/> has a discussion of the different kinds of error;
53976 examples of message-related errors are 4<emphasis>xx</emphasis> responses to MAIL or DATA
53977 commands, and quota failures. For this type of error, if a message&#x2019;s arrival
53978 time is earlier than the <quote>first failed</quote> time for the error, the earlier time
53979 is used when scanning the retry rules to decide when to try next and when to
53980 time out the address.
53981 </para>
53982 <para>
53983 The exceptional second action applies in all cases. If a message has been on
53984 the queue for longer than the cutoff time of any applicable retry rule for a
53985 given address, a delivery is attempted for that address, even if it is not yet
53986 time, and if this delivery fails, the address is timed out. A new retry time is
53987 not computed in this case, so that other messages for the same address are
53988 considered immediately.
53989 <indexterm role="concept" startref="IIDretconf1" class="endofrange"/>
53990 <indexterm role="concept" startref="IIDregconf2" class="endofrange"/>
53991 </para>
53992 </section>
53993 </chapter>
53994
53995 <chapter id="CHAPSMTPAUTH">
53996 <title>SMTP authentication</title>
53997 <para>
53998 <indexterm role="concept" id="IIDauthconf1" class="startofrange">
53999 <primary>SMTP</primary>
54000 <secondary>authentication configuration</secondary>
54001 </indexterm>
54002 <indexterm role="concept" id="IIDauthconf2" class="startofrange">
54003 <primary>authentication</primary>
54004 </indexterm>
54005 The <quote>authenticators</quote> section of Exim&#x2019;s runtime configuration is concerned
54006 with SMTP authentication. This facility is an extension to the SMTP protocol,
54007 described in RFC 2554, which allows a client SMTP host to authenticate itself
54008 to a server. This is a common way for a server to recognize clients that are
54009 permitted to use it as a relay. SMTP authentication is not of relevance to the
54010 transfer of mail between servers that have no managerial connection with each
54011 other.
54012 </para>
54013 <para>
54014 The name of an authenticator is limited to be 64 ASCII characters long;
54015 prior to Exim 4.95 names would be silently truncated at this length, but now
54016 it is enforced.
54017 </para>
54018 <para>
54019 <indexterm role="concept">
54020 <primary>AUTH</primary>
54021 <secondary>description of</secondary>
54022 </indexterm>
54023 <indexterm role="concept">
54024 <primary>ESMTP extensions</primary>
54025 <secondary>AUTH</secondary>
54026 </indexterm>
54027 Very briefly, the way SMTP authentication works is as follows:
54028 </para>
54029 <itemizedlist>
54030 <listitem>
54031 <para>
54032 The server advertises a number of authentication <emphasis>mechanisms</emphasis> in response to
54033 the client&#x2019;s EHLO command.
54034 </para>
54035 </listitem>
54036 <listitem>
54037 <para>
54038 The client issues an AUTH command, naming a specific mechanism. The command
54039 may, optionally, contain some authentication data.
54040 </para>
54041 </listitem>
54042 <listitem>
54043 <para>
54044 The server may issue one or more <emphasis>challenges</emphasis>, to which the client must send
54045 appropriate responses. In simple authentication mechanisms, the challenges are
54046 just prompts for user names and passwords. The server does not have to issue
54047 any challenges &ndash; in some mechanisms the relevant data may all be transmitted
54048 with the AUTH command.
54049 </para>
54050 </listitem>
54051 <listitem>
54052 <para>
54053 The server either accepts or denies authentication.
54054 </para>
54055 </listitem>
54056 <listitem>
54057 <para>
54058 If authentication succeeds, the client may optionally make use of the AUTH
54059 option on the MAIL command to pass an authenticated sender in subsequent
54060 mail transactions. Authentication lasts for the remainder of the SMTP
54061 connection.
54062 </para>
54063 </listitem>
54064 <listitem>
54065 <para>
54066 If authentication fails, the client may give up, or it may try a different
54067 authentication mechanism, or it may try transferring mail over the
54068 unauthenticated connection.
54069 </para>
54070 </listitem>
54071 </itemizedlist>
54072 <para>
54073 If you are setting up a client, and want to know which authentication
54074 mechanisms the server supports, you can use Telnet to connect to port 25 (the
54075 SMTP port) on the server, and issue an EHLO command. The response to this
54076 includes the list of supported mechanisms. For example:
54077 </para>
54078 <literallayout>
54079 <literal>$ </literal><emphasis role="bold"><literal>telnet server.example 25</literal></emphasis>
54080 <literal>Trying 192.168.34.25...</literal>
54081 <literal>Connected to server.example.</literal>
54082 <literal>Escape character is &#x0027;^]&#x0027;.</literal>
54083 <literal>220 server.example ESMTP Exim 4.20 ...</literal>
54084 <emphasis role="bold"><literal>ehlo client.example</literal></emphasis>
54085 <literal>250-server.example Hello client.example [10.8.4.5]</literal>
54086 <literal>250-SIZE 52428800</literal>
54087 <literal>250-PIPELINING</literal>
54088 <literal>250-AUTH PLAIN</literal>
54089 <literal>250 HELP</literal>
54090 </literallayout>
54091 <para>
54092 The second-last line of this example output shows that the server supports
54093 authentication using the PLAIN mechanism. In Exim, the different authentication
54094 mechanisms are configured by specifying <emphasis>authenticator</emphasis> drivers. Like the
54095 routers and transports, which authenticators are included in the binary is
54096 controlled by build-time definitions. The following are currently available,
54097 included by setting
54098 </para>
54099 <literallayout class="monospaced">
54100 AUTH_CRAM_MD5=yes
54101 AUTH_CYRUS_SASL=yes
54102 AUTH_DOVECOT=yes
54103 AUTH_EXTERNAL=yes
54104 AUTH_GSASL=yes
54105 AUTH_HEIMDAL_GSSAPI=yes
54106 AUTH_PLAINTEXT=yes
54107 AUTH_SPA=yes
54108 AUTH_TLS=yes
54109 </literallayout>
54110 <para>
54111 in <filename>Local/Makefile</filename>, respectively. The first of these supports the CRAM-MD5
54112 authentication mechanism (RFC 2195), and the second provides an interface to
54113 the Cyrus SASL authentication library.
54114 The third is an interface to Dovecot&#x2019;s authentication system, delegating the
54115 work via a socket interface.
54116 The fourth provides for negotiation of authentication done via non-SMTP means,
54117 as defined by RFC 4422 Appendix A.
54118 The fifth provides an interface to the GNU SASL authentication library, which
54119 provides mechanisms but typically not data sources.
54120 The sixth provides direct access to Heimdal GSSAPI, geared for Kerberos, but
54121 supporting setting a server keytab.
54122 The seventh can be configured to support
54123 the PLAIN authentication mechanism (RFC 2595) or the LOGIN mechanism, which is
54124 not formally documented, but used by several MUAs.
54125 The eighth authenticator
54126 supports Microsoft&#x2019;s <emphasis>Secure Password Authentication</emphasis> mechanism.
54127 The last is an Exim authenticator but not an SMTP one;
54128 instead it can use information from a TLS negotiation.
54129 </para>
54130 <para>
54131 The authenticators are configured using the same syntax as other drivers (see
54132 section <xref linkend="SECTfordricon"/>). If no authenticators are required, no
54133 authentication section need be present in the configuration file. Each
54134 authenticator can in principle have both server and client functions. When Exim
54135 is receiving SMTP mail, it is acting as a server; when it is sending out
54136 messages over SMTP, it is acting as a client. Authenticator configuration
54137 options are provided for use in both these circumstances.
54138 </para>
54139 <para>
54140 To make it clear which options apply to which situation, the prefixes
54141 <option>server_</option> and <option>client_</option> are used on option names that are specific to
54142 either the server or the client function, respectively. Server and client
54143 functions are disabled if none of their options are set. If an authenticator is
54144 to be used for both server and client functions, a single definition, using
54145 both sets of options, is required. For example:
54146 </para>
54147 <literallayout class="monospaced">
54148 cram:
54149   driver = cram_md5
54150   public_name = CRAM-MD5
54151   server_secret = ${if eq{$auth1}{ph10}{secret1}fail}
54152   client_name = ph10
54153   client_secret = secret2
54154 </literallayout>
54155 <para>
54156 The <option>server_</option> option is used when Exim is acting as a server, and the
54157 <option>client_</option> options when it is acting as a client.
54158 </para>
54159 <para>
54160 Descriptions of the individual authenticators are given in subsequent chapters.
54161 The remainder of this chapter covers the generic options for the
54162 authenticators, followed by general discussion of the way authentication works
54163 in Exim.
54164 </para>
54165 <para>
54166 <emphasis role="bold">Beware:</emphasis> the meaning of <varname>$auth1</varname>, <varname>$auth2</varname>, ... varies on a per-driver and
54167 per-mechanism basis.  Please read carefully to determine which variables hold
54168 account labels such as usercodes and which hold passwords or other
54169 authenticating data.
54170 </para>
54171 <para>
54172 Note that some mechanisms support two different identifiers for accounts: the
54173 <emphasis>authentication id</emphasis> and the <emphasis>authorization id</emphasis>.  The contractions <emphasis>authn</emphasis>
54174 and <emphasis>authz</emphasis> are commonly encountered.  The American spelling is standard here.
54175 Conceptually, authentication data such as passwords are tied to the identifier
54176 used to authenticate; servers may have rules to permit one user to act as a
54177 second user, so that after login the session is treated as though that second
54178 user had logged in.  That second user is the <emphasis>authorization id</emphasis>.  A robust
54179 configuration might confirm that the <emphasis>authz</emphasis> field is empty or matches the
54180 <emphasis>authn</emphasis> field.  Often this is just ignored.  The <emphasis>authn</emphasis> can be considered
54181 as verified data, the <emphasis>authz</emphasis> as an unverified request which the server might
54182 choose to honour.
54183 </para>
54184 <para>
54185 A <emphasis>realm</emphasis> is a text string, typically a domain name, presented by a server
54186 to a client to help it select an account and credentials to use.  In some
54187 mechanisms, the client and server provably agree on the realm, but clients
54188 typically can not treat the realm as secure data to be blindly trusted.
54189 </para>
54190 <section id="SECID168">
54191 <title>Generic options for authenticators</title>
54192 <para>
54193 <indexterm role="concept">
54194 <primary>authentication</primary>
54195 <secondary>generic options</secondary>
54196 </indexterm>
54197 <indexterm role="concept">
54198 <primary>options</primary>
54199 <secondary>generic; for authenticators</secondary>
54200 </indexterm>
54201 </para>
54202 <para>
54203 <indexterm role="option">
54204 <primary><option>client_condition</option></primary>
54205 </indexterm>
54206 </para>
54207 <informaltable frame="all">
54208 <tgroup cols="4" colsep="0" rowsep="0">
54209 <colspec colwidth="8*" align="left"/>
54210 <colspec colwidth="6*" align="center"/>
54211 <colspec colwidth="6*" align="center"/>
54212 <colspec colwidth="6*" align="right"/>
54213 <tbody>
54214 <row>
54215 <entry><option>client_condition</option></entry>
54216 <entry>Use: <emphasis>authenticators</emphasis></entry>
54217 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54218 <entry>Default: <emphasis>unset</emphasis></entry>
54219 </row>
54220 </tbody>
54221 </tgroup>
54222 </informaltable>
54223 <para>
54224 When Exim is authenticating as a client, it skips any authenticator whose
54225 <option>client_condition</option> expansion yields <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>. This can be
54226 used, for example, to skip plain text authenticators when the connection is not
54227 encrypted by a setting such as:
54228 </para>
54229 <literallayout class="monospaced">
54230 client_condition = ${if !eq{$tls_out_cipher}{}}
54231 </literallayout>
54232 <para>
54233 <indexterm role="option">
54234 <primary><option>client_set_id</option></primary>
54235 </indexterm>
54236 </para>
54237 <informaltable frame="all">
54238 <tgroup cols="4" colsep="0" rowsep="0">
54239 <colspec colwidth="8*" align="left"/>
54240 <colspec colwidth="6*" align="center"/>
54241 <colspec colwidth="6*" align="center"/>
54242 <colspec colwidth="6*" align="right"/>
54243 <tbody>
54244 <row>
54245 <entry><option>client_set_id</option></entry>
54246 <entry>Use: <emphasis>authenticators</emphasis></entry>
54247 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54248 <entry>Default: <emphasis>unset</emphasis></entry>
54249 </row>
54250 </tbody>
54251 </tgroup>
54252 </informaltable>
54253 <para>
54254 When client authentication succeeds, this condition is expanded; the
54255 result is used in the log lines for outbound messages.
54256 Typically it will be the user name used for authentication.
54257 </para>
54258 <para>
54259 <indexterm role="option">
54260 <primary><option>driver</option></primary>
54261 </indexterm>
54262 </para>
54263 <informaltable frame="all">
54264 <tgroup cols="4" colsep="0" rowsep="0">
54265 <colspec colwidth="8*" align="left"/>
54266 <colspec colwidth="6*" align="center"/>
54267 <colspec colwidth="6*" align="center"/>
54268 <colspec colwidth="6*" align="right"/>
54269 <tbody>
54270 <row>
54271 <entry><option>driver</option></entry>
54272 <entry>Use: <emphasis>authenticators</emphasis></entry>
54273 <entry>Type: <emphasis>string</emphasis></entry>
54274 <entry>Default: <emphasis>unset</emphasis></entry>
54275 </row>
54276 </tbody>
54277 </tgroup>
54278 </informaltable>
54279 <para>
54280 This option must always be set. It specifies which of the available
54281 authenticators is to be used.
54282 </para>
54283 <para>
54284 <indexterm role="option">
54285 <primary><option>public_name</option></primary>
54286 </indexterm>
54287 </para>
54288 <informaltable frame="all">
54289 <tgroup cols="4" colsep="0" rowsep="0">
54290 <colspec colwidth="8*" align="left"/>
54291 <colspec colwidth="6*" align="center"/>
54292 <colspec colwidth="6*" align="center"/>
54293 <colspec colwidth="6*" align="right"/>
54294 <tbody>
54295 <row>
54296 <entry><option>public_name</option></entry>
54297 <entry>Use: <emphasis>authenticators</emphasis></entry>
54298 <entry>Type: <emphasis>string</emphasis></entry>
54299 <entry>Default: <emphasis>unset</emphasis></entry>
54300 </row>
54301 </tbody>
54302 </tgroup>
54303 </informaltable>
54304 <para>
54305 This option specifies the name of the authentication mechanism that the driver
54306 implements, and by which it is known to the outside world. These names should
54307 contain only upper case letters, digits, underscores, and hyphens (RFC 2222),
54308 but Exim in fact matches them caselessly. If <option>public_name</option> is not set, it
54309 defaults to the driver&#x2019;s instance name.
54310 </para>
54311 <para>
54312 <indexterm role="option">
54313 <primary><option>server_advertise_condition</option></primary>
54314 </indexterm>
54315 </para>
54316 <informaltable frame="all">
54317 <tgroup cols="4" colsep="0" rowsep="0">
54318 <colspec colwidth="8*" align="left"/>
54319 <colspec colwidth="6*" align="center"/>
54320 <colspec colwidth="6*" align="center"/>
54321 <colspec colwidth="6*" align="right"/>
54322 <tbody>
54323 <row>
54324 <entry><option>server_advertise_condition</option></entry>
54325 <entry>Use: <emphasis>authenticators</emphasis></entry>
54326 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54327 <entry>Default: <emphasis>unset</emphasis></entry>
54328 </row>
54329 </tbody>
54330 </tgroup>
54331 </informaltable>
54332 <para>
54333 When a server is about to advertise an authentication mechanism, the condition
54334 is expanded. If it yields the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the
54335 mechanism is not advertised.
54336 If the expansion fails, the mechanism is not advertised. If the failure was not
54337 forced, and was not caused by a lookup defer, the incident is logged.
54338 See section <xref linkend="SECTauthexiser"/> below for further discussion.
54339 </para>
54340 <para>
54341 <indexterm role="option">
54342 <primary><option>server_condition</option></primary>
54343 </indexterm>
54344 </para>
54345 <informaltable frame="all">
54346 <tgroup cols="4" colsep="0" rowsep="0">
54347 <colspec colwidth="8*" align="left"/>
54348 <colspec colwidth="6*" align="center"/>
54349 <colspec colwidth="6*" align="center"/>
54350 <colspec colwidth="6*" align="right"/>
54351 <tbody>
54352 <row>
54353 <entry><option>server_condition</option></entry>
54354 <entry>Use: <emphasis>authenticators</emphasis></entry>
54355 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54356 <entry>Default: <emphasis>unset</emphasis></entry>
54357 </row>
54358 </tbody>
54359 </tgroup>
54360 </informaltable>
54361 <para>
54362 This option must be set for a <option>plaintext</option> server authenticator, where it
54363 is used directly to control authentication. See section <xref linkend="SECTplainserver"/>
54364 for details.
54365 </para>
54366 <para>
54367 For the <command>gsasl</command> authenticator, this option is required for various
54368 mechanisms; see chapter <xref linkend="CHAPgsasl"/> for details.
54369 </para>
54370 <para>
54371 For the other authenticators, <option>server_condition</option> can be used as an additional
54372 authentication or authorization mechanism that is applied after the other
54373 authenticator conditions succeed. If it is set, it is expanded when the
54374 authenticator would otherwise return a success code. If the expansion is forced
54375 to fail, authentication fails. Any other expansion failure causes a temporary
54376 error code to be returned. If the result of a successful expansion is an empty
54377 string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
54378 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds. For any
54379 other result, a temporary error code is returned, with the expanded string as
54380 the error text.
54381 </para>
54382 <para>
54383 <indexterm role="option">
54384 <primary><option>server_debug_print</option></primary>
54385 </indexterm>
54386 </para>
54387 <informaltable frame="all">
54388 <tgroup cols="4" colsep="0" rowsep="0">
54389 <colspec colwidth="8*" align="left"/>
54390 <colspec colwidth="6*" align="center"/>
54391 <colspec colwidth="6*" align="center"/>
54392 <colspec colwidth="6*" align="right"/>
54393 <tbody>
54394 <row>
54395 <entry><option>server_debug_print</option></entry>
54396 <entry>Use: <emphasis>authenticators</emphasis></entry>
54397 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54398 <entry>Default: <emphasis>unset</emphasis></entry>
54399 </row>
54400 </tbody>
54401 </tgroup>
54402 </informaltable>
54403 <para>
54404 If this option is set and authentication debugging is enabled (see the <option>-d</option>
54405 command line option), the string is expanded and included in the debugging
54406 output when the authenticator is run as a server. This can help with checking
54407 out the values of variables.
54408 If expansion of the string fails, the error message is written to the debugging
54409 output, and Exim carries on processing.
54410 </para>
54411 <para>
54412 <indexterm role="option">
54413 <primary><option>server_set_id</option></primary>
54414 </indexterm>
54415 </para>
54416 <informaltable frame="all">
54417 <tgroup cols="4" colsep="0" rowsep="0">
54418 <colspec colwidth="8*" align="left"/>
54419 <colspec colwidth="6*" align="center"/>
54420 <colspec colwidth="6*" align="center"/>
54421 <colspec colwidth="6*" align="right"/>
54422 <tbody>
54423 <row>
54424 <entry><option>server_set_id</option></entry>
54425 <entry>Use: <emphasis>authenticators</emphasis></entry>
54426 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54427 <entry>Default: <emphasis>unset</emphasis></entry>
54428 </row>
54429 </tbody>
54430 </tgroup>
54431 </informaltable>
54432 <para>
54433 <indexterm role="variable">
54434 <primary><varname>$authenticated_id</varname></primary>
54435 </indexterm>
54436 <indexterm role="variable">
54437 <primary><varname>$authenticated_fail_id</varname></primary>
54438 </indexterm>
54439 When an Exim server successfully authenticates a client, this string is
54440 expanded using data from the authentication, and preserved for any incoming
54441 messages in the variable <varname>$authenticated_id</varname>. It is also included in the log
54442 lines for incoming messages. For example, a user/password authenticator
54443 configuration might preserve the user name that was used to authenticate, and
54444 refer to it subsequently during delivery of the message.
54445 On a failing authentication the expansion result is instead saved in
54446 the <varname>$authenticated_fail_id</varname> variable.
54447 If expansion fails, the option is ignored.
54448 </para>
54449 <para>
54450 <indexterm role="option">
54451 <primary><option>server_mail_auth_condition</option></primary>
54452 </indexterm>
54453 </para>
54454 <informaltable frame="all">
54455 <tgroup cols="4" colsep="0" rowsep="0">
54456 <colspec colwidth="8*" align="left"/>
54457 <colspec colwidth="6*" align="center"/>
54458 <colspec colwidth="6*" align="center"/>
54459 <colspec colwidth="6*" align="right"/>
54460 <tbody>
54461 <row>
54462 <entry><option>server_mail_auth_condition</option></entry>
54463 <entry>Use: <emphasis>authenticators</emphasis></entry>
54464 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54465 <entry>Default: <emphasis>unset</emphasis></entry>
54466 </row>
54467 </tbody>
54468 </tgroup>
54469 </informaltable>
54470 <para>
54471 This option allows a server to discard authenticated sender addresses supplied
54472 as part of MAIL commands in SMTP connections that are authenticated by the
54473 driver on which <option>server_mail_auth_condition</option> is set. The option is not used
54474 as part of the authentication process; instead its (unexpanded) value is
54475 remembered for later use.
54476 How it is used is described in the following section.
54477 </para>
54478 </section>
54479 <section id="SECTauthparamail">
54480 <title>The AUTH parameter on MAIL commands</title>
54481 <para>
54482 <indexterm role="concept">
54483 <primary>authentication</primary>
54484 <secondary>sender; authenticated</secondary>
54485 </indexterm>
54486 <indexterm role="concept">
54487 <primary>AUTH</primary>
54488 <secondary>on MAIL command</secondary>
54489 </indexterm>
54490 When a client supplied an AUTH= item on a MAIL command, Exim applies
54491 the following checks before accepting it as the authenticated sender of the
54492 message:
54493 </para>
54494 <itemizedlist>
54495 <listitem>
54496 <para>
54497 If the connection is not using extended SMTP (that is, HELO was used rather
54498 than EHLO), the use of AUTH= is a syntax error.
54499 </para>
54500 </listitem>
54501 <listitem>
54502 <para>
54503 If the value of the AUTH= parameter is <quote>&lt;&gt;</quote>, it is ignored.
54504 </para>
54505 </listitem>
54506 <listitem>
54507 <para>
54508 <indexterm role="variable">
54509 <primary><varname>$authenticated_sender</varname></primary>
54510 </indexterm>
54511 If <option>acl_smtp_mailauth</option> is defined, the ACL it specifies is run. While it is
54512 running, the value of <varname>$authenticated_sender</varname> is set to the value obtained
54513 from the AUTH= parameter. If the ACL does not yield <quote>accept</quote>, the value of
54514 <varname>$authenticated_sender</varname> is deleted. The <option>acl_smtp_mailauth</option> ACL may not
54515 return <quote>drop</quote> or <quote>discard</quote>. If it defers, a temporary error code (451) is
54516 given for the MAIL command.
54517 </para>
54518 </listitem>
54519 <listitem>
54520 <para>
54521 If <option>acl_smtp_mailauth</option> is not defined, the value of the AUTH= parameter
54522 is accepted and placed in <varname>$authenticated_sender</varname> only if the client has
54523 authenticated.
54524 </para>
54525 </listitem>
54526 <listitem>
54527 <para>
54528 If the AUTH= value was accepted by either of the two previous rules, and
54529 the client has authenticated, and the authenticator has a setting for the
54530 <option>server_mail_auth_condition</option>, the condition is checked at this point. The
54531 valued that was saved from the authenticator is expanded. If the expansion
54532 fails, or yields an empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, the value of
54533 <varname>$authenticated_sender</varname> is deleted. If the expansion yields any other value,
54534 the value of <varname>$authenticated_sender</varname> is retained and passed on with the
54535 message.
54536 </para>
54537 </listitem>
54538 </itemizedlist>
54539 <para>
54540 When <varname>$authenticated_sender</varname> is set for a message, it is passed on to other
54541 hosts to which Exim authenticates as a client. Do not confuse this value with
54542 <varname>$authenticated_id</varname>, which is a string obtained from the authentication
54543 process, and which is not usually a complete email address.
54544 </para>
54545 <para>
54546 <indexterm role="variable">
54547 <primary><varname>$sender_address</varname></primary>
54548 </indexterm>
54549 Whenever an AUTH= value is ignored, the incident is logged. The ACL for
54550 MAIL, if defined, is run after AUTH= is accepted or ignored. It can
54551 therefore make use of <varname>$authenticated_sender</varname>. The converse is not true: the
54552 value of <varname>$sender_address</varname> is not yet set up when the <option>acl_smtp_mailauth</option>
54553 ACL is run.
54554 </para>
54555 </section>
54556 <section id="SECTauthexiser">
54557 <title>Authentication on an Exim server</title>
54558 <para>
54559 <indexterm role="concept">
54560 <primary>authentication</primary>
54561 <secondary>on an Exim server</secondary>
54562 </indexterm>
54563 When Exim receives an EHLO command, it advertises the public names of those
54564 authenticators that are configured as servers, subject to the following
54565 conditions:
54566 </para>
54567 <itemizedlist>
54568 <listitem>
54569 <para>
54570 The client host must match <option>auth_advertise_hosts</option> (default *).
54571 </para>
54572 </listitem>
54573 <listitem>
54574 <para>
54575 If the <option>server_advertise_condition</option> option is set, its expansion must not
54576 yield the empty string, <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>.
54577 </para>
54578 </listitem>
54579 </itemizedlist>
54580 <para>
54581 The order in which the authenticators are defined controls the order in which
54582 the mechanisms are advertised.
54583 </para>
54584 <para>
54585 Some mail clients (for example, some versions of Netscape) require the user to
54586 provide a name and password for authentication whenever AUTH is advertised,
54587 even though authentication may not in fact be needed (for example, Exim may be
54588 set up to allow unconditional relaying from the client by an IP address check).
54589 You can make such clients more friendly by not advertising AUTH to them.
54590 For example, if clients on the 10.9.8.0/24 network are permitted (by the ACL
54591 that runs for RCPT) to relay without authentication, you should set
54592 </para>
54593 <literallayout class="monospaced">
54594 auth_advertise_hosts = ! 10.9.8.0/24
54595 </literallayout>
54596 <para>
54597 so that no authentication mechanisms are advertised to them.
54598 </para>
54599 <para>
54600 The <option>server_advertise_condition</option> controls the advertisement of individual
54601 authentication mechanisms. For example, it can be used to restrict the
54602 advertisement of a particular mechanism to encrypted connections, by a setting
54603 such as:
54604 </para>
54605 <literallayout class="monospaced">
54606 server_advertise_condition = ${if eq{$tls_in_cipher}{}{no}{yes}}
54607 </literallayout>
54608 <para>
54609 <indexterm role="variable">
54610 <primary><varname>$tls_in_cipher</varname></primary>
54611 </indexterm>
54612 If the session is encrypted, <varname>$tls_in_cipher</varname> is not empty, and so the expansion
54613 yields <quote>yes</quote>, which allows the advertisement to happen.
54614 </para>
54615 <para>
54616 When an Exim server receives an AUTH command from a client, it rejects it
54617 immediately if AUTH was not advertised in response to an earlier EHLO
54618 command. This is the case if
54619 </para>
54620 <itemizedlist>
54621 <listitem>
54622 <para>
54623 The client host does not match <option>auth_advertise_hosts</option>; or
54624 </para>
54625 </listitem>
54626 <listitem>
54627 <para>
54628 No authenticators are configured with server options; or
54629 </para>
54630 </listitem>
54631 <listitem>
54632 <para>
54633 Expansion of <option>server_advertise_condition</option> blocked the advertising of all the
54634 server authenticators.
54635 </para>
54636 </listitem>
54637 </itemizedlist>
54638 <para>
54639 Otherwise, Exim runs the ACL specified by <option>acl_smtp_auth</option> in order
54640 to decide whether to accept the command. If <option>acl_smtp_auth</option> is not set,
54641 AUTH is accepted from any client host.
54642 </para>
54643 <para>
54644 If AUTH is not rejected by the ACL, Exim searches its configuration for a
54645 server authentication mechanism that was advertised in response to EHLO and
54646 that matches the one named in the AUTH command. If it finds one, it runs
54647 the appropriate authentication protocol, and authentication either succeeds or
54648 fails. If there is no matching advertised mechanism, the AUTH command is
54649 rejected with a 504 error.
54650 </para>
54651 <para>
54652 <indexterm role="variable">
54653 <primary><varname>$received_protocol</varname></primary>
54654 </indexterm>
54655 <indexterm role="variable">
54656 <primary><varname>$sender_host_authenticated</varname></primary>
54657 </indexterm>
54658 When a message is received from an authenticated host, the value of
54659 <varname>$received_protocol</varname> is set to <quote>esmtpa</quote> or <quote>esmtpsa</quote> instead of <quote>esmtp</quote>
54660 or <quote>esmtps</quote>, and <varname>$sender_host_authenticated</varname> contains the name (not the
54661 public name) of the authenticator driver that successfully authenticated the
54662 client from which the message was received. This variable is empty if there was
54663 no successful authentication.
54664 </para>
54665 <para>
54666 <indexterm role="concept">
54667 <primary>authentication</primary>
54668 <secondary>expansion item</secondary>
54669 </indexterm>
54670 Successful authentication sets up information used by the
54671 <option>authresults</option> expansion item.
54672 </para>
54673 </section>
54674 <section id="SECID169">
54675 <title>Testing server authentication</title>
54676 <para>
54677 <indexterm role="concept">
54678 <primary>authentication</primary>
54679 <secondary>testing a server</secondary>
54680 </indexterm>
54681 <indexterm role="concept">
54682 <primary>AUTH</primary>
54683 <secondary>testing a server</secondary>
54684 </indexterm>
54685 <indexterm role="concept">
54686 <primary>base64 encoding</primary>
54687 <secondary>creating authentication test data</secondary>
54688 </indexterm>
54689 Exim&#x2019;s <option>-bh</option> option can be useful for testing server authentication
54690 configurations. The data for the AUTH command has to be sent using base64
54691 encoding. A quick way to produce such data for testing is the following Perl
54692 script:
54693 </para>
54694 <literallayout class="monospaced">
54695 use MIME::Base64;
54696 printf ("%s", encode_base64(eval "\"$ARGV[0]\""));
54697 </literallayout>
54698 <para>
54699 <indexterm role="concept">
54700 <primary>binary zero</primary>
54701 <secondary>in authentication data</secondary>
54702 </indexterm>
54703 This interprets its argument as a Perl string, and then encodes it. The
54704 interpretation as a Perl string allows binary zeros, which are required for
54705 some kinds of authentication, to be included in the data. For example, a
54706 command line to run this script on such data might be
54707 </para>
54708 <literallayout class="monospaced">
54709 encode '\0user\0password'
54710 </literallayout>
54711 <para>
54712 Note the use of single quotes to prevent the shell interpreting the
54713 backslashes, so that they can be interpreted by Perl to specify characters
54714 whose code value is zero.
54715 </para>
54716 <para>
54717 <emphasis role="bold">Warning 1</emphasis>: If either of the user or password strings starts with an octal
54718 digit, you must use three zeros instead of one after the leading backslash. If
54719 you do not, the octal digit that starts your string will be incorrectly
54720 interpreted as part of the code for the first character.
54721 </para>
54722 <para>
54723 <emphasis role="bold">Warning 2</emphasis>: If there are characters in the strings that Perl interprets
54724 specially, you must use a Perl escape to prevent them being misinterpreted. For
54725 example, a command such as
54726 </para>
54727 <literallayout class="monospaced">
54728 encode '\0user@domain.com\0pas$$word'
54729 </literallayout>
54730 <para>
54731 gives an incorrect answer because of the unescaped <quote>@</quote> and <quote>$</quote> characters.
54732 </para>
54733 <para>
54734 If you have the <option>mimencode</option> command installed, another way to produce
54735 base64-encoded strings is to run the command
54736 </para>
54737 <literallayout class="monospaced">
54738 echo -e -n `\0user\0password' | mimencode
54739 </literallayout>
54740 <para>
54741 The <option>-e</option> option of <option>echo</option> enables the interpretation of backslash escapes
54742 in the argument, and the <option>-n</option> option specifies no newline at the end of its
54743 output. However, not all versions of <option>echo</option> recognize these options, so you
54744 should check your version before relying on this suggestion.
54745 </para>
54746 </section>
54747 <section id="SECID170">
54748 <title>Authentication by an Exim client</title>
54749 <para>
54750 <indexterm role="concept">
54751 <primary>authentication</primary>
54752 <secondary>on an Exim client</secondary>
54753 </indexterm>
54754 The <command>smtp</command> transport has two options called <option>hosts_require_auth</option> and
54755 <option>hosts_try_auth</option>. When the <command>smtp</command> transport connects to a server that
54756 announces support for authentication, and the host matches an entry in either
54757 of these options, Exim (as a client) tries to authenticate as follows:
54758 </para>
54759 <itemizedlist>
54760 <listitem>
54761 <para>
54762 For each authenticator that is configured as a client, in the order in which
54763 they are defined in the configuration, it searches the authentication
54764 mechanisms announced by the server for one whose name matches the public name
54765 of the authenticator.
54766 </para>
54767 </listitem>
54768 <listitem>
54769 <para>
54770 <indexterm role="variable">
54771 <primary><varname>$host</varname></primary>
54772 </indexterm>
54773 <indexterm role="variable">
54774 <primary><varname>$host_address</varname></primary>
54775 </indexterm>
54776 When it finds one that matches, it runs the authenticator&#x2019;s client code. The
54777 variables <varname>$host</varname> and <varname>$host_address</varname> are available for any string expansions
54778 that the client might do. They are set to the server&#x2019;s name and IP address. If
54779 any expansion is forced to fail, the authentication attempt is abandoned, and
54780 Exim moves on to the next authenticator. Otherwise an expansion failure causes
54781 delivery to be deferred.
54782 </para>
54783 </listitem>
54784 <listitem>
54785 <para>
54786 If the result of the authentication attempt is a temporary error or a timeout,
54787 Exim abandons trying to send the message to the host for the moment. It will
54788 try again later. If there are any backup hosts available, they are tried in the
54789 usual way.
54790 </para>
54791 </listitem>
54792 <listitem>
54793 <para>
54794 If the response to authentication is a permanent error (5<emphasis>xx</emphasis> code), Exim
54795 carries on searching the list of authenticators and tries another one if
54796 possible. If all authentication attempts give permanent errors, or if there are
54797 no attempts because no mechanisms match (or option expansions force failure),
54798 what happens depends on whether the host matches <option>hosts_require_auth</option> or
54799 <option>hosts_try_auth</option>. In the first case, a temporary error is generated, and
54800 delivery is deferred. The error can be detected in the retry rules, and thereby
54801 turned into a permanent error if you wish. In the second case, Exim tries to
54802 deliver the message unauthenticated.
54803 </para>
54804 </listitem>
54805 </itemizedlist>
54806 <para>
54807 Note that the hostlist test for whether to do authentication can be
54808 confused if name-IP lookups change between the time the peer is decided
54809 upon and the time that the transport runs.  For example, with a manualroute
54810 router given a host name, and with DNS "round-robin" used by that name: if
54811 the local resolver cache times out between the router and the transport
54812 running, the transport may get an IP for the name for its authentication
54813 check which does not match the connection peer IP.
54814 No authentication will then be done, despite the names being identical.
54815 </para>
54816 <para>
54817 For such cases use a separate transport which always authenticates.
54818 </para>
54819 <para>
54820 <indexterm role="concept">
54821 <primary>AUTH</primary>
54822 <secondary>on MAIL command</secondary>
54823 </indexterm>
54824 When Exim has authenticated itself to a remote server, it adds the AUTH
54825 parameter to the MAIL commands it sends, if it has an authenticated sender for
54826 the message. If the message came from a remote host, the authenticated sender
54827 is the one that was receiving on an incoming MAIL command, provided that the
54828 incoming connection was authenticated and the <option>server_mail_auth</option> condition
54829 allowed the authenticated sender to be retained. If a local process calls Exim
54830 to send a message, the sender address that is built from the login name and
54831 <option>qualify_domain</option> is treated as authenticated. However, if the
54832 <option>authenticated_sender</option> option is set on the <command>smtp</command> transport, it overrides
54833 the authenticated sender that was received with the message.
54834 <indexterm role="concept" startref="IIDauthconf1" class="endofrange"/>
54835 <indexterm role="concept" startref="IIDauthconf2" class="endofrange"/>
54836 </para>
54837 </section>
54838 </chapter>
54839
54840 <chapter id="CHAPplaintext">
54841 <title>The plaintext authenticator</title>
54842 <para>
54843 <indexterm role="concept" id="IIDplaiauth1" class="startofrange">
54844 <primary><command>plaintext</command> authenticator</primary>
54845 </indexterm>
54846 <indexterm role="concept" id="IIDplaiauth2" class="startofrange">
54847 <primary>authenticators</primary>
54848 <secondary><command>plaintext</command></secondary>
54849 </indexterm>
54850 The <command>plaintext</command> authenticator can be configured to support the PLAIN and
54851 LOGIN authentication mechanisms, both of which transfer authentication data as
54852 plain (unencrypted) text (though base64 encoded). The use of plain text is a
54853 security risk; you are strongly advised to insist on the use of SMTP encryption
54854 (see chapter <xref linkend="CHAPTLS"/>) if you use the PLAIN or LOGIN mechanisms. If you do
54855 use unencrypted plain text, you should not use the same passwords for SMTP
54856 connections as you do for login accounts.
54857 </para>
54858 <section id="SECTplain_TLS">
54859 <title>Avoiding cleartext use</title>
54860 <para>
54861 The following generic option settings will disable <command>plaintext</command> authenticators when
54862 TLS is not being used:
54863 </para>
54864 <literallayout class="monospaced">
54865   server_advertise_condition = ${if def:tls_in_cipher }
54866   client_condition =           ${if def:tls_out_cipher}
54867 </literallayout>
54868 <para>
54869 <emphasis role="bold">Note</emphasis>: a plaintext SMTP AUTH done inside TLS is not vulnerable to casual snooping,
54870 but is still vulnerable to a Man In The Middle attack unless certificates
54871 (including their names) have been properly verified.
54872 </para>
54873 </section>
54874 <section id="SECID171">
54875 <title>Plaintext server options</title>
54876 <para>
54877 <indexterm role="concept">
54878 <primary>options</primary>
54879 <secondary><command>plaintext</command> authenticator (server)</secondary>
54880 </indexterm>
54881 When configured as a server, <command>plaintext</command> uses the following options:
54882 </para>
54883 <para>
54884 <indexterm role="option">
54885 <primary><option>server_condition</option></primary>
54886 </indexterm>
54887 </para>
54888 <informaltable frame="all">
54889 <tgroup cols="4" colsep="0" rowsep="0">
54890 <colspec colwidth="8*" align="left"/>
54891 <colspec colwidth="6*" align="center"/>
54892 <colspec colwidth="6*" align="center"/>
54893 <colspec colwidth="6*" align="right"/>
54894 <tbody>
54895 <row>
54896 <entry><option>server_condition</option></entry>
54897 <entry>Use: <emphasis>authenticators</emphasis></entry>
54898 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
54899 <entry>Default: <emphasis>unset</emphasis></entry>
54900 </row>
54901 </tbody>
54902 </tgroup>
54903 </informaltable>
54904 <para>
54905 This is actually a global authentication option, but it must be set in order to
54906 configure the <command>plaintext</command> driver as a server. Its use is described below.
54907 </para>
54908 <para>
54909 <indexterm role="option">
54910 <primary><option>server_prompts</option></primary>
54911 </indexterm>
54912 </para>
54913 <informaltable frame="all">
54914 <tgroup cols="4" colsep="0" rowsep="0">
54915 <colspec colwidth="8*" align="left"/>
54916 <colspec colwidth="6*" align="center"/>
54917 <colspec colwidth="6*" align="center"/>
54918 <colspec colwidth="6*" align="right"/>
54919 <tbody>
54920 <row>
54921 <entry><option>server_prompts</option></entry>
54922 <entry>Use: <emphasis>plaintext</emphasis></entry>
54923 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
54924 <entry>Default: <emphasis>unset</emphasis></entry>
54925 </row>
54926 </tbody>
54927 </tgroup>
54928 </informaltable>
54929 <para>
54930 The contents of this option, after expansion, must be a colon-separated list of
54931 prompt strings. If expansion fails, a temporary authentication rejection is
54932 given.
54933 </para>
54934 </section>
54935 <section id="SECTplainserver">
54936 <title>Using plaintext in a server</title>
54937 <para>
54938 <indexterm role="concept">
54939 <primary>AUTH</primary>
54940 <secondary>in <command>plaintext</command> authenticator</secondary>
54941 </indexterm>
54942 <indexterm role="concept">
54943 <primary>binary zero</primary>
54944 <secondary>in <command>plaintext</command> authenticator</secondary>
54945 </indexterm>
54946 <indexterm role="concept">
54947 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
54948 <secondary>in <command>plaintext</command> authenticator</secondary>
54949 </indexterm>
54950 <indexterm role="variable">
54951 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
54952 </indexterm>
54953 <indexterm role="concept">
54954 <primary>base64 encoding</primary>
54955 <secondary>in <command>plaintext</command> authenticator</secondary>
54956 </indexterm>
54957 </para>
54958 <para>
54959 When running as a server, <command>plaintext</command> performs the authentication test by
54960 expanding a string. The data sent by the client with the AUTH command, or in
54961 response to subsequent prompts, is base64 encoded, and so may contain any byte
54962 values when decoded. If any data is supplied with the command, it is treated as
54963 a list of strings, separated by NULs (binary zeros), the first three of which
54964 are placed in the expansion variables <varname>$auth1</varname>, <varname>$auth2</varname>, and <varname>$auth3</varname>
54965 (neither LOGIN nor PLAIN uses more than three strings).
54966 </para>
54967 <para>
54968 For compatibility with previous releases of Exim, the values are also placed in
54969 the expansion variables <varname>$1</varname>, <varname>$2</varname>, and <varname>$3</varname>. However, the use of these
54970 variables for this purpose is now deprecated, as it can lead to confusion in
54971 string expansions that also use them for other things.
54972 </para>
54973 <para>
54974 If there are more strings in <option>server_prompts</option> than the number of strings
54975 supplied with the AUTH command, the remaining prompts are used to obtain more
54976 data. Each response from the client may be a list of NUL-separated strings.
54977 </para>
54978 <para>
54979 <indexterm role="variable">
54980 <primary><varname>$authenticated_id</varname></primary>
54981 </indexterm>
54982 Once a sufficient number of data strings have been received,
54983 <option>server_condition</option> is expanded. If the expansion is forced to fail,
54984 authentication fails. Any other expansion failure causes a temporary error code
54985 to be returned. If the result of a successful expansion is an empty string,
54986 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
54987 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
54988 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
54989 For any other result, a temporary error code is returned, with the expanded
54990 string as the error text.
54991 </para>
54992 <para>
54993 <emphasis role="bold">Warning</emphasis>: If you use a lookup in the expansion to find the user&#x2019;s
54994 password, be sure to make the authentication fail if the user is unknown.
54995 There are good and bad examples at the end of the next section.
54996 </para>
54997 </section>
54998 <section id="SECID172">
54999 <title>The PLAIN authentication mechanism</title>
55000 <para>
55001 <indexterm role="concept">
55002 <primary>PLAIN authentication mechanism</primary>
55003 </indexterm>
55004 <indexterm role="concept">
55005 <primary>authentication</primary>
55006 <secondary>PLAIN</secondary>
55007 </indexterm>
55008 <indexterm role="concept">
55009 <primary>binary zero</primary>
55010 <secondary>in <command>plaintext</command> authenticator</secondary>
55011 </indexterm>
55012 The PLAIN authentication mechanism (RFC 2595) specifies that three strings be
55013 sent as one item of data (that is, one combined string containing two NUL
55014 separators). The data is sent either as part of the AUTH command, or
55015 subsequently in response to an empty prompt from the server.
55016 </para>
55017 <para>
55018 The second and third strings are a user name and a corresponding password.
55019 Using a single fixed user name and password as an example, this could be
55020 configured as follows:
55021 </para>
55022 <literallayout class="monospaced">
55023 fixed_plain:
55024   driver = plaintext
55025   public_name = PLAIN
55026   server_prompts = :
55027   server_condition = \
55028     ${if and {{eq{$auth2}{username}}{eq{$auth3}{mysecret}}}}
55029   server_set_id = $auth2
55030 </literallayout>
55031 <para>
55032 Note that the default result strings from <option>if</option> (<quote>true</quote> or an empty string)
55033 are exactly what we want here, so they need not be specified. Obviously, if the
55034 password contains expansion-significant characters such as dollar, backslash,
55035 or closing brace, they have to be escaped.
55036 </para>
55037 <para>
55038 The <option>server_prompts</option> setting specifies a single, empty prompt (empty items at
55039 the end of a string list are ignored). If all the data comes as part of the
55040 AUTH command, as is commonly the case, the prompt is not used. This
55041 authenticator is advertised in the response to EHLO as
55042 </para>
55043 <literallayout class="monospaced">
55044 250-AUTH PLAIN
55045 </literallayout>
55046 <para>
55047 and a client host can authenticate itself by sending the command
55048 </para>
55049 <literallayout class="monospaced">
55050 AUTH PLAIN AHVzZXJuYW1lAG15c2VjcmV0
55051 </literallayout>
55052 <para>
55053 As this contains three strings (more than the number of prompts), no further
55054 data is required from the client. Alternatively, the client may just send
55055 </para>
55056 <literallayout class="monospaced">
55057 AUTH PLAIN
55058 </literallayout>
55059 <para>
55060 to initiate authentication, in which case the server replies with an empty
55061 prompt. The client must respond with the combined data string.
55062 </para>
55063 <para>
55064 The data string is base64 encoded, as required by the RFC. This example,
55065 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;
55066 represents a zero byte. This is split up into three strings, the first of which
55067 is empty. The <option>server_condition</option> option in the authenticator checks that the
55068 second two are <literal>username</literal> and <literal>mysecret</literal> respectively.
55069 </para>
55070 <para>
55071 Having just one fixed user name and password, as in this example, is not very
55072 realistic, though for a small organization with only a handful of
55073 authenticating clients it could make sense.
55074 </para>
55075 <para>
55076 A more sophisticated instance of this authenticator could use the user name in
55077 <varname>$auth2</varname> to look up a password in a file or database, and maybe do an encrypted
55078 comparison (see <option>crypteq</option> in chapter <xref linkend="CHAPexpand"/>). Here is a example of
55079 this approach, where the passwords are looked up in a DBM file. <emphasis role="bold">Warning</emphasis>:
55080 This is an incorrect example:
55081 </para>
55082 <literallayout class="monospaced">
55083 server_condition = \
55084   ${if eq{$auth3}{${lookup{$auth2}dbm{/etc/authpwd}}}}
55085 </literallayout>
55086 <para>
55087 The expansion uses the user name (<varname>$auth2</varname>) as the key to look up a password,
55088 which it then compares to the supplied password (<varname>$auth3</varname>). Why is this example
55089 incorrect? It works fine for existing users, but consider what happens if a
55090 non-existent user name is given. The lookup fails, but as no success/failure
55091 strings are given for the lookup, it yields an empty string. Thus, to defeat
55092 the authentication, all a client has to do is to supply a non-existent user
55093 name and an empty password. The correct way of writing this test is:
55094 </para>
55095 <literallayout class="monospaced">
55096 server_condition = ${lookup{$auth2}dbm{/etc/authpwd}\
55097   {${if eq{$value}{$auth3}}} {false}}
55098 </literallayout>
55099 <para>
55100 In this case, if the lookup succeeds, the result is checked; if the lookup
55101 fails, <quote>false</quote> is returned and authentication fails. If <option>crypteq</option> is being
55102 used instead of <option>eq</option>, the first example is in fact safe, because <option>crypteq</option>
55103 always fails if its second argument is empty. However, the second way of
55104 writing the test makes the logic clearer.
55105 </para>
55106 </section>
55107 <section id="SECID173">
55108 <title>The LOGIN authentication mechanism</title>
55109 <para>
55110 <indexterm role="concept">
55111 <primary>LOGIN authentication mechanism</primary>
55112 </indexterm>
55113 <indexterm role="concept">
55114 <primary>authentication</primary>
55115 <secondary>LOGIN</secondary>
55116 </indexterm>
55117 The LOGIN authentication mechanism is not documented in any RFC, but is in use
55118 in a number of programs. No data is sent with the AUTH command. Instead, a
55119 user name and password are supplied separately, in response to prompts. The
55120 plaintext authenticator can be configured to support this as in this example:
55121 </para>
55122 <literallayout class="monospaced">
55123 fixed_login:
55124   driver = plaintext
55125   public_name = LOGIN
55126   server_prompts = User Name : Password
55127   server_condition = \
55128     ${if and {{eq{$auth1}{username}}{eq{$auth2}{mysecret}}}}
55129   server_set_id = $auth1
55130 </literallayout>
55131 <para>
55132 Because of the way plaintext operates, this authenticator accepts data supplied
55133 with the AUTH command (in contravention of the specification of LOGIN), but
55134 if the client does not supply it (as is the case for LOGIN clients), the prompt
55135 strings are used to obtain two data items.
55136 </para>
55137 <para>
55138 Some clients are very particular about the precise text of the prompts. For
55139 example, Outlook Express is reported to recognize only <quote>Username:</quote> and
55140 <quote>Password:</quote>. Here is an example of a LOGIN authenticator that uses those
55141 strings. It uses the <option>ldapauth</option> expansion condition to check the user
55142 name and password by binding to an LDAP server:
55143 </para>
55144 <literallayout class="monospaced">
55145 login:
55146   driver = plaintext
55147   public_name = LOGIN
55148   server_prompts = Username:: : Password::
55149   server_condition = ${if and{{ \
55150     !eq{}{$auth1} }{ \
55151     ldapauth{\
55152       user="uid=${quote_ldap_dn:$auth1},ou=people,o=example.org" \
55153       pass=${quote:$auth2} \
55154       ldap://ldap.example.org/} }} }
55155   server_set_id = uid=$auth1,ou=people,o=example.org
55156 </literallayout>
55157 <para>
55158 We have to check that the username is not empty before using it, because LDAP
55159 does not permit empty DN components. We must also use the <option>quote_ldap_dn</option>
55160 operator to correctly quote the DN for authentication. However, the basic
55161 <option>quote</option> operator, rather than any of the LDAP quoting operators, is the
55162 correct one to use for the password, because quoting is needed only to make
55163 the password conform to the Exim syntax. At the LDAP level, the password is an
55164 uninterpreted string.
55165 </para>
55166 </section>
55167 <section id="SECID174">
55168 <title>Support for different kinds of authentication</title>
55169 <para>
55170 A number of string expansion features are provided for the purpose of
55171 interfacing to different ways of user authentication. These include checking
55172 traditionally encrypted passwords from <filename>/etc/passwd</filename> (or equivalent), PAM,
55173 Radius, <option>ldapauth</option>, <emphasis>pwcheck</emphasis>, and <emphasis>saslauthd</emphasis>. For details see section
55174 <xref linkend="SECTexpcond"/>.
55175 </para>
55176 </section>
55177 <section id="SECID175">
55178 <title>Using plaintext in a client</title>
55179 <para>
55180 <indexterm role="concept">
55181 <primary>options</primary>
55182 <secondary><command>plaintext</command> authenticator (client)</secondary>
55183 </indexterm>
55184 The <command>plaintext</command> authenticator has two client options:
55185 </para>
55186 <para>
55187 <indexterm role="option">
55188 <primary><option>client_ignore_invalid_base64</option></primary>
55189 </indexterm>
55190 </para>
55191 <informaltable frame="all">
55192 <tgroup cols="4" colsep="0" rowsep="0">
55193 <colspec colwidth="8*" align="left"/>
55194 <colspec colwidth="6*" align="center"/>
55195 <colspec colwidth="6*" align="center"/>
55196 <colspec colwidth="6*" align="right"/>
55197 <tbody>
55198 <row>
55199 <entry><option>client_ignore_invalid_base64</option></entry>
55200 <entry>Use: <emphasis>plaintext</emphasis></entry>
55201 <entry>Type: <emphasis>boolean</emphasis></entry>
55202 <entry>Default: <emphasis>false</emphasis></entry>
55203 </row>
55204 </tbody>
55205 </tgroup>
55206 </informaltable>
55207 <para>
55208 If the client receives a server prompt that is not a valid base64 string,
55209 authentication is abandoned by default. However, if this option is set true,
55210 the error in the challenge is ignored and the client sends the response as
55211 usual.
55212 </para>
55213 <para>
55214 <indexterm role="option">
55215 <primary><option>client_send</option></primary>
55216 </indexterm>
55217 </para>
55218 <informaltable frame="all">
55219 <tgroup cols="4" colsep="0" rowsep="0">
55220 <colspec colwidth="8*" align="left"/>
55221 <colspec colwidth="6*" align="center"/>
55222 <colspec colwidth="6*" align="center"/>
55223 <colspec colwidth="6*" align="right"/>
55224 <tbody>
55225 <row>
55226 <entry><option>client_send</option></entry>
55227 <entry>Use: <emphasis>plaintext</emphasis></entry>
55228 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55229 <entry>Default: <emphasis>unset</emphasis></entry>
55230 </row>
55231 </tbody>
55232 </tgroup>
55233 </informaltable>
55234 <para>
55235 The string is a colon-separated list of authentication data strings. Each
55236 string is independently expanded before being sent to the server. The first
55237 string is sent with the AUTH command; any more strings are sent in response
55238 to prompts from the server. Before each string is expanded, the value of the
55239 most recent prompt is placed in the next <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable, starting
55240 with <varname>$auth1</varname> for the first prompt. Up to three prompts are stored in this
55241 way. Thus, the prompt that is received in response to sending the first string
55242 (with the AUTH command) can be used in the expansion of the second string, and
55243 so on. If an invalid base64 string is received when
55244 <option>client_ignore_invalid_base64</option> is set, an empty string is put in the
55245 <varname>$auth</varname>&lt;<emphasis>n</emphasis>&gt; variable.
55246 </para>
55247 <para>
55248 <emphasis role="bold">Note</emphasis>: You cannot use expansion to create multiple strings, because
55249 splitting takes priority and happens first.
55250 </para>
55251 <para>
55252 Because the PLAIN authentication mechanism requires NUL (binary zero) bytes in
55253 the data, further processing is applied to each string before it is sent. If
55254 there are any single circumflex characters in the string, they are converted to
55255 NULs. Should an actual circumflex be required as data, it must be doubled in
55256 the string.
55257 </para>
55258 <para>
55259 This is an example of a client configuration that implements the PLAIN
55260 authentication mechanism with a fixed user name and password:
55261 </para>
55262 <literallayout class="monospaced">
55263 fixed_plain:
55264   driver = plaintext
55265   public_name = PLAIN
55266   client_send = ^username^mysecret
55267 </literallayout>
55268 <para>
55269 The lack of colons means that the entire text is sent with the AUTH
55270 command, with the circumflex characters converted to NULs.
55271 Note that due to the ambiguity of parsing three consectutive circumflex characters
55272 there is no way to provide a password having a leading circumflex.
55273 </para>
55274 <para>
55275 A similar example
55276 that uses the LOGIN mechanism is:
55277 </para>
55278 <literallayout class="monospaced">
55279 fixed_login:
55280   driver = plaintext
55281   public_name = LOGIN
55282   client_send = : username : mysecret
55283 </literallayout>
55284 <para>
55285 The initial colon means that the first string is empty, so no data is sent with
55286 the AUTH command itself. The remaining strings are sent in response to
55287 prompts.
55288 <indexterm role="concept" startref="IIDplaiauth1" class="endofrange"/>
55289 <indexterm role="concept" startref="IIDplaiauth2" class="endofrange"/>
55290 </para>
55291 </section>
55292 </chapter>
55293
55294 <chapter id="CHID9">
55295 <title>The cram_md5 authenticator</title>
55296 <para>
55297 <indexterm role="concept" id="IIDcramauth1" class="startofrange">
55298 <primary><command>cram_md5</command> authenticator</primary>
55299 </indexterm>
55300 <indexterm role="concept" id="IIDcramauth2" class="startofrange">
55301 <primary>authenticators</primary>
55302 <secondary><command>cram_md5</command></secondary>
55303 </indexterm>
55304 <indexterm role="concept">
55305 <primary>CRAM-MD5 authentication mechanism</primary>
55306 </indexterm>
55307 <indexterm role="concept">
55308 <primary>authentication</primary>
55309 <secondary>CRAM-MD5</secondary>
55310 </indexterm>
55311 The CRAM-MD5 authentication mechanism is described in RFC 2195. The server
55312 sends a challenge string to the client, and the response consists of a user
55313 name and the CRAM-MD5 digest of the challenge string combined with a secret
55314 string (password) which is known to both server and client. Thus, the secret
55315 is not sent over the network as plain text, which makes this authenticator more
55316 secure than <command>plaintext</command>. However, the downside is that the secret has to be
55317 available in plain text at either end.
55318 </para>
55319 <section id="SECID176">
55320 <title>Using cram_md5 as a server</title>
55321 <para>
55322 <indexterm role="concept">
55323 <primary>options</primary>
55324 <secondary><command>cram_md5</command> authenticator (server)</secondary>
55325 </indexterm>
55326 This authenticator has one server option, which must be set to configure the
55327 authenticator as a server:
55328 </para>
55329 <para>
55330 <indexterm role="option">
55331 <primary><option>server_secret</option></primary>
55332 </indexterm>
55333 </para>
55334 <informaltable frame="all">
55335 <tgroup cols="4" colsep="0" rowsep="0">
55336 <colspec colwidth="8*" align="left"/>
55337 <colspec colwidth="6*" align="center"/>
55338 <colspec colwidth="6*" align="center"/>
55339 <colspec colwidth="6*" align="right"/>
55340 <tbody>
55341 <row>
55342 <entry><option>server_secret</option></entry>
55343 <entry>Use: <emphasis>cram_md5</emphasis></entry>
55344 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55345 <entry>Default: <emphasis>unset</emphasis></entry>
55346 </row>
55347 </tbody>
55348 </tgroup>
55349 </informaltable>
55350 <para>
55351 <indexterm role="concept">
55352 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
55353 <secondary>in <command>cram_md5</command> authenticator</secondary>
55354 </indexterm>
55355 When the server receives the client&#x2019;s response, the user name is placed in
55356 the expansion variable <varname>$auth1</varname>, and <option>server_secret</option> is expanded to
55357 obtain the password for that user. The server then computes the CRAM-MD5 digest
55358 that the client should have sent, and checks that it received the correct
55359 string. If the expansion of <option>server_secret</option> is forced to fail, authentication
55360 fails. If the expansion fails for some other reason, a temporary error code is
55361 returned to the client.
55362 </para>
55363 <para>
55364 For compatibility with previous releases of Exim, the user name is also placed
55365 in <varname>$1</varname>. However, the use of this variables for this purpose is now
55366 deprecated, as it can lead to confusion in string expansions that also use
55367 numeric variables for other things.
55368 </para>
55369 <para>
55370 For example, the following authenticator checks that the user name given by the
55371 client is <quote>ph10</quote>, and if so, uses <quote>secret</quote> as the password. For any other
55372 user name, authentication fails.
55373 </para>
55374 <literallayout class="monospaced">
55375 fixed_cram:
55376   driver = cram_md5
55377   public_name = CRAM-MD5
55378   server_secret = ${if eq{$auth1}{ph10}{secret}fail}
55379   server_set_id = $auth1
55380 </literallayout>
55381 <para>
55382 <indexterm role="variable">
55383 <primary><varname>$authenticated_id</varname></primary>
55384 </indexterm>
55385 If authentication succeeds, the setting of <option>server_set_id</option> preserves the user
55386 name in <varname>$authenticated_id</varname>. A more typical configuration might look up the
55387 secret string in a file, using the user name as the key. For example:
55388 </para>
55389 <literallayout class="monospaced">
55390 lookup_cram:
55391   driver = cram_md5
55392   public_name = CRAM-MD5
55393   server_secret = ${lookup{$auth1}lsearch{/etc/authpwd}\
55394                   {$value}fail}
55395   server_set_id = $auth1
55396 </literallayout>
55397 <para>
55398 Note that this expansion explicitly forces failure if the lookup fails
55399 because <varname>$auth1</varname> contains an unknown user name.
55400 </para>
55401 <para>
55402 As another example, if you wish to re-use a Cyrus SASL sasldb2 file without
55403 using the relevant libraries, you need to know the realm to specify in the
55404 lookup and then ask for the <quote>userPassword</quote> attribute for that user in that
55405 realm, with:
55406 </para>
55407 <literallayout class="monospaced">
55408 cyrusless_crammd5:
55409   driver = cram_md5
55410   public_name = CRAM-MD5
55411   server_secret = ${lookup{$auth1:mail.example.org:userPassword}\
55412                   dbmjz{/etc/sasldb2}{$value}fail}
55413   server_set_id = $auth1
55414 </literallayout>
55415 </section>
55416 <section id="SECID177">
55417 <title>Using cram_md5 as a client</title>
55418 <para>
55419 <indexterm role="concept">
55420 <primary>options</primary>
55421 <secondary><command>cram_md5</command> authenticator (client)</secondary>
55422 </indexterm>
55423 When used as a client, the <command>cram_md5</command> authenticator has two options:
55424 </para>
55425 <para>
55426 <indexterm role="option">
55427 <primary><option>client_name</option></primary>
55428 </indexterm>
55429 </para>
55430 <informaltable frame="all">
55431 <tgroup cols="4" colsep="0" rowsep="0">
55432 <colspec colwidth="8*" align="left"/>
55433 <colspec colwidth="6*" align="center"/>
55434 <colspec colwidth="6*" align="center"/>
55435 <colspec colwidth="6*" align="right"/>
55436 <tbody>
55437 <row>
55438 <entry><option>client_name</option></entry>
55439 <entry>Use: <emphasis>cram_md5</emphasis></entry>
55440 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55441 <entry>Default: <emphasis>the primary host name</emphasis></entry>
55442 </row>
55443 </tbody>
55444 </tgroup>
55445 </informaltable>
55446 <para>
55447 This string is expanded, and the result used as the user name data when
55448 computing the response to the server&#x2019;s challenge.
55449 </para>
55450 <para>
55451 <indexterm role="option">
55452 <primary><option>client_secret</option></primary>
55453 </indexterm>
55454 </para>
55455 <informaltable frame="all">
55456 <tgroup cols="4" colsep="0" rowsep="0">
55457 <colspec colwidth="8*" align="left"/>
55458 <colspec colwidth="6*" align="center"/>
55459 <colspec colwidth="6*" align="center"/>
55460 <colspec colwidth="6*" align="right"/>
55461 <tbody>
55462 <row>
55463 <entry><option>client_secret</option></entry>
55464 <entry>Use: <emphasis>cram_md5</emphasis></entry>
55465 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55466 <entry>Default: <emphasis>unset</emphasis></entry>
55467 </row>
55468 </tbody>
55469 </tgroup>
55470 </informaltable>
55471 <para>
55472 This option must be set for the authenticator to work as a client. Its value is
55473 expanded and the result used as the secret string when computing the response.
55474 </para>
55475 <para>
55476 <indexterm role="variable">
55477 <primary><varname>$host</varname></primary>
55478 </indexterm>
55479 <indexterm role="variable">
55480 <primary><varname>$host_address</varname></primary>
55481 </indexterm>
55482 Different user names and secrets can be used for different servers by referring
55483 to <varname>$host</varname> or <varname>$host_address</varname> in the options. Forced failure of either
55484 expansion string is treated as an indication that this authenticator is not
55485 prepared to handle this case. Exim moves on to the next configured client
55486 authenticator. Any other expansion failure causes Exim to give up trying to
55487 send the message to the current server.
55488 </para>
55489 <para>
55490 A simple example configuration of a <command>cram_md5</command> authenticator, using fixed
55491 strings, is:
55492 </para>
55493 <literallayout class="monospaced">
55494 fixed_cram:
55495   driver = cram_md5
55496   public_name = CRAM-MD5
55497   client_name = ph10
55498   client_secret = secret
55499 </literallayout>
55500 <para>
55501 <indexterm role="concept" startref="IIDcramauth1" class="endofrange"/>
55502 <indexterm role="concept" startref="IIDcramauth2" class="endofrange"/>
55503 </para>
55504 </section>
55505 </chapter>
55506
55507 <chapter id="CHID10">
55508 <title>The cyrus_sasl authenticator</title>
55509 <para>
55510 <indexterm role="concept" id="IIDcyrauth1" class="startofrange">
55511 <primary><command>cyrus_sasl</command> authenticator</primary>
55512 </indexterm>
55513 <indexterm role="concept" id="IIDcyrauth2" class="startofrange">
55514 <primary>authenticators</primary>
55515 <secondary><command>cyrus_sasl</command></secondary>
55516 </indexterm>
55517 <indexterm role="concept">
55518 <primary>Cyrus</primary>
55519 <secondary>SASL library</secondary>
55520 </indexterm>
55521 <indexterm role="concept">
55522 <primary>Kerberos</primary>
55523 </indexterm>
55524 The code for this authenticator was provided by Matthew Byng-Maddick while
55525 at A L Digital Ltd.
55526 </para>
55527 <para>
55528 The <command>cyrus_sasl</command> authenticator provides server support for the Cyrus SASL
55529 library implementation of the RFC 2222 (<quote>Simple Authentication and Security
55530 Layer</quote>). This library supports a number of authentication mechanisms,
55531 including PLAIN and LOGIN, but also several others that Exim does not support
55532 directly. In particular, there is support for Kerberos authentication.
55533 </para>
55534 <para>
55535 The <command>cyrus_sasl</command> authenticator provides a gatewaying mechanism directly to
55536 the Cyrus interface, so if your Cyrus library can do, for example, CRAM-MD5,
55537 then so can the <command>cyrus_sasl</command> authenticator. By default it uses the public
55538 name of the driver to determine which mechanism to support.
55539 </para>
55540 <para>
55541 Where access to some kind of secret file is required, for example, in GSSAPI
55542 or CRAM-MD5, it is worth noting that the authenticator runs as the Exim
55543 user, and that the Cyrus SASL library has no way of escalating privileges
55544 by default. You may also find you need to set environment variables,
55545 depending on the driver you are using.
55546 </para>
55547 <para>
55548 The application name provided by Exim is <quote>exim</quote>, so various SASL options may
55549 be set in <filename>exim.conf</filename> in your SASL directory. If you are using GSSAPI for
55550 Kerberos, note that because of limitations in the GSSAPI interface,
55551 changing the server keytab might need to be communicated down to the Kerberos
55552 layer independently. The mechanism for doing so is dependent upon the Kerberos
55553 implementation.
55554 </para>
55555 <para>
55556 For example, for older releases of Heimdal, the environment variable KRB5_KTNAME
55557 may be set to point to an alternative keytab file. Exim will pass this
55558 variable through from its own inherited environment when started as root or the
55559 Exim user. The keytab file needs to be readable by the Exim user.
55560 With newer releases of Heimdal, a setuid Exim may cause Heimdal to discard the
55561 environment variable.  In practice, for those releases, the Cyrus authenticator
55562 is not a suitable interface for GSSAPI (Kerberos) support.  Instead, consider
55563 the <command>heimdal_gssapi</command> authenticator, described in chapter <xref linkend="CHAPheimdalgss"/>
55564 </para>
55565 <section id="SECID178">
55566 <title>Using cyrus_sasl as a server</title>
55567 <para>
55568 The <command>cyrus_sasl</command> authenticator has four private options. It puts the username
55569 (on a successful authentication) into <varname>$auth1</varname>. For compatibility with
55570 previous releases of Exim, the username is also placed in <varname>$1</varname>. However, the
55571 use of this variable for this purpose is now deprecated, as it can lead to
55572 confusion in string expansions that also use numeric variables for other
55573 things.
55574 </para>
55575 <para>
55576 <indexterm role="option">
55577 <primary><option>server_hostname</option></primary>
55578 </indexterm>
55579 </para>
55580 <informaltable frame="all">
55581 <tgroup cols="4" colsep="0" rowsep="0">
55582 <colspec colwidth="8*" align="left"/>
55583 <colspec colwidth="6*" align="center"/>
55584 <colspec colwidth="6*" align="center"/>
55585 <colspec colwidth="6*" align="right"/>
55586 <tbody>
55587 <row>
55588 <entry><option>server_hostname</option></entry>
55589 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
55590 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55591 <entry>Default: <emphasis>see below</emphasis></entry>
55592 </row>
55593 </tbody>
55594 </tgroup>
55595 </informaltable>
55596 <para>
55597 This option selects the hostname that is used when communicating with the
55598 library. The default value is <literal>$primary_hostname</literal>. It is up to the underlying
55599 SASL plug-in what it does with this data.
55600 </para>
55601 <para>
55602 <indexterm role="option">
55603 <primary><option>server_mech</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_mech</option></entry>
55615 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
55616 <entry>Type: <emphasis>string</emphasis></entry>
55617 <entry>Default: <emphasis>see below</emphasis></entry>
55618 </row>
55619 </tbody>
55620 </tgroup>
55621 </informaltable>
55622 <para>
55623 This option selects the authentication mechanism this driver should use. The
55624 default is the value of the generic <option>public_name</option> option. This option allows
55625 you to use a different underlying mechanism from the advertised name. For
55626 example:
55627 </para>
55628 <literallayout class="monospaced">
55629 sasl:
55630   driver = cyrus_sasl
55631   public_name = X-ANYTHING
55632   server_mech = CRAM-MD5
55633   server_set_id = $auth1
55634 </literallayout>
55635 <para>
55636 <indexterm role="option">
55637 <primary><option>server_realm</option></primary>
55638 </indexterm>
55639 </para>
55640 <informaltable frame="all">
55641 <tgroup cols="4" colsep="0" rowsep="0">
55642 <colspec colwidth="8*" align="left"/>
55643 <colspec colwidth="6*" align="center"/>
55644 <colspec colwidth="6*" align="center"/>
55645 <colspec colwidth="6*" align="right"/>
55646 <tbody>
55647 <row>
55648 <entry><option>server_realm</option></entry>
55649 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
55650 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55651 <entry>Default: <emphasis>unset</emphasis></entry>
55652 </row>
55653 </tbody>
55654 </tgroup>
55655 </informaltable>
55656 <para>
55657 This specifies the SASL realm that the server claims to be in.
55658 </para>
55659 <para>
55660 <indexterm role="option">
55661 <primary><option>server_service</option></primary>
55662 </indexterm>
55663 </para>
55664 <informaltable frame="all">
55665 <tgroup cols="4" colsep="0" rowsep="0">
55666 <colspec colwidth="8*" align="left"/>
55667 <colspec colwidth="6*" align="center"/>
55668 <colspec colwidth="6*" align="center"/>
55669 <colspec colwidth="6*" align="right"/>
55670 <tbody>
55671 <row>
55672 <entry><option>server_service</option></entry>
55673 <entry>Use: <emphasis>cyrus_sasl</emphasis></entry>
55674 <entry>Type: <emphasis>string</emphasis></entry>
55675 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
55676 </row>
55677 </tbody>
55678 </tgroup>
55679 </informaltable>
55680 <para>
55681 This is the SASL service that the server claims to implement.
55682 </para>
55683 <para>
55684 For straightforward cases, you do not need to set any of the authenticator&#x2019;s
55685 private options. All you need to do is to specify an appropriate mechanism as
55686 the public name. Thus, if you have a SASL library that supports CRAM-MD5 and
55687 PLAIN, you could have two authenticators as follows:
55688 </para>
55689 <literallayout class="monospaced">
55690 sasl_cram_md5:
55691   driver = cyrus_sasl
55692   public_name = CRAM-MD5
55693   server_set_id = $auth1
55694
55695 sasl_plain:
55696   driver = cyrus_sasl
55697   public_name = PLAIN
55698   server_set_id = $auth2
55699 </literallayout>
55700 <para>
55701 Cyrus SASL does implement the LOGIN authentication method, even though it is
55702 not a standard method. It is disabled by default in the source distribution,
55703 but it is present in many binary distributions.
55704 <indexterm role="concept" startref="IIDcyrauth1" class="endofrange"/>
55705 <indexterm role="concept" startref="IIDcyrauth2" class="endofrange"/>
55706 </para>
55707 </section>
55708 </chapter>
55709
55710 <chapter id="CHAPdovecot">
55711 <title>The dovecot authenticator</title>
55712 <para>
55713 <indexterm role="concept" id="IIDdcotauth1" class="startofrange">
55714 <primary><command>dovecot</command> authenticator</primary>
55715 </indexterm>
55716 <indexterm role="concept" id="IIDdcotauth2" class="startofrange">
55717 <primary>authenticators</primary>
55718 <secondary><command>dovecot</command></secondary>
55719 </indexterm>
55720 This authenticator is an interface to the authentication facility of the
55721 Dovecot 2 POP/IMAP server, which can support a number of authentication methods.
55722 Note that Dovecot must be configured to use auth-client not auth-userdb.
55723 If you are using Dovecot to authenticate POP/IMAP clients, it might be helpful
55724 to use the same mechanisms for SMTP authentication. This is a server
55725 authenticator only. There is only one option:
55726 </para>
55727 <para>
55728 <indexterm role="option">
55729 <primary><option>server_socket</option></primary>
55730 </indexterm>
55731 </para>
55732 <informaltable frame="all">
55733 <tgroup cols="4" colsep="0" rowsep="0">
55734 <colspec colwidth="8*" align="left"/>
55735 <colspec colwidth="6*" align="center"/>
55736 <colspec colwidth="6*" align="center"/>
55737 <colspec colwidth="6*" align="right"/>
55738 <tbody>
55739 <row>
55740 <entry><option>server_socket</option></entry>
55741 <entry>Use: <emphasis>dovecot</emphasis></entry>
55742 <entry>Type: <emphasis>string</emphasis></entry>
55743 <entry>Default: <emphasis>unset</emphasis></entry>
55744 </row>
55745 </tbody>
55746 </tgroup>
55747 </informaltable>
55748 <para>
55749 This option must specify the UNIX socket that is the interface to Dovecot
55750 authentication. The <option>public_name</option> option must specify an authentication
55751 mechanism that Dovecot is configured to support. You can have several
55752 authenticators for different mechanisms. For example:
55753 </para>
55754 <literallayout class="monospaced">
55755 dovecot_plain:
55756   driver = dovecot
55757   public_name = PLAIN
55758   server_socket = /var/run/dovecot/auth-client
55759   server_set_id = $auth1
55760
55761 dovecot_ntlm:
55762   driver = dovecot
55763   public_name = NTLM
55764   server_socket = /var/run/dovecot/auth-client
55765   server_set_id = $auth1
55766 </literallayout>
55767 <para>
55768 If the SMTP connection is encrypted, or if <varname>$sender_host_address</varname> is equal to
55769 <varname>$received_ip_address</varname> (that is, the connection is local), the <quote>secured</quote>
55770 option is passed in the Dovecot authentication command. If, for a TLS
55771 connection, a client certificate has been verified, the <quote>valid-client-cert</quote>
55772 option is passed. When authentication succeeds, the identity of the user
55773 who authenticated is placed in <varname>$auth1</varname>.
55774 </para>
55775 <para>
55776 The Dovecot configuration to match the above will look
55777 something like:
55778 </para>
55779 <literallayout class="monospaced">
55780 conf.d/10-master.conf :-
55781
55782 service auth {
55783 ...
55784 #SASL
55785   unix_listener auth-client {
55786     mode = 0660
55787     user = mail
55788   }
55789 ...
55790 }
55791
55792 conf.d/10-auth.conf :-
55793
55794 auth_mechanisms = plain login ntlm
55795 </literallayout>
55796 <para>
55797 <indexterm role="concept" startref="IIDdcotauth1" class="endofrange"/>
55798 <indexterm role="concept" startref="IIDdcotauth2" class="endofrange"/>
55799 </para>
55800 </chapter>
55801
55802 <chapter id="CHAPgsasl">
55803 <title>The gsasl authenticator</title>
55804 <para>
55805 <indexterm role="concept" id="IIDgsaslauth1" class="startofrange">
55806 <primary><command>gsasl</command> authenticator</primary>
55807 </indexterm>
55808 <indexterm role="concept" id="IIDgsaslauth2" class="startofrange">
55809 <primary>authenticators</primary>
55810 <secondary><command>gsasl</command></secondary>
55811 </indexterm>
55812 <indexterm role="concept">
55813 <primary>authentication</primary>
55814 <secondary>GNU SASL</secondary>
55815 </indexterm>
55816 <indexterm role="concept">
55817 <primary>authentication</primary>
55818 <secondary>SASL</secondary>
55819 </indexterm>
55820 <indexterm role="concept">
55821 <primary>authentication</primary>
55822 <secondary>EXTERNAL</secondary>
55823 </indexterm>
55824 <indexterm role="concept">
55825 <primary>authentication</primary>
55826 <secondary>ANONYMOUS</secondary>
55827 </indexterm>
55828 <indexterm role="concept">
55829 <primary>authentication</primary>
55830 <secondary>PLAIN</secondary>
55831 </indexterm>
55832 <indexterm role="concept">
55833 <primary>authentication</primary>
55834 <secondary>LOGIN</secondary>
55835 </indexterm>
55836 <indexterm role="concept">
55837 <primary>authentication</primary>
55838 <secondary>DIGEST-MD5</secondary>
55839 </indexterm>
55840 <indexterm role="concept">
55841 <primary>authentication</primary>
55842 <secondary>CRAM-MD5</secondary>
55843 </indexterm>
55844 <indexterm role="concept">
55845 <primary>authentication</primary>
55846 <secondary>SCRAM family</secondary>
55847 </indexterm>
55848 The <command>gsasl</command> authenticator provides integration for the GNU SASL
55849 library and the mechanisms it provides.  This is new as of the 4.80 release
55850 and there are a few areas where the library does not let Exim smoothly
55851 scale to handle future authentication mechanisms, so no guarantee can be
55852 made that any particular new authentication mechanism will be supported
55853 without code changes in Exim.
55854 </para>
55855 <para>
55856 The library is expected to add support in an upcoming
55857 realease for the SCRAM-SHA-256 method.
55858 The macro _HAVE_AUTH_GSASL_SCRAM_SHA_256 will be defined
55859 when this happens.
55860 </para>
55861 <para>
55862 To see the list of mechanisms supported by the library run Exim with "auth" debug
55863 enabled and look for a line containing "GNU SASL supports".
55864 Note however that some may not have been tested from Exim.
55865 </para>
55866 <para>
55867 <indexterm role="option">
55868 <primary><option>client_authz</option></primary>
55869 </indexterm>
55870 </para>
55871 <informaltable frame="all">
55872 <tgroup cols="4" colsep="0" rowsep="0">
55873 <colspec colwidth="8*" align="left"/>
55874 <colspec colwidth="6*" align="center"/>
55875 <colspec colwidth="6*" align="center"/>
55876 <colspec colwidth="6*" align="right"/>
55877 <tbody>
55878 <row>
55879 <entry><option>client_authz</option></entry>
55880 <entry>Use: <emphasis>gsasl</emphasis></entry>
55881 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55882 <entry>Default: <emphasis>unset</emphasis></entry>
55883 </row>
55884 </tbody>
55885 </tgroup>
55886 </informaltable>
55887 <para>
55888 This option can be used to supply an <emphasis>authorization id</emphasis>
55889 which is different to the <emphasis>authentication_id</emphasis> provided
55890 by <option>client_username</option> option.
55891 If unset or (after expansion) empty it is not used,
55892 which is the common case.
55893 </para>
55894 <para>
55895 <indexterm role="option">
55896 <primary><option>client_channelbinding</option></primary>
55897 </indexterm>
55898 </para>
55899 <informaltable frame="all">
55900 <tgroup cols="4" colsep="0" rowsep="0">
55901 <colspec colwidth="8*" align="left"/>
55902 <colspec colwidth="6*" align="center"/>
55903 <colspec colwidth="6*" align="center"/>
55904 <colspec colwidth="6*" align="right"/>
55905 <tbody>
55906 <row>
55907 <entry><option>client_channelbinding</option></entry>
55908 <entry>Use: <emphasis>gsasl</emphasis></entry>
55909 <entry>Type: <emphasis>boolean</emphasis></entry>
55910 <entry>Default: <emphasis>false</emphasis></entry>
55911 </row>
55912 </tbody>
55913 </tgroup>
55914 </informaltable>
55915 <para>
55916 See <option>server_channelbinding</option> below.
55917 </para>
55918 <para>
55919 <indexterm role="option">
55920 <primary><option>client_password</option></primary>
55921 </indexterm>
55922 </para>
55923 <informaltable frame="all">
55924 <tgroup cols="4" colsep="0" rowsep="0">
55925 <colspec colwidth="8*" align="left"/>
55926 <colspec colwidth="6*" align="center"/>
55927 <colspec colwidth="6*" align="center"/>
55928 <colspec colwidth="6*" align="right"/>
55929 <tbody>
55930 <row>
55931 <entry><option>client_password</option></entry>
55932 <entry>Use: <emphasis>gsasl</emphasis></entry>
55933 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55934 <entry>Default: <emphasis>unset</emphasis></entry>
55935 </row>
55936 </tbody>
55937 </tgroup>
55938 </informaltable>
55939 <para>
55940 This option is exapanded before use, and should result in
55941 the password to be used, in clear.
55942 </para>
55943 <para>
55944 <indexterm role="option">
55945 <primary><option>client_username</option></primary>
55946 </indexterm>
55947 </para>
55948 <informaltable frame="all">
55949 <tgroup cols="4" colsep="0" rowsep="0">
55950 <colspec colwidth="8*" align="left"/>
55951 <colspec colwidth="6*" align="center"/>
55952 <colspec colwidth="6*" align="center"/>
55953 <colspec colwidth="6*" align="right"/>
55954 <tbody>
55955 <row>
55956 <entry><option>client_username</option></entry>
55957 <entry>Use: <emphasis>gsasl</emphasis></entry>
55958 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55959 <entry>Default: <emphasis>unset</emphasis></entry>
55960 </row>
55961 </tbody>
55962 </tgroup>
55963 </informaltable>
55964 <para>
55965 This option is exapanded before use, and should result in
55966 the account name to be used.
55967 </para>
55968 <para>
55969 <indexterm role="option">
55970 <primary><option>client_spassword</option></primary>
55971 </indexterm>
55972 </para>
55973 <informaltable frame="all">
55974 <tgroup cols="4" colsep="0" rowsep="0">
55975 <colspec colwidth="8*" align="left"/>
55976 <colspec colwidth="6*" align="center"/>
55977 <colspec colwidth="6*" align="center"/>
55978 <colspec colwidth="6*" align="right"/>
55979 <tbody>
55980 <row>
55981 <entry><option>client_spassword</option></entry>
55982 <entry>Use: <emphasis>gsasl</emphasis></entry>
55983 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
55984 <entry>Default: <emphasis>unset</emphasis></entry>
55985 </row>
55986 </tbody>
55987 </tgroup>
55988 </informaltable>
55989 <para>
55990 This option is only supported for library versions 1.9.1 and greater.
55991 The macro _HAVE_AUTH_GSASL_SCRAM_S_KEY will be defined when this is so.
55992 </para>
55993 <para>
55994 If a SCRAM mechanism is being used and this option is set
55995 and correctly sized
55996 it is used in preference to <option>client_password</option>.
55997 The value after expansion should be
55998 a 40 (for SHA-1) or 64 (for SHA-256) character string
55999 with the PBKDF2-prepared password, hex-encoded.
56000 </para>
56001 <para>
56002 Note that this value will depend on the salt and iteration-count
56003 supplied by the server.
56004 The option is expanded before use.
56005 During the expansion <varname>$auth1</varname> is set with the client username,
56006 <varname>$auth2</varname> with the iteration count, and
56007 <varname>$auth3</varname> with the salt.
56008 </para>
56009 <para>
56010 The intent of this option
56011 is to support clients that can cache thes salted password
56012 to save on recalculation costs.
56013 The cache lookup should return an unusable value
56014 (eg. an empty string)
56015 if the salt or iteration count has changed
56016 </para>
56017 <para>
56018 If the authentication succeeds then the above variables are set,
56019 <indexterm role="variable">
56020 <primary><varname>$auth4</varname></primary>
56021 </indexterm>
56022 plus the calculated salted password value value in <varname>$auth4</varname>,
56023 during the expansion of the <option>client_set_id</option> option.
56024 A side-effect of this expansion can be used to prime the cache.
56025 </para>
56026 <para>
56027 <indexterm role="option">
56028 <primary><option>server_channelbinding</option></primary>
56029 </indexterm>
56030 </para>
56031 <informaltable frame="all">
56032 <tgroup cols="4" colsep="0" rowsep="0">
56033 <colspec colwidth="8*" align="left"/>
56034 <colspec colwidth="6*" align="center"/>
56035 <colspec colwidth="6*" align="center"/>
56036 <colspec colwidth="6*" align="right"/>
56037 <tbody>
56038 <row>
56039 <entry><option>server_channelbinding</option></entry>
56040 <entry>Use: <emphasis>gsasl</emphasis></entry>
56041 <entry>Type: <emphasis>boolean</emphasis></entry>
56042 <entry>Default: <emphasis>false</emphasis></entry>
56043 </row>
56044 </tbody>
56045 </tgroup>
56046 </informaltable>
56047 <para>
56048 Some authentication mechanisms are able to use external context at both ends
56049 of the session to bind the authentication to that context, and fail the
56050 authentication process if that context differs.  Specifically, some TLS
56051 ciphersuites can provide identifying information about the cryptographic
56052 context.
56053 </para>
56054 <para>
56055 This should have meant that certificate identity and verification becomes a
56056 non-issue, as a man-in-the-middle attack will cause the correct client and
56057 server to see different identifiers and authentication will fail.
56058 </para>
56059 <para>
56060 This is
56061 only usable by mechanisms which support "channel binding"; at time of
56062 writing, that&#x2019;s the SCRAM family.
56063 When using this feature the "-PLUS" variants of the method names need to be used.
56064 </para>
56065 <para>
56066 This defaults off to ensure smooth upgrade across Exim releases, in case
56067 this option causes some clients to start failing.  Some future release
56068 of Exim might have switched the default to be true.
56069 </para>
56070 <para>
56071 This option was deprecated in previous releases due to doubts over
56072 the "Triple Handshake" vulnerability.
56073 Exim takes suitable precausions (requiring Extended Master Secret if TLS
56074 Session Resumption was used) for safety.
56075 </para>
56076 <para>
56077 <indexterm role="option">
56078 <primary><option>server_hostname</option></primary>
56079 </indexterm>
56080 </para>
56081 <informaltable frame="all">
56082 <tgroup cols="4" colsep="0" rowsep="0">
56083 <colspec colwidth="8*" align="left"/>
56084 <colspec colwidth="6*" align="center"/>
56085 <colspec colwidth="6*" align="center"/>
56086 <colspec colwidth="6*" align="right"/>
56087 <tbody>
56088 <row>
56089 <entry><option>server_hostname</option></entry>
56090 <entry>Use: <emphasis>gsasl</emphasis></entry>
56091 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56092 <entry>Default: <emphasis>see below</emphasis></entry>
56093 </row>
56094 </tbody>
56095 </tgroup>
56096 </informaltable>
56097 <para>
56098 This option selects the hostname that is used when communicating with the
56099 library. The default value is <literal>$primary_hostname</literal>.
56100 Some mechanisms will use this data.
56101 </para>
56102 <para>
56103 <indexterm role="option">
56104 <primary><option>server_mech</option></primary>
56105 </indexterm>
56106 </para>
56107 <informaltable frame="all">
56108 <tgroup cols="4" colsep="0" rowsep="0">
56109 <colspec colwidth="8*" align="left"/>
56110 <colspec colwidth="6*" align="center"/>
56111 <colspec colwidth="6*" align="center"/>
56112 <colspec colwidth="6*" align="right"/>
56113 <tbody>
56114 <row>
56115 <entry><option>server_mech</option></entry>
56116 <entry>Use: <emphasis>gsasl</emphasis></entry>
56117 <entry>Type: <emphasis>string</emphasis></entry>
56118 <entry>Default: <emphasis>see below</emphasis></entry>
56119 </row>
56120 </tbody>
56121 </tgroup>
56122 </informaltable>
56123 <para>
56124 This option selects the authentication mechanism this driver should use. The
56125 default is the value of the generic <option>public_name</option> option. This option allows
56126 you to use a different underlying mechanism from the advertised name. For
56127 example:
56128 </para>
56129 <literallayout class="monospaced">
56130 sasl:
56131   driver = gsasl
56132   public_name = X-ANYTHING
56133   server_mech = CRAM-MD5
56134   server_set_id = $auth1
56135 </literallayout>
56136 <para>
56137 <indexterm role="option">
56138 <primary><option>server_password</option></primary>
56139 </indexterm>
56140 </para>
56141 <informaltable frame="all">
56142 <tgroup cols="4" colsep="0" rowsep="0">
56143 <colspec colwidth="8*" align="left"/>
56144 <colspec colwidth="6*" align="center"/>
56145 <colspec colwidth="6*" align="center"/>
56146 <colspec colwidth="6*" align="right"/>
56147 <tbody>
56148 <row>
56149 <entry><option>server_password</option></entry>
56150 <entry>Use: <emphasis>gsasl</emphasis></entry>
56151 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56152 <entry>Default: <emphasis>unset</emphasis></entry>
56153 </row>
56154 </tbody>
56155 </tgroup>
56156 </informaltable>
56157 <para>
56158 Various mechanisms need access to the cleartext password on the server, so
56159 that proof-of-possession can be demonstrated on the wire, without sending
56160 the password itself.
56161 </para>
56162 <para>
56163 The data available for lookup varies per mechanism.
56164 In all cases, <varname>$auth1</varname> is set to the <emphasis>authentication id</emphasis>.
56165 The <varname>$auth2</varname> variable will always be the <emphasis>authorization id</emphasis> (<emphasis>authz</emphasis>)
56166 if available, else the empty string.
56167 The <varname>$auth3</varname> variable will always be the <emphasis>realm</emphasis> if available,
56168 else the empty string.
56169 </para>
56170 <para>
56171 A forced failure will cause authentication to defer.
56172 </para>
56173 <para>
56174 If using this option, it may make sense to set the <option>server_condition</option>
56175 option to be simply "true".
56176 </para>
56177 <para>
56178 <indexterm role="option">
56179 <primary><option>server_realm</option></primary>
56180 </indexterm>
56181 </para>
56182 <informaltable frame="all">
56183 <tgroup cols="4" colsep="0" rowsep="0">
56184 <colspec colwidth="8*" align="left"/>
56185 <colspec colwidth="6*" align="center"/>
56186 <colspec colwidth="6*" align="center"/>
56187 <colspec colwidth="6*" align="right"/>
56188 <tbody>
56189 <row>
56190 <entry><option>server_realm</option></entry>
56191 <entry>Use: <emphasis>gsasl</emphasis></entry>
56192 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56193 <entry>Default: <emphasis>unset</emphasis></entry>
56194 </row>
56195 </tbody>
56196 </tgroup>
56197 </informaltable>
56198 <para>
56199 This specifies the SASL realm that the server claims to be in.
56200 Some mechanisms will use this data.
56201 </para>
56202 <para>
56203 <indexterm role="option">
56204 <primary><option>server_scram_iter</option></primary>
56205 </indexterm>
56206 </para>
56207 <informaltable frame="all">
56208 <tgroup cols="4" colsep="0" rowsep="0">
56209 <colspec colwidth="8*" align="left"/>
56210 <colspec colwidth="6*" align="center"/>
56211 <colspec colwidth="6*" align="center"/>
56212 <colspec colwidth="6*" align="right"/>
56213 <tbody>
56214 <row>
56215 <entry><option>server_scram_iter</option></entry>
56216 <entry>Use: <emphasis>gsasl</emphasis></entry>
56217 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56218 <entry>Default: <emphasis>4096</emphasis></entry>
56219 </row>
56220 </tbody>
56221 </tgroup>
56222 </informaltable>
56223 <para>
56224 This option provides data for the SCRAM family of mechanisms.
56225 The <varname>$auth1</varname>, <varname>$auth2</varname> and <varname>$auth3</varname> variables are available
56226 when this option is expanded.
56227 </para>
56228 <para>
56229 The result of expansion should be a decimal number,
56230 and represents both a lower-bound on the security, and
56231 a compute cost factor imposed on the client
56232 (if it does not cache results, or the server changes
56233 either the iteration count or the salt).
56234 A minimum value of 4096 is required by the standards
56235 for all current SCRAM mechanism variants.
56236 </para>
56237 <para>
56238 <indexterm role="option">
56239 <primary><option>server_scram_salt</option></primary>
56240 </indexterm>
56241 </para>
56242 <informaltable frame="all">
56243 <tgroup cols="4" colsep="0" rowsep="0">
56244 <colspec colwidth="8*" align="left"/>
56245 <colspec colwidth="6*" align="center"/>
56246 <colspec colwidth="6*" align="center"/>
56247 <colspec colwidth="6*" align="right"/>
56248 <tbody>
56249 <row>
56250 <entry><option>server_scram_salt</option></entry>
56251 <entry>Use: <emphasis>gsasl</emphasis></entry>
56252 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56253 <entry>Default: <emphasis>unset</emphasis></entry>
56254 </row>
56255 </tbody>
56256 </tgroup>
56257 </informaltable>
56258 <para>
56259 This option provides data for the SCRAM family of mechanisms.
56260 The <varname>$auth1</varname>, <varname>$auth2</varname> and <varname>$auth3</varname> variables are available
56261 when this option is expanded.
56262 The value should be a base64-encoded string,
56263 of random data typically 4-to-16 bytes long.
56264 If unset or empty after expansion the library will provides a value for the
56265 protocol conversation.
56266 </para>
56267 <para>
56268 <indexterm role="option">
56269 <primary><option>server_key</option></primary>
56270 </indexterm>
56271 </para>
56272 <informaltable frame="all">
56273 <tgroup cols="4" colsep="0" rowsep="0">
56274 <colspec colwidth="8*" align="left"/>
56275 <colspec colwidth="6*" align="center"/>
56276 <colspec colwidth="6*" align="center"/>
56277 <colspec colwidth="6*" align="right"/>
56278 <tbody>
56279 <row>
56280 <entry><option>server_key</option></entry>
56281 <entry>Use: <emphasis>gsasl</emphasis></entry>
56282 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56283 <entry>Default: <emphasis>unset</emphasis></entry>
56284 </row>
56285 </tbody>
56286 </tgroup>
56287 </informaltable>
56288 <para>
56289 <indexterm role="option">
56290 <primary><option>server_skey</option></primary>
56291 </indexterm>
56292 </para>
56293 <informaltable frame="all">
56294 <tgroup cols="4" colsep="0" rowsep="0">
56295 <colspec colwidth="8*" align="left"/>
56296 <colspec colwidth="6*" align="center"/>
56297 <colspec colwidth="6*" align="center"/>
56298 <colspec colwidth="6*" align="right"/>
56299 <tbody>
56300 <row>
56301 <entry><option>server_skey</option></entry>
56302 <entry>Use: <emphasis>gsasl</emphasis></entry>
56303 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56304 <entry>Default: <emphasis>unset</emphasis></entry>
56305 </row>
56306 </tbody>
56307 </tgroup>
56308 </informaltable>
56309 <para>
56310 These options can be used for the SCRAM family of mechanisms
56311 to provide stored information related to a password,
56312 the storage of which is preferable to plaintext.
56313 </para>
56314 <para>
56315 <option>server_key</option> is the value defined in the SCRAM standards as ServerKey;
56316 <option>server_skey</option> is StoredKey.
56317 </para>
56318 <para>
56319 They are only available for version 1.9.0 (or later) of the gsasl library.
56320 When this is so, the macros
56321 _OPT_AUTHENTICATOR_GSASL_SERVER_KEY
56322 and _HAVE_AUTH_GSASL_SCRAM_S_KEY
56323 will be defined.
56324 </para>
56325 <para>
56326 The <varname>$authN</varname> variables are available when these options are expanded.
56327 </para>
56328 <para>
56329 If set, the results of expansion should for each
56330 should be a 28 (for SHA-1) or 44 (for SHA-256) character string
56331 of base64-coded data, and will be used in preference to the
56332 <option>server_password</option> option.
56333 If unset or not of the right length, <option>server_password</option> will be used.
56334 </para>
56335 <para>
56336 The libgsasl library release includes a utility <emphasis>gsasl</emphasis> which can be used
56337 to generate these values.
56338 </para>
56339 <para>
56340 <indexterm role="option">
56341 <primary><option>server_service</option></primary>
56342 </indexterm>
56343 </para>
56344 <informaltable frame="all">
56345 <tgroup cols="4" colsep="0" rowsep="0">
56346 <colspec colwidth="8*" align="left"/>
56347 <colspec colwidth="6*" align="center"/>
56348 <colspec colwidth="6*" align="center"/>
56349 <colspec colwidth="6*" align="right"/>
56350 <tbody>
56351 <row>
56352 <entry><option>server_service</option></entry>
56353 <entry>Use: <emphasis>gsasl</emphasis></entry>
56354 <entry>Type: <emphasis>string</emphasis></entry>
56355 <entry>Default: <emphasis><literal>smtp</literal></emphasis></entry>
56356 </row>
56357 </tbody>
56358 </tgroup>
56359 </informaltable>
56360 <para>
56361 This is the SASL service that the server claims to implement.
56362 Some mechanisms will use this data.
56363 </para>
56364 <section id="SECTgsaslauthvar">
56365 <title><command>gsasl</command> auth variables</title>
56366 <para>
56367 <indexterm role="variable">
56368 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
56369 </indexterm>
56370 These may be set when evaluating specific options, as detailed above.
56371 They will also be set when evaluating <option>server_condition</option>.
56372 </para>
56373 <para>
56374 Unless otherwise stated below, the <command>gsasl</command> integration will use the following
56375 meanings for these variables:
56376 </para>
56377 <itemizedlist>
56378 <listitem>
56379 <para>
56380 <indexterm role="variable">
56381 <primary><varname>$auth1</varname></primary>
56382 </indexterm>
56383 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>
56384 </para>
56385 </listitem>
56386 <listitem>
56387 <para>
56388 <indexterm role="variable">
56389 <primary><varname>$auth2</varname></primary>
56390 </indexterm>
56391 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>
56392 </para>
56393 </listitem>
56394 <listitem>
56395 <para>
56396 <indexterm role="variable">
56397 <primary><varname>$auth3</varname></primary>
56398 </indexterm>
56399 <varname>$auth3</varname>: the <emphasis>realm</emphasis>
56400 </para>
56401 </listitem>
56402 </itemizedlist>
56403 <para>
56404 On a per-mechanism basis:
56405 </para>
56406 <itemizedlist>
56407 <listitem>
56408 <para>
56409 <indexterm role="concept">
56410 <primary>authentication</primary>
56411 <secondary>EXTERNAL</secondary>
56412 </indexterm>
56413 EXTERNAL: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>authorization id</emphasis>;
56414 the <option>server_condition</option> option must be present.
56415 </para>
56416 </listitem>
56417 <listitem>
56418 <para>
56419 <indexterm role="concept">
56420 <primary>authentication</primary>
56421 <secondary>ANONYMOUS</secondary>
56422 </indexterm>
56423 ANONYMOUS: only <varname>$auth1</varname> is set, to the possibly empty <emphasis>anonymous token</emphasis>;
56424 the <option>server_condition</option> option must be present.
56425 </para>
56426 </listitem>
56427 <listitem>
56428 <para>
56429 <indexterm role="concept">
56430 <primary>authentication</primary>
56431 <secondary>GSSAPI</secondary>
56432 </indexterm>
56433 GSSAPI: <varname>$auth1</varname> will be set to the <emphasis>GSSAPI Display Name</emphasis>;
56434 <varname>$auth2</varname> will be set to the <emphasis>authorization id</emphasis>,
56435 the <option>server_condition</option> option must be present.
56436 </para>
56437 </listitem>
56438 </itemizedlist>
56439 <para>
56440 An <emphasis>anonymous token</emphasis> is something passed along as an unauthenticated
56441 identifier; this is analogous to FTP anonymous authentication passing an
56442 email address, or software-identifier@, as the "password".
56443 </para>
56444 <para>
56445 An example showing the password having the realm specified in the callback
56446 and demonstrating a Cyrus SASL to GSASL migration approach is:
56447 </para>
56448 <literallayout class="monospaced">
56449 gsasl_cyrusless_crammd5:
56450   driver = gsasl
56451   public_name = CRAM-MD5
56452   server_realm = imap.example.org
56453   server_password = ${lookup{$auth1:$auth3:userPassword}\
56454                     dbmjz{/etc/sasldb2}{$value}fail}
56455   server_set_id = ${quote:$auth1}
56456   server_condition = yes
56457 </literallayout>
56458 </section>
56459 </chapter>
56460
56461 <chapter id="CHAPheimdalgss">
56462 <title>The heimdal_gssapi authenticator</title>
56463 <para>
56464 <indexterm role="concept" id="IIDheimdalgssauth1" class="startofrange">
56465 <primary><command>heimdal_gssapi</command> authenticator</primary>
56466 </indexterm>
56467 <indexterm role="concept" id="IIDheimdalgssauth2" class="startofrange">
56468 <primary>authenticators</primary>
56469 <secondary><command>heimdal_gssapi</command></secondary>
56470 </indexterm>
56471 <indexterm role="concept">
56472 <primary>authentication</primary>
56473 <secondary>GSSAPI</secondary>
56474 </indexterm>
56475 <indexterm role="concept">
56476 <primary>authentication</primary>
56477 <secondary>Kerberos</secondary>
56478 </indexterm>
56479 The <command>heimdal_gssapi</command> authenticator provides server integration for the
56480 Heimdal GSSAPI/Kerberos library, permitting Exim to set a keytab pathname
56481 reliably.
56482 </para>
56483 <para>
56484 <indexterm role="option">
56485 <primary><option>server_hostname</option></primary>
56486 </indexterm>
56487 </para>
56488 <informaltable frame="all">
56489 <tgroup cols="4" colsep="0" rowsep="0">
56490 <colspec colwidth="8*" align="left"/>
56491 <colspec colwidth="6*" align="center"/>
56492 <colspec colwidth="6*" align="center"/>
56493 <colspec colwidth="6*" align="right"/>
56494 <tbody>
56495 <row>
56496 <entry><option>server_hostname</option></entry>
56497 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
56498 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56499 <entry>Default: <emphasis>see below</emphasis></entry>
56500 </row>
56501 </tbody>
56502 </tgroup>
56503 </informaltable>
56504 <para>
56505 This option selects the hostname that is used, with <option>server_service</option>,
56506 for constructing the GSS server name, as a <emphasis>GSS_C_NT_HOSTBASED_SERVICE</emphasis>
56507 identifier.  The default value is <literal>$primary_hostname</literal>.
56508 </para>
56509 <para>
56510 <indexterm role="option">
56511 <primary><option>server_keytab</option></primary>
56512 </indexterm>
56513 </para>
56514 <informaltable frame="all">
56515 <tgroup cols="4" colsep="0" rowsep="0">
56516 <colspec colwidth="8*" align="left"/>
56517 <colspec colwidth="6*" align="center"/>
56518 <colspec colwidth="6*" align="center"/>
56519 <colspec colwidth="6*" align="right"/>
56520 <tbody>
56521 <row>
56522 <entry><option>server_keytab</option></entry>
56523 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
56524 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56525 <entry>Default: <emphasis>unset</emphasis></entry>
56526 </row>
56527 </tbody>
56528 </tgroup>
56529 </informaltable>
56530 <para>
56531 If set, then Heimdal will not use the system default keytab (typically
56532 <filename>/etc/krb5.keytab</filename>) but instead the pathname given in this option.
56533 The value should be a pathname, with no <quote>file:</quote> prefix.
56534 </para>
56535 <para>
56536 <indexterm role="option">
56537 <primary><option>server_service</option></primary>
56538 </indexterm>
56539 </para>
56540 <informaltable frame="all">
56541 <tgroup cols="4" colsep="0" rowsep="0">
56542 <colspec colwidth="8*" align="left"/>
56543 <colspec colwidth="6*" align="center"/>
56544 <colspec colwidth="6*" align="center"/>
56545 <colspec colwidth="6*" align="right"/>
56546 <tbody>
56547 <row>
56548 <entry><option>server_service</option></entry>
56549 <entry>Use: <emphasis>heimdal_gssapi</emphasis></entry>
56550 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56551 <entry>Default: <emphasis>smtp</emphasis></entry>
56552 </row>
56553 </tbody>
56554 </tgroup>
56555 </informaltable>
56556 <para>
56557 This option specifies the service identifier used, in conjunction with
56558 <option>server_hostname</option>, for building the identifier for finding credentials
56559 from the keytab.
56560 </para>
56561 <section id="SECTheimdalgssauthvar">
56562 <title><command>heimdal_gssapi</command> auth variables</title>
56563 <para>
56564 Beware that these variables will typically include a realm, thus will appear
56565 to be roughly like an email address already.  The <emphasis>authzid</emphasis> in <varname>$auth2</varname> is
56566 not verified, so a malicious client can set it to anything.
56567 </para>
56568 <para>
56569 The <varname>$auth1</varname> field should be safely trustable as a value from the Key
56570 Distribution Center.  Note that these are not quite email addresses.
56571 Each identifier is for a role, and so the left-hand-side may include a
56572 role suffix.  For instance, <quote>joe/admin@EXAMPLE.ORG</quote>.
56573 </para>
56574 <para>
56575 <indexterm role="variable">
56576 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
56577 </indexterm>
56578 </para>
56579 <itemizedlist>
56580 <listitem>
56581 <para>
56582 <indexterm role="variable">
56583 <primary><varname>$auth1</varname></primary>
56584 </indexterm>
56585 <varname>$auth1</varname>: the <emphasis>authentication id</emphasis>, set to the GSS Display Name.
56586 </para>
56587 </listitem>
56588 <listitem>
56589 <para>
56590 <indexterm role="variable">
56591 <primary><varname>$auth2</varname></primary>
56592 </indexterm>
56593 <varname>$auth2</varname>: the <emphasis>authorization id</emphasis>, sent within SASL encapsulation after
56594 authentication.  If that was empty, this will also be set to the
56595 GSS Display Name.
56596 </para>
56597 </listitem>
56598 </itemizedlist>
56599 </section>
56600 </chapter>
56601
56602 <chapter id="CHAPspa">
56603 <title>The spa authenticator</title>
56604 <para>
56605 <indexterm role="concept" id="IIDspaauth1" class="startofrange">
56606 <primary><command>spa</command> authenticator</primary>
56607 </indexterm>
56608 <indexterm role="concept" id="IIDspaauth2" class="startofrange">
56609 <primary>authenticators</primary>
56610 <secondary><command>spa</command></secondary>
56611 </indexterm>
56612 <indexterm role="concept">
56613 <primary>authentication</primary>
56614 <secondary>Microsoft Secure Password</secondary>
56615 </indexterm>
56616 <indexterm role="concept">
56617 <primary>authentication</primary>
56618 <secondary>NTLM</secondary>
56619 </indexterm>
56620 <indexterm role="concept">
56621 <primary>Microsoft Secure Password Authentication</primary>
56622 </indexterm>
56623 <indexterm role="concept">
56624 <primary>NTLM authentication</primary>
56625 </indexterm>
56626 The <command>spa</command> authenticator provides client support for Microsoft&#x2019;s <emphasis>Secure
56627 Password Authentication</emphasis> mechanism,
56628 which is also sometimes known as NTLM (NT LanMan). The code for client side of
56629 this authenticator was contributed by Marc Prud&#x2019;hommeaux, and much of it is
56630 taken from the Samba project (<emphasis role="bold"><ulink url="https://www.samba.org/">https://www.samba.org/</ulink></emphasis>). The code for the
56631 server side was subsequently contributed by Tom Kistner. The mechanism works as
56632 follows:
56633 </para>
56634 <itemizedlist>
56635 <listitem>
56636 <para>
56637 After the AUTH command has been accepted, the client sends an SPA
56638 authentication request based on the user name and optional domain.
56639 </para>
56640 </listitem>
56641 <listitem>
56642 <para>
56643 The server sends back a challenge.
56644 </para>
56645 </listitem>
56646 <listitem>
56647 <para>
56648 The client builds a challenge response which makes use of the user&#x2019;s password
56649 and sends it to the server, which then accepts or rejects it.
56650 </para>
56651 </listitem>
56652 </itemizedlist>
56653 <para>
56654 Encryption is used to protect the password in transit.
56655 </para>
56656 <section id="SECID179">
56657 <title>Using spa as a server</title>
56658 <para>
56659 <indexterm role="concept">
56660 <primary>options</primary>
56661 <secondary><command>spa</command> authenticator (server)</secondary>
56662 </indexterm>
56663 The <command>spa</command> authenticator has just one server option:
56664 </para>
56665 <para>
56666 <indexterm role="option">
56667 <primary><option>server_password</option></primary>
56668 </indexterm>
56669 </para>
56670 <informaltable frame="all">
56671 <tgroup cols="4" colsep="0" rowsep="0">
56672 <colspec colwidth="8*" align="left"/>
56673 <colspec colwidth="6*" align="center"/>
56674 <colspec colwidth="6*" align="center"/>
56675 <colspec colwidth="6*" align="right"/>
56676 <tbody>
56677 <row>
56678 <entry><option>server_password</option></entry>
56679 <entry>Use: <emphasis>spa</emphasis></entry>
56680 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56681 <entry>Default: <emphasis>unset</emphasis></entry>
56682 </row>
56683 </tbody>
56684 </tgroup>
56685 </informaltable>
56686 <para>
56687 <indexterm role="concept">
56688 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
56689 <secondary>in <command>spa</command> authenticator</secondary>
56690 </indexterm>
56691 This option is expanded, and the result must be the cleartext password for the
56692 authenticating user, whose name is at this point in <varname>$auth1</varname>. For
56693 compatibility with previous releases of Exim, the user name is also placed in
56694 <varname>$1</varname>. However, the use of this variable for this purpose is now deprecated, as
56695 it can lead to confusion in string expansions that also use numeric variables
56696 for other things. For example:
56697 </para>
56698 <literallayout class="monospaced">
56699 spa:
56700   driver = spa
56701   public_name = NTLM
56702   server_password = \
56703     ${lookup{$auth1}lsearch{/etc/exim/spa_clearpass}{$value}fail}
56704 </literallayout>
56705 <para>
56706 If the expansion is forced to fail, authentication fails. Any other expansion
56707 failure causes a temporary error code to be returned.
56708 </para>
56709 </section>
56710 <section id="SECID180">
56711 <title>Using spa as a client</title>
56712 <para>
56713 <indexterm role="concept">
56714 <primary>options</primary>
56715 <secondary><command>spa</command> authenticator (client)</secondary>
56716 </indexterm>
56717 The <command>spa</command> authenticator has the following client options:
56718 </para>
56719 <para>
56720 <indexterm role="option">
56721 <primary><option>client_domain</option></primary>
56722 </indexterm>
56723 </para>
56724 <informaltable frame="all">
56725 <tgroup cols="4" colsep="0" rowsep="0">
56726 <colspec colwidth="8*" align="left"/>
56727 <colspec colwidth="6*" align="center"/>
56728 <colspec colwidth="6*" align="center"/>
56729 <colspec colwidth="6*" align="right"/>
56730 <tbody>
56731 <row>
56732 <entry><option>client_domain</option></entry>
56733 <entry>Use: <emphasis>spa</emphasis></entry>
56734 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56735 <entry>Default: <emphasis>unset</emphasis></entry>
56736 </row>
56737 </tbody>
56738 </tgroup>
56739 </informaltable>
56740 <para>
56741 This option specifies an optional domain for the authentication.
56742 </para>
56743 <para>
56744 <indexterm role="option">
56745 <primary><option>client_password</option></primary>
56746 </indexterm>
56747 </para>
56748 <informaltable frame="all">
56749 <tgroup cols="4" colsep="0" rowsep="0">
56750 <colspec colwidth="8*" align="left"/>
56751 <colspec colwidth="6*" align="center"/>
56752 <colspec colwidth="6*" align="center"/>
56753 <colspec colwidth="6*" align="right"/>
56754 <tbody>
56755 <row>
56756 <entry><option>client_password</option></entry>
56757 <entry>Use: <emphasis>spa</emphasis></entry>
56758 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56759 <entry>Default: <emphasis>unset</emphasis></entry>
56760 </row>
56761 </tbody>
56762 </tgroup>
56763 </informaltable>
56764 <para>
56765 This option specifies the user&#x2019;s password, and must be set.
56766 </para>
56767 <para>
56768 <indexterm role="option">
56769 <primary><option>client_username</option></primary>
56770 </indexterm>
56771 </para>
56772 <informaltable frame="all">
56773 <tgroup cols="4" colsep="0" rowsep="0">
56774 <colspec colwidth="8*" align="left"/>
56775 <colspec colwidth="6*" align="center"/>
56776 <colspec colwidth="6*" align="center"/>
56777 <colspec colwidth="6*" align="right"/>
56778 <tbody>
56779 <row>
56780 <entry><option>client_username</option></entry>
56781 <entry>Use: <emphasis>spa</emphasis></entry>
56782 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56783 <entry>Default: <emphasis>unset</emphasis></entry>
56784 </row>
56785 </tbody>
56786 </tgroup>
56787 </informaltable>
56788 <para>
56789 This option specifies the user name, and must be set. Here is an example of a
56790 configuration of this authenticator for use with the mail servers at
56791 <emphasis>msn.com</emphasis>:
56792 </para>
56793 <literallayout class="monospaced">
56794 msn:
56795   driver = spa
56796   public_name = MSN
56797   client_username = msn/msn_username
56798   client_password = msn_plaintext_password
56799   client_domain = DOMAIN_OR_UNSET
56800 </literallayout>
56801 <para>
56802 <indexterm role="concept" startref="IIDspaauth1" class="endofrange"/>
56803 <indexterm role="concept" startref="IIDspaauth2" class="endofrange"/>
56804 </para>
56805 </section>
56806 </chapter>
56807
56808 <chapter id="CHAPexternauth">
56809 <title>The external authenticator</title>
56810 <para>
56811 <indexterm role="concept" id="IIDexternauth1" class="startofrange">
56812 <primary><command>external</command> authenticator</primary>
56813 </indexterm>
56814 <indexterm role="concept" id="IIDexternauth2" class="startofrange">
56815 <primary>authenticators</primary>
56816 <secondary><command>external</command></secondary>
56817 </indexterm>
56818 <indexterm role="concept">
56819 <primary>authentication</primary>
56820 <secondary>Client Certificate</secondary>
56821 </indexterm>
56822 <indexterm role="concept">
56823 <primary>authentication</primary>
56824 <secondary>X509</secondary>
56825 </indexterm>
56826 <indexterm role="concept">
56827 <primary>Certificate-based authentication</primary>
56828 </indexterm>
56829 The <command>external</command> authenticator provides support for
56830 authentication based on non-SMTP information.
56831 The specification is in RFC 4422 Appendix A
56832 (<emphasis role="bold"><ulink url="https://tools.ietf.org/html/rfc4422">https://tools.ietf.org/html/rfc4422</ulink></emphasis>).
56833 It is only a transport and negotiation mechanism;
56834 the process of authentication is entirely controlled
56835 by the server configuration.
56836 </para>
56837 <para>
56838 The client presents an identity in-clear.
56839 It is probably wise for a server to only advertise,
56840 and for clients to only attempt,
56841 this authentication method on a secure (eg. under TLS) connection.
56842 </para>
56843 <para>
56844 One possible use, compatible with the
56845 K-9 Mail Android client (<emphasis role="bold"><ulink url="https://k9mail.github.io/">https://k9mail.github.io/</ulink></emphasis>),
56846 is for using X509 client certificates.
56847 </para>
56848 <para>
56849 It thus overlaps in function with the TLS authenticator
56850 (see <xref linkend="CHAPtlsauth"/>)
56851 but is a full SMTP SASL authenticator
56852 rather than being implicit for TLS-connection carried
56853 client certificates only.
56854 </para>
56855 <para>
56856 The examples and discussion in this chapter assume that
56857 client-certificate authentication is being done.
56858 </para>
56859 <para>
56860 The client must present a certificate,
56861 for which it must have been requested via the
56862 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
56863 (see <xref linkend="CHAPTLS"/>).
56864 For authentication to be effective the certificate should be
56865 verifiable against a trust-anchor certificate known to the server.
56866 </para>
56867 <section id="SECTexternsoptions">
56868 <title>External options</title>
56869 <para>
56870 <indexterm role="concept">
56871 <primary>options</primary>
56872 <secondary><command>external</command> authenticator (server)</secondary>
56873 </indexterm>
56874 The <command>external</command> authenticator has two server options:
56875 </para>
56876 <para>
56877 <indexterm role="option">
56878 <primary><option>server_param2</option></primary>
56879 </indexterm>
56880 </para>
56881 <informaltable frame="all">
56882 <tgroup cols="4" colsep="0" rowsep="0">
56883 <colspec colwidth="8*" align="left"/>
56884 <colspec colwidth="6*" align="center"/>
56885 <colspec colwidth="6*" align="center"/>
56886 <colspec colwidth="6*" align="right"/>
56887 <tbody>
56888 <row>
56889 <entry><option>server_param2</option></entry>
56890 <entry>Use: <emphasis>external</emphasis></entry>
56891 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56892 <entry>Default: <emphasis>unset</emphasis></entry>
56893 </row>
56894 </tbody>
56895 </tgroup>
56896 </informaltable>
56897 <para>
56898 <indexterm role="option">
56899 <primary><option>server_param3</option></primary>
56900 </indexterm>
56901 </para>
56902 <informaltable frame="all">
56903 <tgroup cols="4" colsep="0" rowsep="0">
56904 <colspec colwidth="8*" align="left"/>
56905 <colspec colwidth="6*" align="center"/>
56906 <colspec colwidth="6*" align="center"/>
56907 <colspec colwidth="6*" align="right"/>
56908 <tbody>
56909 <row>
56910 <entry><option>server_param3</option></entry>
56911 <entry>Use: <emphasis>external</emphasis></entry>
56912 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
56913 <entry>Default: <emphasis>unset</emphasis></entry>
56914 </row>
56915 </tbody>
56916 </tgroup>
56917 </informaltable>
56918 <para>
56919 <indexterm role="concept">
56920 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
56921 <secondary>in <command>external</command> authenticator</secondary>
56922 </indexterm>
56923 These options are expanded before the <option>server_condition</option> option
56924 and the result are placed in <varname>$auth2</varname> and <varname>$auth3</varname> resectively.
56925 If the expansion is forced to fail, authentication fails. Any other expansion
56926 failure causes a temporary error code to be returned.
56927 </para>
56928 <para>
56929 They can be used to clarify the coding of a complex <option>server_condition</option>.
56930 </para>
56931 </section>
56932 <section id="SECTexternserver">
56933 <title>Using external in a server</title>
56934 <para>
56935 <indexterm role="concept">
56936 <primary>AUTH</primary>
56937 <secondary>in <command>external</command> authenticator</secondary>
56938 </indexterm>
56939 <indexterm role="concept">
56940 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
56941 <secondary>in <command>external</command> authenticator</secondary>
56942 </indexterm>
56943 <indexterm role="variable">
56944 <primary><varname>$auth1</varname>, <varname>$auth2</varname>, etc</primary>
56945 </indexterm>
56946 <indexterm role="concept">
56947 <primary>base64 encoding</primary>
56948 <secondary>in <command>external</command> authenticator</secondary>
56949 </indexterm>
56950 </para>
56951 <para>
56952 When running as a server, <command>external</command> performs the authentication test by
56953 expanding a string. The data sent by the client with the AUTH command, or in
56954 response to subsequent prompts, is base64 encoded, and so may contain any byte
56955 values when decoded. The decoded value is treated as
56956 an identity for authentication and
56957 placed in the expansion variable <varname>$auth1</varname>.
56958 </para>
56959 <para>
56960 For compatibility with previous releases of Exim, the value is also placed in
56961 the expansion variable <varname>$1</varname>. However, the use of this
56962 variable for this purpose is now deprecated, as it can lead to confusion in
56963 string expansions that also use them for other things.
56964 </para>
56965 <para>
56966 <indexterm role="variable">
56967 <primary><varname>$authenticated_id</varname></primary>
56968 </indexterm>
56969 Once an identity has been received,
56970 <option>server_condition</option> is expanded. If the expansion is forced to fail,
56971 authentication fails. Any other expansion failure causes a temporary error code
56972 to be returned. If the result of a successful expansion is an empty string,
56973 <quote>0</quote>, <quote>no</quote>, or <quote>false</quote>, authentication fails. If the result of the
56974 expansion is <quote>1</quote>, <quote>yes</quote>, or <quote>true</quote>, authentication succeeds and the
56975 generic <option>server_set_id</option> option is expanded and saved in <varname>$authenticated_id</varname>.
56976 For any other result, a temporary error code is returned, with the expanded
56977 string as the error text.
56978 </para>
56979 <para>
56980 Example:
56981 </para>
56982 <literallayout class="monospaced">
56983 ext_ccert_san_mail:
56984   driver =            external
56985   public_name =       EXTERNAL
56986
56987   server_advertise_condition = $tls_in_certificate_verified
56988   server_param2 =     ${certextract {subj_altname,mail,&gt;:} \
56989                                     {$tls_in_peercert}}
56990   server_condition =  ${if forany {$auth2} \
56991                             {eq {$item}{$auth1}}}
56992   server_set_id =     $auth1
56993 </literallayout>
56994 <para>
56995 This accepts a client certificate that is verifiable against any
56996 of your configured trust-anchors
56997 (which usually means the full set of public CAs)
56998 and which has a mail-SAN matching the claimed identity sent by the client.
56999 </para>
57000 <para>
57001 <emphasis role="bold">Note</emphasis>: up to TLS1.2, the client cert is on the wire in-clear, including the SAN.
57002 The account name is therefore guessable by an opponent.
57003 TLS 1.3 protects both server and client certificates, and is not vulnerable
57004 in this way.
57005 </para>
57006 </section>
57007 <section id="SECTexternclient">
57008 <title>Using external in a client</title>
57009 <para>
57010 <indexterm role="concept">
57011 <primary>options</primary>
57012 <secondary><command>external</command> authenticator (client)</secondary>
57013 </indexterm>
57014 The <command>external</command> authenticator has one client option:
57015 </para>
57016 <para>
57017 <indexterm role="option">
57018 <primary><option>client_send</option></primary>
57019 </indexterm>
57020 </para>
57021 <informaltable frame="all">
57022 <tgroup cols="4" colsep="0" rowsep="0">
57023 <colspec colwidth="8*" align="left"/>
57024 <colspec colwidth="6*" align="center"/>
57025 <colspec colwidth="6*" align="center"/>
57026 <colspec colwidth="6*" align="right"/>
57027 <tbody>
57028 <row>
57029 <entry><option>client_send</option></entry>
57030 <entry>Use: <emphasis>external</emphasis></entry>
57031 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57032 <entry>Default: <emphasis>unset</emphasis></entry>
57033 </row>
57034 </tbody>
57035 </tgroup>
57036 </informaltable>
57037 <para>
57038 This option is expanded and sent with the AUTH command as the
57039 identity being asserted.
57040 </para>
57041 <para>
57042 Example:
57043 </para>
57044 <literallayout class="monospaced">
57045 ext_ccert:
57046   driver =      external
57047   public_name = EXTERNAL
57048
57049   client_condition = ${if !eq{$tls_out_cipher}{}}
57050   client_send = myaccount@smarthost.example.net
57051 </literallayout>
57052 <para>
57053 <indexterm role="concept" startref="IIDexternauth1" class="endofrange"/>
57054 <indexterm role="concept" startref="IIDexternauth2" class="endofrange"/>
57055 </para>
57056 </section>
57057 </chapter>
57058
57059 <chapter id="CHAPtlsauth">
57060 <title>The tls authenticator</title>
57061 <para>
57062 <indexterm role="concept" id="IIDtlsauth1" class="startofrange">
57063 <primary><command>tls</command> authenticator</primary>
57064 </indexterm>
57065 <indexterm role="concept" id="IIDtlsauth2" class="startofrange">
57066 <primary>authenticators</primary>
57067 <secondary><command>tls</command></secondary>
57068 </indexterm>
57069 <indexterm role="concept">
57070 <primary>authentication</primary>
57071 <secondary>Client Certificate</secondary>
57072 </indexterm>
57073 <indexterm role="concept">
57074 <primary>authentication</primary>
57075 <secondary>X509</secondary>
57076 </indexterm>
57077 <indexterm role="concept">
57078 <primary>Certificate-based authentication</primary>
57079 </indexterm>
57080 The <command>tls</command> authenticator provides server support for
57081 authentication based on client certificates.
57082 </para>
57083 <para>
57084 It is not an SMTP authentication mechanism and is not
57085 advertised by the server as part of the SMTP EHLO response.
57086 It is an Exim authenticator in the sense that it affects
57087 the protocol element of the log line, can be tested for
57088 by the <option>authenticated</option> ACL condition, and can set
57089 the <varname>$authenticated_id</varname> variable.
57090 </para>
57091 <para>
57092 The client must present a verifiable certificate,
57093 for which it must have been requested via the
57094 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> main options
57095 (see <xref linkend="CHAPTLS"/>).
57096 </para>
57097 <para>
57098 If an authenticator of this type is configured it is
57099 run before any SMTP-level communication is done,
57100 and can authenticate the connection.
57101 If it does, SMTP authentication is not offered.
57102 </para>
57103 <para>
57104 A maximum of one authenticator of this type may be present.
57105 </para>
57106 <para>
57107 <indexterm role="concept">
57108 <primary>options</primary>
57109 <secondary><command>tls</command> authenticator (server)</secondary>
57110 </indexterm>
57111 The <command>tls</command> authenticator has three server options:
57112 </para>
57113 <para>
57114 <indexterm role="option">
57115 <primary><option>server_param1</option></primary>
57116 </indexterm>
57117 </para>
57118 <informaltable frame="all">
57119 <tgroup cols="4" colsep="0" rowsep="0">
57120 <colspec colwidth="8*" align="left"/>
57121 <colspec colwidth="6*" align="center"/>
57122 <colspec colwidth="6*" align="center"/>
57123 <colspec colwidth="6*" align="right"/>
57124 <tbody>
57125 <row>
57126 <entry><option>server_param1</option></entry>
57127 <entry>Use: <emphasis>tls</emphasis></entry>
57128 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57129 <entry>Default: <emphasis>unset</emphasis></entry>
57130 </row>
57131 </tbody>
57132 </tgroup>
57133 </informaltable>
57134 <para>
57135 <indexterm role="concept">
57136 <primary>variables (<varname>$auth1</varname> <varname>$auth2</varname> etc)</primary>
57137 <secondary>in <command>tls</command> authenticator</secondary>
57138 </indexterm>
57139 This option is expanded after the TLS negotiation and
57140 the result is placed in <varname>$auth1</varname>.
57141 If the expansion is forced to fail, authentication fails. Any other expansion
57142 failure causes a temporary error code to be returned.
57143 </para>
57144 <para>
57145 <indexterm role="option">
57146 <primary><option>server_param2</option></primary>
57147 </indexterm>
57148 </para>
57149 <informaltable frame="all">
57150 <tgroup cols="4" colsep="0" rowsep="0">
57151 <colspec colwidth="8*" align="left"/>
57152 <colspec colwidth="6*" align="center"/>
57153 <colspec colwidth="6*" align="center"/>
57154 <colspec colwidth="6*" align="right"/>
57155 <tbody>
57156 <row>
57157 <entry><option>server_param2</option></entry>
57158 <entry>Use: <emphasis>tls</emphasis></entry>
57159 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57160 <entry>Default: <emphasis>unset</emphasis></entry>
57161 </row>
57162 </tbody>
57163 </tgroup>
57164 </informaltable>
57165 <para>
57166 <indexterm role="option">
57167 <primary><option>server_param3</option></primary>
57168 </indexterm>
57169 </para>
57170 <informaltable frame="all">
57171 <tgroup cols="4" colsep="0" rowsep="0">
57172 <colspec colwidth="8*" align="left"/>
57173 <colspec colwidth="6*" align="center"/>
57174 <colspec colwidth="6*" align="center"/>
57175 <colspec colwidth="6*" align="right"/>
57176 <tbody>
57177 <row>
57178 <entry><option>server_param3</option></entry>
57179 <entry>Use: <emphasis>tls</emphasis></entry>
57180 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
57181 <entry>Default: <emphasis>unset</emphasis></entry>
57182 </row>
57183 </tbody>
57184 </tgroup>
57185 </informaltable>
57186 <para>
57187 As above, for <varname>$auth2</varname> and <varname>$auth3</varname>.
57188 </para>
57189 <para>
57190 <option>server_param1</option> may also be spelled <option>server_param</option>.
57191 </para>
57192 <para>
57193 Example:
57194 </para>
57195 <literallayout class="monospaced">
57196 tls:
57197   driver = tls
57198   server_param1 =     ${certextract {subj_altname,mail,&gt;:} \
57199                                     {$tls_in_peercert}}
57200   server_condition =  ${if and { {eq{$tls_in_certificate_verified}{1}} \
57201                                  {forany {$auth1} \
57202                             {!= {0} \
57203                                 {${lookup ldap{ldap:///\
57204                          mailname=${quote_ldap_dn:${lc:$item}},\
57205                          ou=users,LDAP_DC?mailid} {$value}{0} \
57206                        }    }  } }}}
57207   server_set_id =     ${if = {1}{${listcount:$auth1}} {$auth1}{}}
57208 </literallayout>
57209 <para>
57210 This accepts a client certificate that is verifiable against any
57211 of your configured trust-anchors
57212 (which usually means the full set of public CAs)
57213 and which has a SAN with a good account name.
57214 </para>
57215 <para>
57216 Note that, up to TLS1.2, the client cert is on the wire in-clear, including the SAN,
57217 The account name is therefore guessable by an opponent.
57218 TLS 1.3 protects both server and client certificates, and is not vulnerable
57219 in this way.
57220 Likewise, a traditional plaintext SMTP AUTH done inside TLS is not.
57221 </para>
57222 <para>
57223 <indexterm role="concept" startref="IIDtlsauth1" class="endofrange"/>
57224 <indexterm role="concept" startref="IIDtlsauth2" class="endofrange"/>
57225 </para>
57226 <para>
57227 Note that because authentication is traditionally an SMTP operation,
57228 the <option>authenticated</option> ACL condition cannot be used in
57229 a connect- or helo-ACL.
57230 </para>
57231 </chapter>
57232
57233 <chapter id="CHAPTLS">
57234 <title>Encrypted SMTP connections using TLS/SSL</title>
57235 <titleabbrev>Encrypted SMTP connections</titleabbrev>
57236 <para>
57237 <indexterm role="concept" id="IIDencsmtp1" class="startofrange">
57238 <primary>encryption</primary>
57239 <secondary>on SMTP connection</secondary>
57240 </indexterm>
57241 <indexterm role="concept" id="IIDencsmtp2" class="startofrange">
57242 <primary>SMTP</primary>
57243 <secondary>encryption</secondary>
57244 </indexterm>
57245 <indexterm role="concept">
57246 <primary>TLS</primary>
57247 <secondary>on SMTP connection</secondary>
57248 </indexterm>
57249 <indexterm role="concept">
57250 <primary>OpenSSL</primary>
57251 </indexterm>
57252 <indexterm role="concept">
57253 <primary>GnuTLS</primary>
57254 </indexterm>
57255 Support for TLS (Transport Layer Security), formerly known as SSL (Secure
57256 Sockets Layer), is implemented by making use of the OpenSSL library or the
57257 GnuTLS library (Exim requires GnuTLS release 1.0 or later). There is no
57258 cryptographic code in the Exim distribution itself for implementing TLS. In
57259 order to use this feature you must install OpenSSL or GnuTLS, and then build a
57260 version of Exim that includes TLS support (see section <xref linkend="SECTinctlsssl"/>).
57261 You also need to understand the basic concepts of encryption at a managerial
57262 level, and in particular, the way that public keys, private keys, and
57263 certificates are used.
57264 </para>
57265 <para>
57266 RFC 3207 defines how SMTP connections can make use of encryption. Once a
57267 connection is established, the client issues a STARTTLS command. If the
57268 server accepts this, the client and the server negotiate an encryption
57269 mechanism. If the negotiation succeeds, the data that subsequently passes
57270 between them is encrypted.
57271 </para>
57272 <para>
57273 Exim&#x2019;s ACLs can detect whether the current SMTP session is encrypted or not,
57274 and if so, what cipher suite is in use, whether the client supplied a
57275 certificate, and whether or not that certificate was verified. This makes it
57276 possible for an Exim server to deny or accept certain commands based on the
57277 encryption state.
57278 </para>
57279 <para>
57280 <emphasis role="bold">Warning</emphasis>: Certain types of firewall and certain anti-virus products can
57281 disrupt TLS connections. You need to turn off SMTP scanning for these products
57282 in order to get TLS to work.
57283 </para>
57284 <section id="SECID284">
57285 <title>Support for the <quote>submissions</quote> (aka <quote>ssmtp</quote> and <quote>smtps</quote>) protocol</title>
57286 <para>
57287 <indexterm role="concept">
57288 <primary>submissions protocol</primary>
57289 </indexterm>
57290 <indexterm role="concept">
57291 <primary>ssmtp protocol</primary>
57292 </indexterm>
57293 <indexterm role="concept">
57294 <primary>smtps protocol</primary>
57295 </indexterm>
57296 <indexterm role="concept">
57297 <primary>SMTP</primary>
57298 <secondary>submissions protocol</secondary>
57299 </indexterm>
57300 <indexterm role="concept">
57301 <primary>SMTP</primary>
57302 <secondary>ssmtp protocol</secondary>
57303 </indexterm>
57304 <indexterm role="concept">
57305 <primary>SMTP</primary>
57306 <secondary>smtps protocol</secondary>
57307 </indexterm>
57308 The history of port numbers for TLS in SMTP is a little messy and has been
57309 contentious.  As of RFC 8314, the common practice of using the historically
57310 allocated port 465 for "email submission but with TLS immediately upon connect
57311 instead of using STARTTLS" is officially blessed by the IETF, and recommended
57312 by them in preference to STARTTLS.
57313 </para>
57314 <para>
57315 The name originally assigned to the port was <quote>ssmtp</quote> or <quote>smtps</quote>, but as
57316 clarity emerged over the dual roles of SMTP, for MX delivery and Email
57317 Submission, nomenclature has shifted.  The modern name is now <quote>submissions</quote>.
57318 </para>
57319 <para>
57320 This approach was, for a while, officially abandoned when encrypted SMTP was
57321 standardized, but many clients kept using it, even as the TCP port number was
57322 reassigned for other use.
57323 Thus you may encounter guidance claiming that you shouldn&#x2019;t enable use of
57324 this port.
57325 In practice, a number of mail-clients have only ever supported submissions,
57326 not submission with STARTTLS upgrade.
57327 Ideally, offer both submission (587) and submissions (465) service.
57328 </para>
57329 <para>
57330 Exim supports TLS-on-connect by means of the <option>tls_on_connect_ports</option>
57331 global option. Its value must be a list of port numbers;
57332 the most common use is expected to be:
57333 </para>
57334 <literallayout class="monospaced">
57335 tls_on_connect_ports = 465
57336 </literallayout>
57337 <para>
57338 The port numbers specified by this option apply to all SMTP connections, both
57339 via the daemon and via <emphasis>inetd</emphasis>. You still need to specify all the ports that
57340 the daemon uses (by setting <option>daemon_smtp_ports</option> or <option>local_interfaces</option> or
57341 the <option>-oX</option> command line option) because <option>tls_on_connect_ports</option> does not add
57342 an extra port &ndash; rather, it specifies different behaviour on a port that is
57343 defined elsewhere.
57344 </para>
57345 <para>
57346 There is also a <option>-tls-on-connect</option> command line option. This overrides
57347 <option>tls_on_connect_ports</option>; it forces the TLS-only behaviour for all ports.
57348 </para>
57349 </section>
57350 <section id="SECTopenvsgnu">
57351 <title>OpenSSL vs GnuTLS</title>
57352 <para>
57353 <indexterm role="concept">
57354 <primary>TLS</primary>
57355 <secondary>OpenSSL <emphasis>vs</emphasis> GnuTLS</secondary>
57356 </indexterm>
57357 TLS is supported in Exim using either the OpenSSL or GnuTLS library.
57358 To build Exim to use OpenSSL you need to set
57359 </para>
57360 <literallayout class="monospaced">
57361 USE_OPENSSL=yes
57362 </literallayout>
57363 <para>
57364 in Local/Makefile.
57365 </para>
57366 <para>
57367 To build Exim to use GnuTLS, you need to set
57368 </para>
57369 <literallayout class="monospaced">
57370 USE_GNUTLS=yes
57371 </literallayout>
57372 <para>
57373 in Local/Makefile.
57374 </para>
57375 <para>
57376 You must also set TLS_LIBS and TLS_INCLUDE appropriately, so that the
57377 include files and libraries for GnuTLS can be found.
57378 </para>
57379 <para>
57380 There are some differences in usage when using GnuTLS instead of OpenSSL:
57381 </para>
57382 <itemizedlist>
57383 <listitem>
57384 <para>
57385 The <option>tls_verify_certificates</option> option
57386 cannot be the path of a directory
57387 for GnuTLS versions before 3.3.6
57388 (for later versions, or OpenSSL, it can be either).
57389 </para>
57390 </listitem>
57391 <listitem>
57392 <para>
57393 The default value for <option>tls_dhparam</option> differs for historical reasons.
57394 </para>
57395 </listitem>
57396 <listitem>
57397 <para>
57398 <indexterm role="variable">
57399 <primary><varname>$tls_in_peerdn</varname></primary>
57400 </indexterm>
57401 <indexterm role="variable">
57402 <primary><varname>$tls_out_peerdn</varname></primary>
57403 </indexterm>
57404 Distinguished Name (DN) strings reported by the OpenSSL library use a slash for
57405 separating fields; GnuTLS uses commas, in accordance with RFC 2253. This
57406 affects the value of the <varname>$tls_in_peerdn</varname> and <varname>$tls_out_peerdn</varname> variables.
57407 </para>
57408 </listitem>
57409 <listitem>
57410 <para>
57411 OpenSSL identifies cipher suites using hyphens as separators, for example:
57412 DES-CBC3-SHA. GnuTLS historically used underscores, for example:
57413 RSA_ARCFOUR_SHA. What is more, OpenSSL complains if underscores are present
57414 in a cipher list. To make life simpler, Exim changes underscores to hyphens
57415 for OpenSSL and passes the string unchanged to GnuTLS (expecting the library
57416 to handle its own older variants) when processing lists of cipher suites in the
57417 <option>tls_require_ciphers</option> options (the global option and the <command>smtp</command> transport
57418 option).
57419 </para>
57420 </listitem>
57421 <listitem>
57422 <para>
57423 The <option>tls_require_ciphers</option> options operate differently, as described in the
57424 sections <xref linkend="SECTreqciphssl"/> and <xref linkend="SECTreqciphgnu"/>.
57425 </para>
57426 </listitem>
57427 <listitem>
57428 <para>
57429 The <option>tls_dh_min_bits</option> SMTP transport option is only honoured by GnuTLS.
57430 When using OpenSSL, this option is ignored.
57431 (If an API is found to let OpenSSL be configured in this way,
57432 let the Exim Maintainers know and we&#x2019;ll likely use it).
57433 </para>
57434 </listitem>
57435 <listitem>
57436 <para>
57437 With GnuTLS, if an explicit list is used for the <option>tls_privatekey</option> main option
57438 main option, it must be ordered to match the <option>tls_certificate</option> list.
57439 </para>
57440 </listitem>
57441 <listitem>
57442 <para>
57443 Some other recently added features may only be available in one or the other.
57444 This should be documented with the feature.  If the documentation does not
57445 explicitly state that the feature is infeasible in the other TLS
57446 implementation, then patches are welcome.
57447 </para>
57448 </listitem>
57449 <listitem>
57450 <para>
57451 The output from "exim -bV" will show which (if any) support was included
57452 in the build.
57453 Also, the macro "_HAVE_OPENSSL" or "_HAVE_GNUTLS" will be defined.
57454 </para>
57455 </listitem>
57456 </itemizedlist>
57457 </section>
57458 <section id="SECTgnutlsparam">
57459 <title>GnuTLS parameter computation</title>
57460 <para>
57461 This section only applies if <option>tls_dhparam</option> is set to <literal>historic</literal> or to
57462 an explicit path; if the latter, then the text about generation still applies,
57463 but not the chosen filename.
57464 By default, as of Exim 4.80 a hard-coded D-H prime is used.
57465 See the documentation of <option>tls_dhparam</option> for more information.
57466 </para>
57467 <para>
57468 GnuTLS uses D-H parameters that may take a substantial amount of time
57469 to compute. It is unreasonable to re-compute them for every TLS session.
57470 Therefore, Exim keeps this data in a file in its spool directory, called
57471 <filename>gnutls-params-NNNN</filename> for some value of NNNN, corresponding to the number
57472 of bits requested.
57473 The file is owned by the Exim user and is readable only by
57474 its owner. Every Exim process that start up GnuTLS reads the D-H
57475 parameters from this file. If the file does not exist, the first Exim process
57476 that needs it computes the data and writes it to a temporary file which is
57477 renamed once it is complete. It does not matter if several Exim processes do
57478 this simultaneously (apart from wasting a few resources). Once a file is in
57479 place, new Exim processes immediately start using it.
57480 </para>
57481 <para>
57482 For maximum security, the parameters that are stored in this file should be
57483 recalculated periodically, the frequency depending on your paranoia level.
57484 If you are avoiding using the fixed D-H primes published in RFCs, then you
57485 are concerned about some advanced attacks and will wish to do this; if you do
57486 not regenerate then you might as well stick to the standard primes.
57487 </para>
57488 <para>
57489 Arranging this is easy in principle; just delete the file when you want new
57490 values to be computed. However, there may be a problem. The calculation of new
57491 parameters needs random numbers, and these are obtained from <filename>/dev/random</filename>.
57492 If the system is not very active, <filename>/dev/random</filename> may delay returning data
57493 until enough randomness (entropy) is available. This may cause Exim to hang for
57494 a substantial amount of time, causing timeouts on incoming connections.
57495 </para>
57496 <para>
57497 The solution is to generate the parameters externally to Exim. They are stored
57498 in <filename>gnutls-params-N</filename> in PEM format, which means that they can be
57499 generated externally using the <command>certtool</command> command that is part of GnuTLS.
57500 </para>
57501 <para>
57502 To replace the parameters with new ones, instead of deleting the file
57503 and letting Exim re-create it, you can generate new parameters using
57504 <command>certtool</command> and, when this has been done, replace Exim&#x2019;s cache file by
57505 renaming. The relevant commands are something like this:
57506 </para>
57507 <literallayout class="monospaced">
57508 # ls
57509 [ look for file; assume gnutls-params-2236 is the most recent ]
57510 # rm -f new-params
57511 # touch new-params
57512 # chown exim:exim new-params
57513 # chmod 0600 new-params
57514 # certtool --generate-dh-params --bits 2236 &gt;&gt;new-params
57515 # openssl dhparam -noout -text -in new-params | head
57516 [ check the first line, make sure it's not more than 2236;
57517   if it is, then go back to the start ("rm") and repeat
57518   until the size generated is at most the size requested ]
57519 # chmod 0400 new-params
57520 # mv new-params gnutls-params-2236
57521 </literallayout>
57522 <para>
57523 If Exim never has to generate the parameters itself, the possibility of
57524 stalling is removed.
57525 </para>
57526 <para>
57527 The filename changed in Exim 4.80, to gain the -bits suffix.  The value which
57528 Exim will choose depends upon the version of GnuTLS in use.  For older GnuTLS,
57529 the value remains hard-coded in Exim as 1024.  As of GnuTLS 2.12.x, there is
57530 a way for Exim to ask for the "normal" number of bits for D-H public-key usage,
57531 and Exim does so.  This attempt to remove Exim from TLS policy decisions
57532 failed, as GnuTLS 2.12 returns a value higher than the current hard-coded limit
57533 of the NSS library.  Thus Exim gains the <option>tls_dh_max_bits</option> global option,
57534 which applies to all D-H usage, client or server.  If the value returned by
57535 GnuTLS is greater than <option>tls_dh_max_bits</option> then the value will be clamped down
57536 to <option>tls_dh_max_bits</option>.  The default value has been set at the current NSS
57537 limit, which is still much higher than Exim historically used.
57538 </para>
57539 <para>
57540 The filename and bits used will change as the GnuTLS maintainers change the
57541 value for their parameter <literal>GNUTLS_SEC_PARAM_NORMAL</literal>, as clamped by
57542 <option>tls_dh_max_bits</option>.  At the time of writing (mid 2012), GnuTLS 2.12 recommends
57543 2432 bits, while NSS is limited to 2236 bits.
57544 </para>
57545 <para>
57546 In fact, the requested value will be *lower* than <option>tls_dh_max_bits</option>, to
57547 increase the chance of the generated prime actually being within acceptable
57548 bounds, as GnuTLS has been observed to overshoot.  Note the check step in the
57549 procedure above.  There is no sane procedure available to Exim to double-check
57550 the size of the generated prime, so it might still be too large.
57551 </para>
57552 </section>
57553 <section id="SECTreqciphssl">
57554 <title>Requiring specific ciphers in OpenSSL</title>
57555 <para>
57556 <indexterm role="concept">
57557 <primary>TLS</primary>
57558 <secondary>requiring specific ciphers (OpenSSL)</secondary>
57559 </indexterm>
57560 <indexterm role="option">
57561 <primary><option>tls_require_ciphers</option></primary>
57562 <secondary>OpenSSL</secondary>
57563 </indexterm>
57564 There is a function in the OpenSSL library that can be passed a list of cipher
57565 suites before the cipher negotiation takes place. This specifies which ciphers
57566 are acceptable for TLS versions prior to 1.3.
57567 The list is colon separated and may contain names like
57568 DES-CBC3-SHA. Exim passes the expanded value of <option>tls_require_ciphers</option>
57569 directly to this function call.
57570 Many systems will install the OpenSSL manual-pages, so you may have
57571 <emphasis>ciphers(1)</emphasis> available to you.
57572 The following quotation from the OpenSSL
57573 documentation specifies what forms of item are allowed in the cipher string:
57574 </para>
57575 <itemizedlist>
57576 <listitem>
57577 <para>
57578 It can consist of a single cipher suite such as RC4-SHA.
57579 </para>
57580 </listitem>
57581 <listitem>
57582 <para>
57583 It can represent a list of cipher suites containing a certain algorithm,
57584 or cipher suites of a certain type. For example SHA1 represents all
57585 ciphers suites using the digest algorithm SHA1 and SSLv3 represents all
57586 SSL v3 algorithms.
57587 </para>
57588 </listitem>
57589 <listitem>
57590 <para>
57591 Lists of cipher suites can be combined in a single cipher string using
57592 the + character. This is used as a logical and operation. For example
57593 SHA1+DES represents all cipher suites containing the SHA1 and the DES
57594 algorithms.
57595 </para>
57596 </listitem>
57597 </itemizedlist>
57598 <para>
57599 Each cipher string can be optionally preceded by one of the characters <literal>!</literal>,
57600 <literal>-</literal> or <literal>+</literal>.
57601 </para>
57602 <itemizedlist>
57603 <listitem>
57604 <para>
57605 If <literal>!</literal> is used, the ciphers are permanently deleted from the list. The
57606 ciphers deleted can never reappear in the list even if they are explicitly
57607 stated.
57608 </para>
57609 </listitem>
57610 <listitem>
57611 <para>
57612 If <literal>-</literal> is used, the ciphers are deleted from the list, but some or all
57613 of the ciphers can be added again by later options.
57614 </para>
57615 </listitem>
57616 <listitem>
57617 <para>
57618 If <literal>+</literal> is used, the ciphers are moved to the end of the list. This
57619 option does not add any new ciphers; it just moves matching existing ones.
57620 </para>
57621 </listitem>
57622 </itemizedlist>
57623 <para>
57624 If none of these characters is present, the string is interpreted as
57625 a list of ciphers to be appended to the current preference list. If the list
57626 includes any ciphers already present they will be ignored: that is, they will
57627 not be moved to the end of the list.
57628 </para>
57629 <para>
57630 The OpenSSL <emphasis>ciphers(1)</emphasis> command may be used to test the results of a given
57631 string:
57632 </para>
57633 <literallayout class="monospaced">
57634 # note single-quotes to get ! past any shell history expansion
57635 $ openssl ciphers 'HIGH:!MD5:!SHA1'
57636 </literallayout>
57637 <para>
57638 This example will let the library defaults be permitted on the MX port, where
57639 there&#x2019;s probably no identity verification anyway, but ups the ante on the
57640 submission ports where the administrator might have some influence on the
57641 choice of clients used:
57642 </para>
57643 <literallayout class="monospaced">
57644 # OpenSSL variant; see man ciphers(1)
57645 tls_require_ciphers = ${if =={$received_port}{25}\
57646                            {DEFAULT}\
57647                            {HIGH:!MD5:!SHA1}}
57648 </literallayout>
57649 <para>
57650 This example will prefer ECDSA-authenticated ciphers over RSA ones:
57651 </para>
57652 <literallayout class="monospaced">
57653 tls_require_ciphers = ECDSA:RSA:!COMPLEMENTOFDEFAULT
57654 </literallayout>
57655 <para>
57656 For TLS version 1.3 the control available is less fine-grained
57657 and Exim does not provide access to it at present.
57658 The value of the <option>tls_require_ciphers</option> option is ignored when
57659 TLS version 1.3 is negotiated.
57660 </para>
57661 <para>
57662 As of writing the library default cipher suite list for TLSv1.3 is
57663 </para>
57664 <literallayout class="monospaced">
57665 TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
57666 </literallayout>
57667 </section>
57668 <section id="SECTreqciphgnu">
57669 <title>Requiring specific ciphers or other parameters in GnuTLS</title>
57670 <para>
57671 <indexterm role="concept">
57672 <primary>GnuTLS</primary>
57673 <secondary>specifying parameters for</secondary>
57674 </indexterm>
57675 <indexterm role="concept">
57676 <primary>TLS</primary>
57677 <secondary>specifying ciphers (GnuTLS)</secondary>
57678 </indexterm>
57679 <indexterm role="concept">
57680 <primary>TLS</primary>
57681 <secondary>specifying key exchange methods (GnuTLS)</secondary>
57682 </indexterm>
57683 <indexterm role="concept">
57684 <primary>TLS</primary>
57685 <secondary>specifying MAC algorithms (GnuTLS)</secondary>
57686 </indexterm>
57687 <indexterm role="concept">
57688 <primary>TLS</primary>
57689 <secondary>specifying protocols (GnuTLS)</secondary>
57690 </indexterm>
57691 <indexterm role="concept">
57692 <primary>TLS</primary>
57693 <secondary>specifying priority string (GnuTLS)</secondary>
57694 </indexterm>
57695 <indexterm role="option">
57696 <primary><option>tls_require_ciphers</option></primary>
57697 <secondary>GnuTLS</secondary>
57698 </indexterm>
57699 The GnuTLS library allows the caller to provide a "priority string", documented
57700 as part of the <function>gnutls_priority_init</function> function.  This is very similar to the
57701 ciphersuite specification in OpenSSL.
57702 </para>
57703 <para>
57704 The <option>tls_require_ciphers</option> option is treated as the GnuTLS priority string
57705 and controls both protocols and ciphers.
57706 </para>
57707 <para>
57708 The <option>tls_require_ciphers</option> option is available both as an global option,
57709 controlling how Exim behaves as a server, and also as an option of the
57710 <command>smtp</command> transport, controlling how Exim behaves as a client.  In both cases
57711 the value is string expanded.  The resulting string is not an Exim list and
57712 the string is given to the GnuTLS library, so that Exim does not need to be
57713 aware of future feature enhancements of GnuTLS.
57714 </para>
57715 <para>
57716 Documentation of the strings accepted may be found in the GnuTLS manual, under
57717 "Priority strings".  This is online as
57718 <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>,
57719 but beware that this relates to GnuTLS 3, which may be newer than the version
57720 installed on your system.  If you are using GnuTLS 3,
57721 then the example code
57722 <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>
57723 on that site can be used to test a given string.
57724 </para>
57725 <para>
57726 For example:
57727 </para>
57728 <literallayout class="monospaced">
57729 # Disable older versions of protocols
57730 tls_require_ciphers = NORMAL:%LATEST_RECORD_VERSION:-VERS-SSL3.0
57731 </literallayout>
57732 <para>
57733 Prior to Exim 4.80, an older API of GnuTLS was used, and Exim supported three
57734 additional options, "<option>gnutls_require_kx</option>", "<option>gnutls_require_mac</option>" and
57735 "<option>gnutls_require_protocols</option>".  <option>tls_require_ciphers</option> was an Exim list.
57736 </para>
57737 <para>
57738 This example will let the library defaults be permitted on the MX port, where
57739 there&#x2019;s probably no identity verification anyway, and lowers security further
57740 by increasing compatibility; but this ups the ante on the submission ports
57741 where the administrator might have some influence on the choice of clients
57742 used:
57743 </para>
57744 <literallayout class="monospaced">
57745 # GnuTLS variant
57746 tls_require_ciphers = ${if =={$received_port}{25}\
57747                            {NORMAL:%COMPAT}\
57748                            {SECURE128}}
57749 </literallayout>
57750 </section>
57751 <section id="SECID182">
57752 <title>Configuring an Exim server to use TLS</title>
57753 <para>
57754 <indexterm role="concept">
57755 <primary>TLS</primary>
57756 <secondary>configuring an Exim server</secondary>
57757 </indexterm>
57758 <indexterm role="concept">
57759 <primary>ESMTP extensions</primary>
57760 <secondary>STARTTLS</secondary>
57761 </indexterm>
57762 When Exim has been built with TLS support, it advertises the availability of
57763 the STARTTLS command to client hosts that match <option>tls_advertise_hosts</option>,
57764 but not to any others. The default value of this option is *, which means
57765 that STARTTLS is always advertised.  Set it to blank to never advertise;
57766 this is reasonable for systems that want to use TLS only as a client.
57767 </para>
57768 <para>
57769 If STARTTLS is to be used you
57770 need to set some other options in order to make TLS available.
57771 </para>
57772 <para>
57773 If a client issues a STARTTLS command and there is some configuration
57774 problem in the server, the command is rejected with a 454 error. If the client
57775 persists in trying to issue SMTP commands, all except QUIT are rejected
57776 with the error
57777 </para>
57778 <literallayout class="monospaced">
57779 554 Security failure
57780 </literallayout>
57781 <para>
57782 If a STARTTLS command is issued within an existing TLS session, it is
57783 rejected with a 554 error code.
57784 </para>
57785 <para>
57786 To enable TLS operations on a server, the <option>tls_advertise_hosts</option> option
57787 must be set to match some hosts. The default is * which matches all hosts.
57788 </para>
57789 <para>
57790 If this is all you do, TLS encryption will be enabled but not authentication -
57791 meaning that the peer has no assurance it is actually you he is talking to.
57792 You gain protection from a passive sniffer listening on the wire but not
57793 from someone able to intercept the communication.
57794 </para>
57795 <para>
57796 Further protection requires some further configuration at the server end.
57797 </para>
57798 <para>
57799 To make TLS work you need to set, in the server,
57800 </para>
57801 <literallayout class="monospaced">
57802 tls_certificate = /some/file/name
57803 tls_privatekey = /some/file/name
57804 </literallayout>
57805 <para>
57806 These options are, in fact, expanded strings, so you can make them depend on
57807 the identity of the client that is connected if you wish. The first file
57808 contains the server&#x2019;s X509 certificate, and the second contains the private key
57809 that goes with it. These files need to be
57810 PEM format and readable by the Exim user, and must
57811 always be given as full path names.
57812 The key must not be password-protected.
57813 They can be the same file if both the
57814 certificate and the key are contained within it. If <option>tls_privatekey</option> is not
57815 set, or if its expansion is forced to fail or results in an empty string, this
57816 is assumed to be the case. The certificate file may also contain intermediate
57817 certificates that need to be sent to the client to enable it to authenticate
57818 the server&#x2019;s certificate.
57819 </para>
57820 <para>
57821 For dual-stack (eg. RSA and ECDSA) configurations, these options can be
57822 colon-separated lists of file paths.  Ciphers using given authentication
57823 algorithms require the presence of a suitable certificate to supply the
57824 public-key.  The server selects among the certificates to present to the
57825 client depending on the selected cipher, hence the priority ordering for
57826 ciphers will affect which certificate is used.
57827 </para>
57828 <para>
57829 If you do not understand about certificates and keys, please try to find a
57830 source of this background information, which is not Exim-specific. (There are a
57831 few comments below in section <xref linkend="SECTcerandall"/>.)
57832 </para>
57833 <para>
57834 <emphasis role="bold">Note</emphasis>: These options do not apply when Exim is operating as a client &ndash;
57835 they apply only in the case of a server. If you need to use a certificate in an
57836 Exim client, you must set the options of the same names in an <command>smtp</command>
57837 transport.
57838 </para>
57839 <para>
57840 With just these options, an Exim server will be able to use TLS. It does not
57841 require the client to have a certificate (but see below for how to insist on
57842 this). There is one other option that may be needed in other situations. If
57843 </para>
57844 <literallayout class="monospaced">
57845 tls_dhparam = /some/file/name
57846 </literallayout>
57847 <para>
57848 is set, the SSL library is initialized for the use of Diffie-Hellman ciphers
57849 with the parameters contained in the file.
57850 Set this to <literal>none</literal> to disable use of DH entirely, by making no prime
57851 available:
57852 </para>
57853 <literallayout class="monospaced">
57854 tls_dhparam = none
57855 </literallayout>
57856 <para>
57857 This may also be set to a string identifying a standard prime to be used for
57858 DH; if it is set to <literal>default</literal> or, for OpenSSL, is unset, then the prime
57859 used is <literal>ike23</literal>.  There are a few standard primes available, see the
57860 documentation for <option>tls_dhparam</option> for the complete list.
57861 </para>
57862 <para>
57863 See the command
57864 </para>
57865 <literallayout class="monospaced">
57866 openssl dhparam
57867 </literallayout>
57868 <para>
57869 for a way of generating file data.
57870 </para>
57871 <para>
57872 The strings supplied for these three options are expanded every time a client
57873 host connects. It is therefore possible to use different certificates and keys
57874 for different hosts, if you so wish, by making use of the client&#x2019;s IP address
57875 in <varname>$sender_host_address</varname> to control the expansion. If a string expansion is
57876 forced to fail, Exim behaves as if the option is not set.
57877 </para>
57878 <para>
57879 <indexterm role="concept">
57880 <primary>cipher</primary>
57881 <secondary>logging</secondary>
57882 </indexterm>
57883 <indexterm role="concept">
57884 <primary>log</primary>
57885 <secondary>TLS cipher</secondary>
57886 </indexterm>
57887 <indexterm role="variable">
57888 <primary><varname>$tls_in_cipher</varname></primary>
57889 </indexterm>
57890 The variable <varname>$tls_in_cipher</varname> is set to the cipher suite that was negotiated for
57891 an incoming TLS connection. It is included in the <emphasis>Received:</emphasis> header of an
57892 incoming message (by default &ndash; you can, of course, change this), and it is
57893 also included in the log line that records a message&#x2019;s arrival, keyed by
57894 <quote>X=</quote>, unless the <option>tls_cipher</option> log selector is turned off. The <option>encrypted</option>
57895 condition can be used to test for specific cipher suites in ACLs.
57896 </para>
57897 <para>
57898 Once TLS has been established, the ACLs that run for subsequent SMTP commands
57899 can check the name of the cipher suite and vary their actions accordingly. The
57900 cipher suite names vary, depending on which TLS library is being used. For
57901 example, OpenSSL uses the name DES-CBC3-SHA for the cipher suite which in other
57902 contexts is known as TLS_RSA_WITH_3DES_EDE_CBC_SHA. Check the OpenSSL or GnuTLS
57903 documentation for more details.
57904 </para>
57905 <para>
57906 For outgoing SMTP deliveries, <varname>$tls_out_cipher</varname> is used and logged
57907 (again depending on the <option>tls_cipher</option> log selector).
57908 </para>
57909 </section>
57910 <section id="SECID183">
57911 <title>Requesting and verifying client certificates</title>
57912 <para>
57913 <indexterm role="concept">
57914 <primary>certificate</primary>
57915 <secondary>verification of client</secondary>
57916 </indexterm>
57917 <indexterm role="concept">
57918 <primary>TLS</primary>
57919 <secondary>client certificate verification</secondary>
57920 </indexterm>
57921 If you want an Exim server to request a certificate when negotiating a TLS
57922 session with a client, you must set either <option>tls_verify_hosts</option> or
57923 <option>tls_try_verify_hosts</option>. You can, of course, set either of them to * to
57924 apply to all TLS connections. For any host that matches one of these options,
57925 Exim requests a certificate as part of the setup of the TLS session. The
57926 contents of the certificate are verified by comparing it with a list of
57927 expected trust-anchors or certificates.
57928 These may be the system default set (depending on library version),
57929 an explicit file or,
57930 depending on library version, a directory, identified by
57931 <option>tls_verify_certificates</option>.
57932 </para>
57933 <para>
57934 A file can contain multiple certificates, concatenated end to end. If a
57935 directory is used
57936 (OpenSSL only),
57937 each certificate must be in a separate file, with a name (or a symbolic link)
57938 of the form &lt;<emphasis>hash</emphasis>&gt;.0, where &lt;<emphasis>hash</emphasis>&gt; is a hash value constructed from the
57939 certificate. You can compute the relevant hash by running the command
57940 </para>
57941 <literallayout class="monospaced">
57942 openssl x509 -hash -noout -in /cert/file
57943 </literallayout>
57944 <para>
57945 where <filename>/cert/file</filename> contains a single certificate.
57946 </para>
57947 <para>
57948 There is no checking of names of the client against the certificate
57949 Subject Name or Subject Alternate Names.
57950 </para>
57951 <para>
57952 The difference between <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> is
57953 what happens if the client does not supply a certificate, or if the certificate
57954 does not match any of the certificates in the collection named by
57955 <option>tls_verify_certificates</option>. If the client matches <option>tls_verify_hosts</option>, the
57956 attempt to set up a TLS session is aborted, and the incoming connection is
57957 dropped. If the client matches <option>tls_try_verify_hosts</option>, the (encrypted) SMTP
57958 session continues. ACLs that run for subsequent SMTP commands can detect the
57959 fact that no certificate was verified, and vary their actions accordingly. For
57960 example, you can insist on a certificate before accepting a message for
57961 relaying, but not when the message is destined for local delivery.
57962 </para>
57963 <para>
57964 <indexterm role="variable">
57965 <primary><varname>$tls_in_peerdn</varname></primary>
57966 </indexterm>
57967 When a client supplies a certificate (whether it verifies or not), the value of
57968 the Distinguished Name of the certificate is made available in the variable
57969 <varname>$tls_in_peerdn</varname> during subsequent processing of the message.
57970 </para>
57971 <para>
57972 <indexterm role="concept">
57973 <primary>log</primary>
57974 <secondary>distinguished name</secondary>
57975 </indexterm>
57976 Because it is often a long text string, it is not included in the log line or
57977 <emphasis>Received:</emphasis> header by default. You can arrange for it to be logged, keyed by
57978 <quote>DN=</quote>, by setting the <option>tls_peerdn</option> log selector, and you can use
57979 <option>received_header_text</option> to change the <emphasis>Received:</emphasis> header. When no
57980 certificate is supplied, <varname>$tls_in_peerdn</varname> is empty.
57981 </para>
57982 </section>
57983 <section id="SECID184">
57984 <title>Revoked certificates</title>
57985 <para>
57986 <indexterm role="concept">
57987 <primary>TLS</primary>
57988 <secondary>revoked certificates</secondary>
57989 </indexterm>
57990 <indexterm role="concept">
57991 <primary>revocation list</primary>
57992 </indexterm>
57993 <indexterm role="concept">
57994 <primary>certificate</primary>
57995 <secondary>revocation list</secondary>
57996 </indexterm>
57997 <indexterm role="concept">
57998 <primary>OCSP</primary>
57999 <secondary>stapling</secondary>
58000 </indexterm>
58001 Certificate issuing authorities issue Certificate Revocation Lists (CRLs) when
58002 certificates are revoked. If you have such a list, you can pass it to an Exim
58003 server using the global option called <option>tls_crl</option> and to an Exim client using
58004 an identically named option for the <command>smtp</command> transport. In each case, the value
58005 of the option is expanded and must then be the name of a file that contains a
58006 CRL in PEM format.
58007 The downside is that clients have to periodically re-download a potentially huge
58008 file from every certificate authority they know of.
58009 </para>
58010 <para>
58011 The way with most moving parts at query time is Online Certificate
58012 Status Protocol (OCSP), where the client verifies the certificate
58013 against an OCSP server run by the CA.  This lets the CA track all
58014 usage of the certs.  It requires running software with access to the
58015 private key of the CA, to sign the responses to the OCSP queries.  OCSP
58016 is based on HTTP and can be proxied accordingly.
58017 </para>
58018 <para>
58019 The only widespread OCSP server implementation (known to this writer)
58020 comes as part of OpenSSL and aborts on an invalid request, such as
58021 connecting to the port and then disconnecting.  This requires
58022 re-entering the passphrase each time some random client does this.
58023 </para>
58024 <para>
58025 The third way is OCSP Stapling; in this, the server using a certificate
58026 issued by the CA periodically requests an OCSP proof of validity from
58027 the OCSP server, then serves it up inline as part of the TLS
58028 negotiation.   This approach adds no extra round trips, does not let the
58029 CA track users, scales well with number of certs issued by the CA and is
58030 resilient to temporary OCSP server failures, as long as the server
58031 starts retrying to fetch an OCSP proof some time before its current
58032 proof expires.  The downside is that it requires server support.
58033 </para>
58034 <para>
58035 Unless Exim is built with the support disabled,
58036 or with GnuTLS earlier than version 3.3.16 / 3.4.8
58037 support for OCSP stapling is included.
58038 </para>
58039 <para>
58040 There is a global option called <option>tls_ocsp_file</option>.
58041 The file specified therein is expected to be in DER format, and contain
58042 an OCSP proof.  Exim will serve it as part of the TLS handshake.  This
58043 option will be re-expanded for SNI, if the <option>tls_certificate</option> option
58044 contains <literal>tls_in_sni</literal>, as per other TLS options.
58045 </para>
58046 <para>
58047 Exim does not at this time implement any support for fetching a new OCSP
58048 proof.  The burden is on the administrator to handle this, outside of
58049 Exim.  The file specified should be replaced atomically, so that the
58050 contents are always valid.  Exim will expand the <option>tls_ocsp_file</option> option
58051 on each connection, so a new file will be handled transparently on the
58052 next connection.
58053 </para>
58054 <para>
58055 When built with OpenSSL Exim will check for a valid next update timestamp
58056 in the OCSP proof; if not present, or if the proof has expired, it will be
58057 ignored.
58058 </para>
58059 <para>
58060 For the client to be able to verify the stapled OCSP the server must
58061 also supply, in its stapled information, any intermediate
58062 certificates for the chain leading to the OCSP proof from the signer
58063 of the server certificate.  There may be zero or one such. These
58064 intermediate certificates should be added to the server OCSP stapling
58065 file named by <option>tls_ocsp_file</option>.
58066 </para>
58067 <para>
58068 Note that the proof only covers the terminal server certificate,
58069 not any of the chain from CA to it.
58070 </para>
58071 <para>
58072 There is no current way to staple a proof for a client certificate.
58073 </para>
58074 <literallayout class="monospaced">
58075   A helper script "ocsp_fetch.pl" for fetching a proof from a CA
58076   OCSP server is supplied.  The server URL may be included in the
58077   server certificate, if the CA is helpful.
58078
58079   One failure mode seen was the OCSP Signer cert expiring before the end
58080   of validity of the OCSP proof. The checking done by Exim/OpenSSL
58081   noted this as invalid overall, but the re-fetch script did not.
58082 </literallayout>
58083 </section>
58084 <section id="SECTserverTLScache">
58085 <title>Caching of static server configuration items</title>
58086 <para>
58087 <indexterm role="concept">
58088 <primary>certificate</primary>
58089 <secondary>caching</secondary>
58090 </indexterm>
58091 <indexterm role="concept">
58092 <primary>privatekey</primary>
58093 <secondary>caching</secondary>
58094 </indexterm>
58095 <indexterm role="concept">
58096 <primary>crl</primary>
58097 <secondary>caching</secondary>
58098 </indexterm>
58099 <indexterm role="concept">
58100 <primary>ocsp</primary>
58101 <secondary>caching</secondary>
58102 </indexterm>
58103 <indexterm role="concept">
58104 <primary>ciphers</primary>
58105 <secondary>caching</secondary>
58106 </indexterm>
58107 <indexterm role="concept">
58108 <primary>CA bundle</primary>
58109 <secondary>caching</secondary>
58110 </indexterm>
58111 <indexterm role="concept">
58112 <primary>certificate authorities</primary>
58113 <secondary>caching</secondary>
58114 </indexterm>
58115 <indexterm role="concept">
58116 <primary>tls_certificate</primary>
58117 <secondary>caching</secondary>
58118 </indexterm>
58119 <indexterm role="concept">
58120 <primary>tls_privatekey</primary>
58121 <secondary>caching</secondary>
58122 </indexterm>
58123 <indexterm role="concept">
58124 <primary>tls_crl</primary>
58125 <secondary>caching</secondary>
58126 </indexterm>
58127 <indexterm role="concept">
58128 <primary>tls_ocsp_file</primary>
58129 <secondary>caching</secondary>
58130 </indexterm>
58131 <indexterm role="concept">
58132 <primary>tls_require_ciphers</primary>
58133 <secondary>caching</secondary>
58134 </indexterm>
58135 <indexterm role="concept">
58136 <primary>tls_verify_certificate</primary>
58137 <secondary>caching</secondary>
58138 </indexterm>
58139 <indexterm role="concept">
58140 <primary>caching</primary>
58141 <secondary>certificate</secondary>
58142 </indexterm>
58143 <indexterm role="concept">
58144 <primary>caching</primary>
58145 <secondary>privatekey</secondary>
58146 </indexterm>
58147 <indexterm role="concept">
58148 <primary>caching</primary>
58149 <secondary>crl</secondary>
58150 </indexterm>
58151 <indexterm role="concept">
58152 <primary>caching</primary>
58153 <secondary>ocsp</secondary>
58154 </indexterm>
58155 <indexterm role="concept">
58156 <primary>caching</primary>
58157 <secondary>ciphers</secondary>
58158 </indexterm>
58159 <indexterm role="concept">
58160 <primary>caching</primary>
58161 <secondary>certificate authorities</secondary>
58162 </indexterm>
58163 If any of the main configuration options <option>tls_certificate</option>, <option>tls_privatekey</option>,
58164 <option>tls_crl</option> and <option>tls_ocsp_file</option> have values with no
58165 expandable elements,
58166 then the associated information is loaded at daemon startup.
58167 It is made available
58168 to child processes forked for handling received SMTP connections.
58169 </para>
58170 <para>
58171 This caching is currently only supported under Linux and FreeBSD.
58172 </para>
58173 <para>
58174 If caching is not possible, for example if an item has to be dependent
58175 on the peer host so contains a <varname>$sender_host_name</varname> expansion, the load
58176 of the associated information is done at the startup of the TLS connection.
58177 </para>
58178 <para>
58179 The cache is invalidated and reloaded after any changes to the directories
58180 containing files specified by these options.
58181 </para>
58182 <para>
58183 The information specified by the main option <option>tls_verify_certificates</option>
58184 is similarly cached so long as it specifies files explicitly
58185 or (under GnuTLS) is the string <quote>system,cache</quote>.
58186 The latter case is not automatically invalidated;
58187 it is the operator&#x2019;s responsibility to arrange for a daemon restart
58188 any time the system certificate authority bundle is updated.
58189 A HUP signal is sufficient for this.
58190 The value <quote>system</quote> results in no caching under GnuTLS.
58191 </para>
58192 <para>
58193 The macro _HAVE_TLS_CA_CACHE will be defined if the suffix for "system"
58194 is acceptable in configurations for the Exim executavble.
58195 </para>
58196 <para>
58197 Caching of the system Certificate Authorities bundle can
58198 save siginificant time and processing on every TLS connection
58199 accepted by Exim.
58200 </para>
58201 </section>
58202 <section id="SECTclientTLS">
58203 <title>Configuring an Exim client to use TLS</title>
58204 <para>
58205 <indexterm role="concept">
58206 <primary>cipher</primary>
58207 <secondary>logging</secondary>
58208 </indexterm>
58209 <indexterm role="concept">
58210 <primary>log</primary>
58211 <secondary>TLS cipher</secondary>
58212 </indexterm>
58213 <indexterm role="concept">
58214 <primary>log</primary>
58215 <secondary>distinguished name</secondary>
58216 </indexterm>
58217 <indexterm role="concept">
58218 <primary>TLS</primary>
58219 <secondary>configuring an Exim client</secondary>
58220 </indexterm>
58221 The <option>tls_cipher</option> and <option>tls_peerdn</option> log selectors apply to outgoing SMTP
58222 deliveries as well as to incoming, the latter one causing logging of the
58223 server certificate&#x2019;s DN. The remaining client configuration for TLS is all
58224 within the <command>smtp</command> transport.
58225 </para>
58226 <para>
58227 <indexterm role="concept">
58228 <primary>ESMTP extensions</primary>
58229 <secondary>STARTTLS</secondary>
58230 </indexterm>
58231 It is not necessary to set any options to have TLS work in the <command>smtp</command>
58232 transport. If Exim is built with TLS support, and TLS is advertised by a
58233 server, the <command>smtp</command> transport always tries to start a TLS session. However,
58234 this can be prevented by setting <option>hosts_avoid_tls</option> (an option of the
58235 transport) to a list of server hosts for which TLS should not be used.
58236 </para>
58237 <para>
58238 If you do not want Exim to attempt to send messages unencrypted when an attempt
58239 to set up an encrypted connection fails in any way, you can set
58240 <option>hosts_require_tls</option> to a list of hosts for which encryption is mandatory. For
58241 those hosts, delivery is always deferred if an encrypted connection cannot be
58242 set up. If there are any other hosts for the address, they are tried in the
58243 usual way.
58244 </para>
58245 <para>
58246 When the server host is not in <option>hosts_require_tls</option>, Exim may try to deliver
58247 the message unencrypted. It always does this if the response to STARTTLS is
58248 a 5<emphasis>xx</emphasis> code. For a temporary error code, or for a failure to negotiate a TLS
58249 session after a success response code, what happens is controlled by the
58250 <option>tls_tempfail_tryclear</option> option of the <command>smtp</command> transport. If it is false,
58251 delivery to this host is deferred, and other hosts (if available) are tried. If
58252 it is true, Exim attempts to deliver unencrypted after a 4<emphasis>xx</emphasis> response to
58253 STARTTLS, and if STARTTLS is accepted, but the subsequent TLS
58254 negotiation fails, Exim closes the current connection (because it is in an
58255 unknown state), opens a new one to the same host, and then tries the delivery
58256 unencrypted.
58257 </para>
58258 <para>
58259 The <option>tls_certificate</option> and <option>tls_privatekey</option> options of the <command>smtp</command>
58260 transport provide the client with a certificate, which is passed to the server
58261 if it requests it.
58262 This is an optional thing for TLS connections, although either end
58263 may insist on it.
58264 If the server is Exim, it will request a certificate only if
58265 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> matches the client.
58266 </para>
58267 <para>
58268 <emphasis role="bold">Note</emphasis>: Do not use a certificate which has the OCSP-must-staple extension,
58269 for client use (they are usable for server use).
58270 As the TLS protocol has no means for the client to staple before TLS 1.3 it will result
58271 in failed connections.
58272 </para>
58273 <para>
58274 If the <option>tls_verify_certificates</option> option is set on the <command>smtp</command> transport, it
58275 specifies a collection of expected server certificates.
58276 These may be
58277 the system default set (depending on library version),
58278 a file,
58279 or (depending on library version) a directory.
58280 The client verifies the server&#x2019;s certificate
58281 against this collection, taking into account any revoked certificates that are
58282 in the list defined by <option>tls_crl</option>.
58283 Failure to verify fails the TLS connection unless either of the
58284 <option>tls_verify_hosts</option> or <option>tls_try_verify_hosts</option> options are set.
58285 </para>
58286 <para>
58287 The <option>tls_verify_hosts</option> and <option>tls_try_verify_hosts</option> options restrict
58288 certificate verification to the listed servers.  Verification either must
58289 or need not succeed respectively.
58290 </para>
58291 <para>
58292 The <option>tls_verify_cert_hostnames</option> option lists hosts for which additional
58293 name checks are made on the server certificate.
58294 The match against this list is, as per other Exim usage, the
58295 IP for the host.  That is most closely associated with the
58296 name on the DNS A (or AAAA) record for the host.
58297 However, the name that needs to be in the certificate
58298 is the one at the head of any CNAME chain leading to the A record.
58299 The option defaults to always checking.
58300 </para>
58301 <para>
58302 The <command>smtp</command> transport has two OCSP-related options:
58303 <option>hosts_require_ocsp</option>; a host-list for which a Certificate Status
58304 is requested and required for the connection to proceed.  The default
58305 value is empty.
58306 <option>hosts_request_ocsp</option>; a host-list for which (additionally)
58307 a Certificate Status is requested (but not necessarily verified).  The default
58308 value is "*" meaning that requests are made unless configured
58309 otherwise.
58310 </para>
58311 <para>
58312 The host(s) should also be in <option>hosts_require_tls</option>, and
58313 <option>tls_verify_certificates</option> configured for the transport,
58314 for OCSP to be relevant.
58315 </para>
58316 <para>
58317 If
58318 <option>tls_require_ciphers</option> is set on the <command>smtp</command> transport, it must contain a
58319 list of permitted cipher suites. If either of these checks fails, delivery to
58320 the current host is abandoned, and the <command>smtp</command> transport tries to deliver to
58321 alternative hosts, if any.
58322 </para>
58323 <para>
58324  <emphasis role="bold">Note</emphasis>:
58325 These options must be set in the <command>smtp</command> transport for Exim to use TLS when it
58326 is operating as a client. Exim does not assume that a server certificate (set
58327 by the global options of the same name) should also be used when operating as a
58328 client.
58329 </para>
58330 <para>
58331 <indexterm role="variable">
58332 <primary><varname>$host</varname></primary>
58333 </indexterm>
58334 <indexterm role="variable">
58335 <primary><varname>$host_address</varname></primary>
58336 </indexterm>
58337 All the TLS options in the <command>smtp</command> transport are expanded before use, with
58338 <varname>$host</varname> and <varname>$host_address</varname> containing the name and address of the server to
58339 which the client is connected. Forced failure of an expansion causes Exim to
58340 behave as if the relevant option were unset.
58341 </para>
58342 <para>
58343 <indexterm role="variable">
58344 <primary><varname>$tls_out_bits</varname></primary>
58345 </indexterm>
58346 <indexterm role="variable">
58347 <primary><varname>$tls_out_cipher</varname></primary>
58348 </indexterm>
58349 <indexterm role="variable">
58350 <primary><varname>$tls_out_peerdn</varname></primary>
58351 </indexterm>
58352 <indexterm role="variable">
58353 <primary><varname>$tls_out_sni</varname></primary>
58354 </indexterm>
58355 Before an SMTP connection is established, the
58356 <varname>$tls_out_bits</varname>, <varname>$tls_out_cipher</varname>, <varname>$tls_out_peerdn</varname> and <varname>$tls_out_sni</varname>
58357 variables are emptied. (Until the first connection, they contain the values
58358 that were set when the message was received.) If STARTTLS is subsequently
58359 successfully obeyed, these variables are set to the relevant values for the
58360 outgoing connection.
58361 </para>
58362 </section>
58363 <section id="SECTclientTLScache">
58364 <title>Caching of static client configuration items</title>
58365 <para>
58366 <indexterm role="concept">
58367 <primary>certificate</primary>
58368 <secondary>caching</secondary>
58369 </indexterm>
58370 <indexterm role="concept">
58371 <primary>privatekey</primary>
58372 <secondary>caching</secondary>
58373 </indexterm>
58374 <indexterm role="concept">
58375 <primary>crl</primary>
58376 <secondary>caching</secondary>
58377 </indexterm>
58378 <indexterm role="concept">
58379 <primary>ciphers</primary>
58380 <secondary>caching</secondary>
58381 </indexterm>
58382 <indexterm role="concept">
58383 <primary>CA bundle</primary>
58384 <secondary>caching</secondary>
58385 </indexterm>
58386 <indexterm role="concept">
58387 <primary>certificate authorities</primary>
58388 <secondary>caching</secondary>
58389 </indexterm>
58390 <indexterm role="concept">
58391 <primary>tls_certificate</primary>
58392 <secondary>caching</secondary>
58393 </indexterm>
58394 <indexterm role="concept">
58395 <primary>tls_privatekey</primary>
58396 <secondary>caching</secondary>
58397 </indexterm>
58398 <indexterm role="concept">
58399 <primary>tls_crl</primary>
58400 <secondary>caching</secondary>
58401 </indexterm>
58402 <indexterm role="concept">
58403 <primary>tls_require_ciphers</primary>
58404 <secondary>caching</secondary>
58405 </indexterm>
58406 <indexterm role="concept">
58407 <primary>tls_verify_certificate</primary>
58408 <secondary>caching</secondary>
58409 </indexterm>
58410 <indexterm role="concept">
58411 <primary>caching</primary>
58412 <secondary>certificate</secondary>
58413 </indexterm>
58414 <indexterm role="concept">
58415 <primary>caching</primary>
58416 <secondary>privatekey</secondary>
58417 </indexterm>
58418 <indexterm role="concept">
58419 <primary>caching</primary>
58420 <secondary>crl</secondary>
58421 </indexterm>
58422 <indexterm role="concept">
58423 <primary>caching</primary>
58424 <secondary>ciphers</secondary>
58425 </indexterm>
58426 <indexterm role="concept">
58427 <primary>caching</primary>
58428 <secondary>certificate authorities</secondary>
58429 </indexterm>
58430 If any of the transport configuration options <option>tls_certificate</option>, <option>tls_privatekey</option>
58431 and <option>tls_crl</option> have values with no
58432 expandable elements,
58433 then the associated information is loaded per smtp transport
58434 at daemon startup, at the start of a queue run, or on a
58435 command-line specified message delivery.
58436 It is made available
58437 to child processes forked for handling making SMTP connections.
58438 </para>
58439 <para>
58440 This caching is currently only supported under Linux.
58441 </para>
58442 <para>
58443 If caching is not possible, the load
58444 of the associated information is done at the startup of the TLS connection.
58445 </para>
58446 <para>
58447 The cache is invalidated in the daemon
58448 and reloaded after any changes to the directories
58449 containing files specified by these options.
58450 </para>
58451 <para>
58452 The information specified by the main option <option>tls_verify_certificates</option>
58453 is similarly cached so long as it specifies files explicitly
58454 or (under GnuTLS) is the string <quote>system,cache</quote>.
58455 The latter case is not automatically invaludated;
58456 it is the operator&#x2019;s responsibility to arrange for a daemon restart
58457 any time the system certificate authority bundle is updated.
58458 A HUP signal is sufficient for this.
58459 The value <quote>system</quote> results in no caching under GnuTLS.
58460 </para>
58461 <para>
58462 The macro _HAVE_TLS_CA_CACHE will be defined if the suffix for "system"
58463 is acceptable in configurations for the Exim executavble.
58464 </para>
58465 <para>
58466 Caching of the system Certificate Authorities bundle can
58467 save siginificant time and processing on every TLS connection
58468 initiated by Exim.
58469 </para>
58470 </section>
58471 <section id="SECTtlssni">
58472 <title>Use of TLS Server Name Indication</title>
58473 <para>
58474 <indexterm role="concept">
58475 <primary>TLS</primary>
58476 <secondary>Server Name Indication</secondary>
58477 </indexterm>
58478 <indexterm role="concept">
58479 <primary>TLS</primary>
58480 <secondary>SNI</secondary>
58481 </indexterm>
58482 <indexterm role="concept">
58483 <primary>SNI</primary>
58484 </indexterm>
58485 <indexterm role="variable">
58486 <primary><varname>$tls_in_sni</varname></primary>
58487 </indexterm>
58488 <indexterm role="option">
58489 <primary><option>tls_in_sni</option></primary>
58490 </indexterm>
58491 With TLS1.0 or above, there is an extension mechanism by which extra
58492 information can be included at various points in the protocol.  One of these
58493 extensions, documented in RFC 6066 (and before that RFC 4366) is
58494 <quote>Server Name Indication</quote>, commonly <quote>SNI</quote>.  This extension is sent by the
58495 client in the initial handshake, so that the server can examine the servername
58496 within and possibly choose to use different certificates and keys (and more)
58497 for this session.
58498 </para>
58499 <para>
58500 This is analogous to HTTP&#x2019;s <quote>Host:</quote> header, and is the main mechanism by
58501 which HTTPS-enabled web-sites can be virtual-hosted, many sites to one IP
58502 address.
58503 </para>
58504 <para>
58505 With SMTP to MX, there are the same problems here as in choosing the identity
58506 against which to validate a certificate: you can&#x2019;t rely on insecure DNS to
58507 provide the identity which you then cryptographically verify.  So this will
58508 be of limited use in that environment.
58509 </para>
58510 <para>
58511 With SMTP to Submission, there is a well-defined hostname which clients are
58512 connecting to and can validate certificates against.  Thus clients <emphasis role="bold">can</emphasis>
58513 choose to include this information in the TLS negotiation.  If this becomes
58514 wide-spread, then hosters can choose to present different certificates to
58515 different clients.  Or even negotiate different cipher suites.
58516 </para>
58517 <para>
58518 The <option>tls_sni</option> option on an SMTP transport is an expanded string; the result,
58519 if not empty, will be sent on a TLS session as part of the handshake.  There&#x2019;s
58520 nothing more to it.  Choosing a sensible value not derived insecurely is the
58521 only point of caution.  The <varname>$tls_out_sni</varname> variable will be set to this string
58522 for the lifetime of the client connection (including during authentication).
58523 </para>
58524 <para revisionflag="changed">
58525 If DANE validated the connection attempt then the value of the <option>tls_sni</option> option
58526 is forced to the name of the destination host, after any MX- or CNAME-following.
58527 </para>
58528 <para>
58529 Except during SMTP client sessions, if <varname>$tls_in_sni</varname> is set then it is a string
58530 received from a client.
58531 It can be logged with the <option>log_selector</option> item <literal>+tls_sni</literal>.
58532 </para>
58533 <para>
58534 If the string <literal>tls_in_sni</literal> appears in the main section&#x2019;s <option>tls_certificate</option>
58535 option (prior to expansion) then the following options will be re-expanded
58536 during TLS session handshake, to permit alternative values to be chosen:
58537 </para>
58538 <itemizedlist>
58539 <listitem>
58540 <para>
58541 <option>tls_certificate</option>
58542 </para>
58543 </listitem>
58544 <listitem>
58545 <para>
58546 <option>tls_crl</option>
58547 </para>
58548 </listitem>
58549 <listitem>
58550 <para>
58551 <option>tls_privatekey</option>
58552 </para>
58553 </listitem>
58554 <listitem>
58555 <para>
58556 <option>tls_verify_certificates</option>
58557 </para>
58558 </listitem>
58559 <listitem>
58560 <para>
58561 <option>tls_ocsp_file</option>
58562 </para>
58563 </listitem>
58564 </itemizedlist>
58565 <para>
58566 Great care should be taken to deal with matters of case, various injection
58567 attacks in the string (<literal>../</literal> or SQL), and ensuring that a valid filename
58568 can always be referenced; it is important to remember that <varname>$tls_in_sni</varname> is
58569 arbitrary unverified data provided prior to authentication.
58570 Further, the initial certificate is loaded before SNI has arrived, so
58571 an expansion for <option>tls_certificate</option> must have a default which is used
58572 when <varname>$tls_in_sni</varname> is empty.
58573 </para>
58574 <para>
58575 The Exim developers are proceeding cautiously and so far no other TLS options
58576 are re-expanded.
58577 </para>
58578 <para>
58579 When Exim is built against OpenSSL, OpenSSL must have been built with support
58580 for TLS Extensions.  This holds true for OpenSSL 1.0.0+ and 0.9.8+ with
58581 enable-tlsext in EXTRACONFIGURE.  If you invoke <command>openssl s_client -h</command> and
58582 see <literal>-servername</literal> in the output, then OpenSSL has support.
58583 </para>
58584 <para>
58585 When Exim is built against GnuTLS, SNI support is available as of GnuTLS
58586 0.5.10.  (Its presence predates the current API which Exim uses, so if Exim
58587 built, then you have SNI support).
58588 </para>
58589 <para>
58590 <indexterm role="concept">
58591 <primary>TLS</primary>
58592 <secondary>ALPN</secondary>
58593 </indexterm>
58594 <indexterm role="concept">
58595 <primary>ALPN</primary>
58596 <secondary>general information</secondary>
58597 </indexterm>
58598 <indexterm role="concept">
58599 <primary>TLS</primary>
58600 <secondary>Application Layer Protocol Names</secondary>
58601 </indexterm>
58602 There is a TLS feature related to SNI
58603 called Application Layer Protocol Name (ALPN).
58604 This is intended to declare, or select, what protocol layer will be using a TLS
58605 connection.
58606 The client for the connection proposes a set of protocol names, and
58607 the server responds with a selected one.
58608 It is not, as of 2021, commonly used for SMTP connections.
58609 However, to guard against misirected or malicious use of web clients
58610 (which often do use ALPN) against MTA ports, Exim by default check that
58611 there is no incompatible ALPN specified by a client for a TLS connection.
58612 If there is, the connection is rejected.
58613 </para>
58614 <para>
58615 As a client Exim does not supply ALPN by default.
58616 The behaviour of both client and server can be configured using the options
58617 <option>tls_alpn</option> and <option>hosts_require_alpn</option>.
58618 There are no variables providing observability.
58619 Some feature-specific logging may appear on denied connections, but this
58620 depends on the behavious of the peer
58621 (not all peers can send a feature-specific TLS Alert).
58622 </para>
58623 <para>
58624 This feature is available when Exim is built with
58625 OpenSSL 1.1.0 or later or GnuTLS 3.2.0 or later;
58626 the macro _HAVE_TLS_ALPN will be defined when this is so.
58627 </para>
58628 </section>
58629 <section id="SECTmulmessam">
58630 <title>Multiple messages on the same encrypted TCP/IP connection</title>
58631 <para>
58632 <indexterm role="concept">
58633 <primary>multiple SMTP deliveries with TLS</primary>
58634 </indexterm>
58635 <indexterm role="concept">
58636 <primary>TLS</primary>
58637 <secondary>multiple message deliveries</secondary>
58638 </indexterm>
58639 Exim sends multiple messages down the same TCP/IP connection by starting up
58640 an entirely new delivery process for each message, passing the socket from
58641 one process to the next. This implementation does not fit well with the use
58642 of TLS, because there is quite a lot of state information associated with a TLS
58643 connection, not just a socket identification. Passing all the state information
58644 to a new process is not feasible. Consequently, for sending using TLS Exim
58645 starts an additional proxy process for handling the encryption, piping the
58646 unencrypted data stream from and to the delivery processes.
58647 </para>
58648 <para>
58649 An older mode of operation can be enabled on a per-host basis by the
58650 <option>hosts_noproxy_tls</option> option on the <command>smtp</command> transport.  If the host matches
58651 this list the proxy process described above is not used; instead Exim
58652 shuts down an existing TLS session being run by the delivery process
58653 before passing the socket to a new process. The new process may then
58654 try to start a new TLS session, and if successful, may try to re-authenticate
58655 if AUTH is in use, before sending the next message.
58656 </para>
58657 <para>
58658 The RFC is not clear as to whether or not an SMTP session continues in clear
58659 after TLS has been shut down, or whether TLS may be restarted again later, as
58660 just described. However, if the server is Exim, this shutdown and
58661 reinitialization works. It is not known which (if any) other servers operate
58662 successfully if the client closes a TLS session and continues with unencrypted
58663 SMTP, but there are certainly some that do not work. For such servers, Exim
58664 should not pass the socket to another process, because the failure of the
58665 subsequent attempt to use it would cause Exim to record a temporary host error,
58666 and delay other deliveries to that host.
58667 </para>
58668 <para>
58669 To test for this case, Exim sends an EHLO command to the server after
58670 closing down the TLS session. If this fails in any way, the connection is
58671 closed instead of being passed to a new delivery process, but no retry
58672 information is recorded.
58673 </para>
58674 <para>
58675 There is also a manual override; you can set <option>hosts_nopass_tls</option> on the
58676 <command>smtp</command> transport to match those hosts for which Exim should not pass
58677 connections to new processes if TLS has been used.
58678 </para>
58679 </section>
58680 <section id="SECTcerandall">
58681 <title>Certificates and all that</title>
58682 <para>
58683 <indexterm role="concept">
58684 <primary>certificate</primary>
58685 <secondary>references to discussion</secondary>
58686 </indexterm>
58687 In order to understand fully how TLS works, you need to know about
58688 certificates, certificate signing, and certificate authorities.
58689 This is a large topic and an introductory guide is unsuitable for the Exim
58690 reference manual, so instead we provide pointers to existing documentation.
58691 </para>
58692 <para>
58693 The Apache web-server was for a long time the canonical guide, so their
58694 documentation is a good place to start; their SSL module&#x2019;s Introduction
58695 document is currently at
58696 </para>
58697 <literallayout>
58698 <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>
58699 </literallayout>
58700 <para>
58701 and their FAQ is at
58702 </para>
58703 <literallayout>
58704 <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>
58705 </literallayout>
58706 <para>
58707 Eric Rescorla&#x2019;s book, <emphasis>SSL and TLS</emphasis>, published by Addison-Wesley (ISBN
58708 0-201-61598-3) in 2001, contains both introductory and more in-depth
58709 descriptions.
58710 More recently Ivan Ristić&#x2019;s book <emphasis>Bulletproof SSL and TLS</emphasis>,
58711 published by Feisty Duck (ISBN 978-1907117046) in 2013 is good.
58712 Ivan is the author of the popular TLS testing tools at
58713 <emphasis role="bold"><ulink url="https://www.ssllabs.com/">https://www.ssllabs.com/</ulink></emphasis>.
58714 </para>
58715 </section>
58716 <section id="SECID186">
58717 <title>Certificate chains</title>
58718 <para>
58719 A file named by <option>tls_certificate</option> may contain more than one
58720 certificate. This is useful in the case where the certificate that is being
58721 sent is validated by an intermediate certificate which the other end does
58722 not have. Multiple certificates must be in the correct order in the file.
58723 First the host&#x2019;s certificate itself, then the first intermediate
58724 certificate to validate the issuer of the host certificate, then the next
58725 intermediate certificate to validate the issuer of the first intermediate
58726 certificate, and so on, until finally (optionally) the root certificate.
58727 The root certificate must already be trusted by the recipient for
58728 validation to succeed, of course, but if it&#x2019;s not preinstalled, sending the
58729 root certificate along with the rest makes it available for the user to
58730 install if the receiving end is a client MUA that can interact with a user.
58731 </para>
58732 <para>
58733 Note that certificates using MD5 are unlikely to work on today&#x2019;s Internet;
58734 even if your libraries allow loading them for use in Exim when acting as a
58735 server, increasingly clients will not accept such certificates.  The error
58736 diagnostics in such a case can be frustratingly vague.
58737 </para>
58738 </section>
58739 <section id="SECID187">
58740 <title>Self-signed certificates</title>
58741 <para>
58742 <indexterm role="concept">
58743 <primary>certificate</primary>
58744 <secondary>self-signed</secondary>
58745 </indexterm>
58746 You can create a self-signed certificate using the <emphasis>req</emphasis> command provided
58747 with OpenSSL, like this:
58748 </para>
58749 <literallayout class="monospaced">
58750 openssl req -x509 -newkey rsa:1024 -keyout file1 -out file2 \
58751             -days 9999 -nodes
58752 </literallayout>
58753 <para>
58754 <filename>file1</filename> and <filename>file2</filename> can be the same file; the key and the certificate are
58755 delimited and so can be identified independently. The <option>-days</option> option
58756 specifies a period for which the certificate is valid. The <option>-nodes</option> option is
58757 important: if you do not set it, the key is encrypted with a passphrase
58758 that you are prompted for, and any use that is made of the key causes more
58759 prompting for the passphrase. This is not helpful if you are going to use
58760 this certificate and key in an MTA, where prompting is not possible.
58761 </para>
58762 <para>
58763 NB: we are now past the point where 9999 days takes us past the 32-bit Unix
58764 epoch.  If your system uses unsigned time_t (most do) and is 32-bit, then
58765 the above command might produce a date in the past.  Think carefully about
58766 the lifetime of the systems you&#x2019;re deploying, and either reduce the duration
58767 of the certificate or reconsider your platform deployment.  (At time of
58768 writing, reducing the duration is the most likely choice, but the inexorable
58769 progression of time takes us steadily towards an era where this will not
58770 be a sensible resolution).
58771 </para>
58772 <para>
58773 A self-signed certificate made in this way is sufficient for testing, and
58774 may be adequate for all your requirements if you are mainly interested in
58775 encrypting transfers, and not in secure identification.
58776 </para>
58777 <para>
58778 However, many clients require that the certificate presented by the server be a
58779 user (also called <quote>leaf</quote> or <quote>site</quote>) certificate, and not a self-signed
58780 certificate. In this situation, the self-signed certificate described above
58781 must be installed on the client host as a trusted root <emphasis>certification
58782 authority</emphasis> (CA), and the certificate used by Exim must be a user certificate
58783 signed with that self-signed certificate.
58784 </para>
58785 <para>
58786 For information on creating self-signed CA certificates and using them to sign
58787 user certificates, see the <emphasis>General implementation overview</emphasis> chapter of the
58788 Open-source PKI book, available online at
58789 <emphasis role="bold"><ulink url="https://sourceforge.net/projects/ospkibook/">https://sourceforge.net/projects/ospkibook/</ulink></emphasis>.
58790 <indexterm role="concept" startref="IIDencsmtp1" class="endofrange"/>
58791 <indexterm role="concept" startref="IIDencsmtp2" class="endofrange"/>
58792 </para>
58793 </section>
58794 <section id="SECTresumption">
58795 <title>TLS Resumption</title>
58796 <para>
58797 <indexterm role="concept">
58798 <primary>TLS</primary>
58799 <secondary>resumption</secondary>
58800 </indexterm>
58801 TLS Session Resumption for TLS 1.2 and TLS 1.3 connections can be used (defined
58802 in RFC 5077 for 1.2).  The support for this requires GnuTLS 3.6.3 or OpenSSL 1.1.1
58803 (or later).
58804 </para>
58805 <para>
58806 Session resumption (this is the "stateless" variant) involves the server sending
58807 a "session ticket" to the client on one connection, which can be stored by the
58808 client and used for a later session.  The ticket contains sufficient state for
58809 the server to reconstruct the TLS session, avoiding some expensive crypto
58810 calculation and (on TLS1.2) one full packet roundtrip time.
58811 </para>
58812 <itemizedlist>
58813 <listitem>
58814 <para>
58815 Operational cost/benefit:
58816 </para>
58817 <para>
58818  The extra data being transmitted costs a minor amount, and the client has
58819  extra costs in storing and retrieving the data.
58820 </para>
58821 <para>
58822  In the Exim/Gnutls implementation the extra cost on an initial connection
58823  which is TLS1.2 over a loopback path is about 6ms on 2017-laptop class hardware.
58824  The saved cost on a subsequent connection is about 4ms; three or more
58825  connections become a net win.  On longer network paths, two or more
58826  connections will have an average lower startup time thanks to the one
58827  saved packet roundtrip.  TLS1.3 will save the crypto cpu costs but not any
58828  packet roundtrips.
58829 </para>
58830 <para>
58831 <indexterm role="concept">
58832 <primary>hints database</primary>
58833 <secondary>tls</secondary>
58834 </indexterm>
58835  Since a new hints DB is used on the TLS client,
58836  the hints DB maintenance should be updated to additionally handle "tls".
58837 </para>
58838 </listitem>
58839 <listitem>
58840 <para>
58841 Security aspects:
58842 </para>
58843 <para>
58844  The session ticket is encrypted, but is obviously an additional security
58845  vulnarability surface.  An attacker able to decrypt it would have access
58846  all connections using the resumed session.
58847  The session ticket encryption key is not committed to storage by the server
58848  and is rotated regularly (OpenSSL: 1hr, and one previous key is used for
58849  overlap; GnuTLS 6hr but does not specify any overlap).
58850  Tickets have limited lifetime (2hr, and new ones issued after 1hr under
58851  OpenSSL.  GnuTLS 2hr, appears to not do overlap).
58852 </para>
58853 <para>
58854  There is a question-mark over the security of the Diffie-Helman parameters
58855  used for session negotiation.
58856 </para>
58857 </listitem>
58858 <listitem>
58859 <para>
58860 Observability:
58861 </para>
58862 <para>
58863  The <option>log_selector</option> "tls_resumption" appends an asterisk to the tls_cipher "X="
58864  element.
58865 </para>
58866 <para>
58867  The variables <varname>$tls_in_resumption</varname> and <varname>$tls_out_resumption</varname>
58868  have bits 0-4 indicating respectively
58869  support built, client requested ticket, client offered session,
58870  server issued ticket, resume used.  A suitable decode list is provided
58871  in the builtin macro _RESUME_DECODE for in <option>listextract</option> expansions.
58872 </para>
58873 </listitem>
58874 <listitem>
58875 <para>
58876 Control:
58877 </para>
58878 <para>
58879 The <option>tls_resumption_hosts</option> main option specifies a hostlist for which
58880 exim, operating as a server, will offer resumption to clients.
58881 Current best practice is to not offer the feature to MUA connection.
58882 Commonly this can be done like this:
58883 </para>
58884 <literallayout class="monospaced">
58885 tls_resumption_hosts = ${if inlist {$received_port}{587:465} {:}{*}}
58886 </literallayout>
58887 <para>
58888 If the peer host matches the list after expansion then resumption
58889 is offered and/or accepted.
58890 </para>
58891 <para>
58892 The <option>tls_resumption_hosts</option> smtp transport option performs the
58893 equivalent function for operation as a client.
58894 If the peer host matches the list after expansion then resumption
58895 is attempted (if a stored session is available) or the information
58896 stored (if supplied by the peer).
58897 </para>
58898 </listitem>
58899 <listitem>
58900 <para>
58901 Issues:
58902 </para>
58903 <para>
58904  In a resumed session:
58905 </para>
58906 <itemizedlist>
58907 <listitem>
58908 <para>
58909   The variables <varname>$tls_{in,out}_cipher</varname> will have values different
58910  to the original (under GnuTLS).
58911 </para>
58912 </listitem>
58913 <listitem>
58914 <para>
58915   The variables <varname>$tls_{in,out}_ocsp</varname> will be "not requested" or "no response",
58916  and the <option>hosts_require_ocsp</option> smtp trasnport option will fail.
58917 </para>
58918 </listitem>
58919 </itemizedlist>
58920 </listitem>
58921 </itemizedlist>
58922 </section>
58923 <section id="SECDANE">
58924 <title>DANE</title>
58925 <para>
58926 <indexterm role="concept">
58927 <primary>DANE</primary>
58928 </indexterm>
58929 DNS-based Authentication of Named Entities, as applied to SMTP over TLS, provides assurance to a client that
58930 it is actually talking to the server it wants to rather than some attacker operating a Man In The Middle (MITM)
58931 operation.  The latter can terminate the TLS connection you make, and make another one to the server (so both
58932 you and the server still think you have an encrypted connection) and, if one of the "well known" set of
58933 Certificate Authorities has been suborned - something which *has* been seen already (2014), a verifiable
58934 certificate (if you&#x2019;re using normal root CAs, eg. the Mozilla set, as your trust anchors).
58935 </para>
58936 <para>
58937 What DANE does is replace the CAs with the DNS as the trust anchor.  The assurance is limited to a) the possibility
58938 that the DNS has been suborned, b) mistakes made by the admins of the target server.   The attack surface presented
58939 by (a) is thought to be smaller than that of the set of root CAs.
58940 </para>
58941 <para>
58942 It also allows the server to declare (implicitly) that connections to it should use TLS.  An MITM could simply
58943 fail to pass on a server&#x2019;s STARTTLS.
58944 </para>
58945 <para>
58946 DANE scales better than having to maintain (and communicate via side-channel) copies of server certificates
58947 for every possible target server.  It also scales (slightly) better than having to maintain on an SMTP
58948 client a copy of the standard CAs bundle.  It also means not having to pay a CA for certificates.
58949 </para>
58950 <para>
58951 DANE requires a server operator to do three things: 1) run DNSSEC.  This provides assurance to clients
58952 that DNS lookups they do for the server have not been tampered with.  The domain MX record applying
58953 to this server, its A record, its TLSA record and any associated CNAME records must all be covered by
58954 DNSSEC.
58955 2) add TLSA DNS records.  These say what the server certificate for a TLS connection should be.
58956 3) offer a server certificate, or certificate chain, in TLS connections which is is anchored by one of the TLSA records.
58957 </para>
58958 <para>
58959 There are no changes to Exim specific to server-side operation of DANE.
58960 Support for client-side operation of DANE can be included at compile time by defining SUPPORT_DANE=yes
58961 in <filename>Local/Makefile</filename>.
58962 If it has been included, the macro "_HAVE_DANE" will be defined.
58963 </para>
58964 <para>
58965 A TLSA record consist of 4 fields, the "Certificate Usage", the
58966 "Selector", the "Matching type", and the "Certificate Association Data".
58967 For a detailed description of the TLSA record see
58968 <emphasis role="bold"><ulink url="https://tools.ietf.org/html/rfc7671#page-5">RFC 7671</ulink></emphasis>.
58969 </para>
58970 <para>
58971 The TLSA record for the server may have "Certificate Usage" (1st) field of DANE-TA(2) or DANE-EE(3).
58972 These are the "Trust Anchor" and "End Entity" variants.
58973 The latter specifies the End Entity directly, i.e. the certificate involved is that of the server
58974 (and if only DANE-EE is used then it should be the sole one transmitted during the TLS handshake);
58975 this is appropriate for a single system, using a self-signed certificate.
58976 DANE-TA usage is effectively declaring a specific CA to be used; this might be a private CA or a public,
58977 well-known one.
58978 A private CA at simplest is just a self-signed certificate (with certain
58979 attributes) which is used to sign server certificates, but running one securely
58980 does require careful arrangement.
58981 With DANE-TA, as implemented in Exim and commonly in other MTAs,
58982 the server TLS handshake must transmit the entire certificate chain from CA to server-certificate.
58983 DANE-TA is commonly used for several services and/or servers, each having a TLSA query-domain CNAME record,
58984 all of which point to a single TLSA record.
58985 DANE-TA and DANE-EE can both be used together.
58986 </para>
58987 <para>
58988 Our recommendation is to use DANE with a certificate from a public CA,
58989 because this enables a variety of strategies for remote clients to verify
58990 your certificate.
58991 You can then publish information both via DANE and another technology,
58992 "MTA-STS", described below.
58993 </para>
58994 <para>
58995 When you use DANE-TA to publish trust anchor information, you ask entities
58996 outside your administrative control to trust the Certificate Authority for
58997 connections to you.
58998 If using a private CA then you should expect others to still apply the
58999 technical criteria they&#x2019;d use for a public CA to your certificates.
59000 In particular, you should probably try to follow current best practices for CA
59001 operation around hash algorithms and key sizes.
59002 Do not expect other organizations to lower their security expectations just
59003 because a particular profile might be reasonable for your own internal use.
59004 </para>
59005 <para>
59006 When this text was last updated, this in practice means to avoid use of SHA-1
59007 and MD5; if using RSA to use key sizes of at least 2048 bits (and no larger
59008 than 4096, for interoperability); to use keyUsage fields correctly; to use
59009 random serial numbers.
59010 The list of requirements is subject to change as best practices evolve.
59011 If you&#x2019;re not already using a private CA, or it doesn&#x2019;t meet these
59012 requirements, then we encourage you to avoid all these issues and use a public
59013 CA such as <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis> instead.
59014 </para>
59015 <para>
59016 The TLSA record should have a "Selector" (2nd) field of SPKI(1) and
59017 a "Matching Type" (3rd) field of SHA2-512(2).
59018 </para>
59019 <para>
59020 For the "Certificate Authority Data" (4th) field, commands like
59021 </para>
59022 <literallayout class="monospaced">
59023   openssl x509 -pubkey -noout &lt;certificate.pem \
59024   | openssl rsa -outform der -pubin 2&gt;/dev/null \
59025   | openssl sha512 \
59026   | awk '{print $2}'
59027 </literallayout>
59028 <para>
59029 are workable to create a hash of the certificate&#x2019;s public key.
59030 </para>
59031 <para>
59032 An example TLSA record for DANE-EE(3), SPKI(1), and SHA-512 (2) looks like
59033 </para>
59034 <literallayout class="monospaced">
59035   _25._tcp.mail.example.com. TLSA 3 1 2 8BA8A336E...
59036 </literallayout>
59037 <para>
59038 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>
59039 is useful for quickly generating TLSA records.
59040 </para>
59041 <para>
59042 For use with the DANE-TA model, server certificates must have a correct name (SubjectName or SubjectAltName).
59043 </para>
59044 <para>
59045 The Certificate issued by the CA published in the DANE-TA model should be
59046 issued using a strong hash algorithm.
59047 Exim, and importantly various other MTAs sending to you, will not
59048 re-enable hash algorithms which have been disabled by default in TLS
59049 libraries.
59050 This means no MD5 and no SHA-1.  SHA2-256 is the minimum for reliable
59051 interoperability (and probably the maximum too, in 2018).
59052 </para>
59053 <para>
59054 The use of OCSP-stapling should be considered, allowing for fast revocation of certificates (which would otherwise
59055 be limited by the DNS TTL on the TLSA records).  However, this is likely to only be usable with DANE-TA.  NOTE: the
59056 default of requesting OCSP for all hosts is modified iff DANE is in use, to:
59057 </para>
59058 <literallayout class="monospaced">
59059   hosts_request_ocsp = ${if or { {= {0}{$tls_out_tlsa_usage}} \
59060                                  {= {4}{$tls_out_tlsa_usage}} } \
59061                          {*}{}}
59062 </literallayout>
59063 <para>
59064 The (new) variable <varname>$tls_out_tlsa_usage</varname> is a bitfield with numbered bits set for TLSA record usage codes.
59065 The zero above means DANE was not in use, the four means that only DANE-TA usage TLSA records were
59066 found. If the definition of <option>hosts_request_ocsp</option> includes the
59067 string "tls_out_tlsa_usage", they are re-expanded in time to
59068 control the OCSP request.
59069 </para>
59070 <para>
59071 This modification of hosts_request_ocsp is only done if it has the default value of "*".  Admins who change it, and
59072 those who use <option>hosts_require_ocsp</option>, should consider the interaction with DANE in their OCSP settings.
59073 </para>
59074 <para>
59075 For client-side DANE there are three new smtp transport options, <option>hosts_try_dane</option>, <option>hosts_require_dane</option>
59076 and <option>dane_require_tls_ciphers</option>.
59077 The <quote>require</quote> variant will result in failure if the target host is not
59078 DNSSEC-secured. To get DNSSEC-secured hostname resolution, use
59079 the <option>dnssec_request_domains</option> router or transport option.
59080 </para>
59081 <para>
59082 DANE will only be usable if the target host has DNSSEC-secured MX, A and TLSA records.
59083 </para>
59084 <para>
59085 A TLSA lookup will be done if either of the above options match and the host-lookup succeeded using DNSSEC.
59086 If a TLSA lookup is done and succeeds, a DANE-verified TLS connection
59087 will be required for the host.  If it does not, the host will not
59088 be used; there is no fallback to non-DANE or non-TLS.
59089 </para>
59090 <para>
59091 If DANE is requested and usable, then the TLS cipher list configuration
59092 prefers to use the option <option>dane_require_tls_ciphers</option> and falls
59093 back to <option>tls_require_ciphers</option> only if that is unset.
59094 This lets you configure "decent crypto" for DANE and "better than nothing
59095 crypto" as the default.  Note though that while GnuTLS lets the string control
59096 which versions of TLS/SSL will be negotiated, OpenSSL does not and you&#x2019;re
59097 limited to ciphersuite constraints.
59098 </para>
59099 <para>
59100 If DANE is requested and useable (see above) the following transport options are ignored:
59101 </para>
59102 <literallayout class="monospaced">
59103   hosts_require_tls
59104   tls_verify_hosts
59105   tls_try_verify_hosts
59106   tls_verify_certificates
59107   tls_crl
59108   tls_verify_cert_hostnames
59109   tls_sni
59110 </literallayout>
59111 <para>
59112 If DANE is not usable, whether requested or not, and CA-anchored
59113 verification evaluation is wanted, the above variables should be set appropriately.
59114 </para>
59115 <para>
59116 The router and transport option <option>dnssec_request_domains</option> must not be
59117 set to <quote>never</quote>, and <option>dnssec_require_domains</option> is ignored.
59118 </para>
59119 <para>
59120 If verification was successful using DANE then the "CV" item in the delivery log line will show as "CV=dane".
59121 </para>
59122 <para>
59123 There is a new variable <varname>$tls_out_dane</varname> which will have "yes" if
59124 verification succeeded using DANE and "no" otherwise (only useful
59125 in combination with events; see <xref linkend="CHAPevents"/>),
59126 and a new variable <varname>$tls_out_tlsa_usage</varname> (detailed above).
59127 </para>
59128 <para>
59129 <indexterm role="concept">
59130 <primary>DANE</primary>
59131 <secondary>reporting</secondary>
59132 </indexterm>
59133 An event (see <xref linkend="CHAPevents"/>) of type "dane:fail" will be raised on failures
59134 to achieve DANE-verified connection, if one was either requested and offered, or
59135 required.  This is intended to support TLS-reporting as defined in
59136 <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>.
59137 The <varname>$event_data</varname> will be one of the Result Types defined in
59138 Section 4.3 of that document.
59139 </para>
59140 <para>
59141 Under GnuTLS, DANE is only supported from version 3.0.0 onwards.
59142 </para>
59143 <para>
59144 DANE is specified in published RFCs and decouples certificate authority trust
59145 selection from a "race to the bottom" of "you must trust everything for mail
59146 to get through".  There is an alternative technology called MTA-STS, which
59147 instead publishes MX trust anchor information on an HTTPS website.  At the
59148 time this text was last updated, MTA-STS was still a draft, not yet an RFC.
59149 Exim has no support for MTA-STS as a client, but Exim mail server operators
59150 can choose to publish information describing their TLS configuration using
59151 MTA-STS to let those clients who do use that protocol derive trust
59152 information.
59153 </para>
59154 <para>
59155 The MTA-STS design requires a certificate from a public Certificate Authority
59156 which is recognized by clients sending to you.
59157 That selection of which CAs are trusted by others is outside your control.
59158 </para>
59159 <para>
59160 The most interoperable course of action is probably to use
59161 <emphasis role="bold"><ulink url="https://letsencrypt.org/">Let&#x2019;s Encrypt</ulink></emphasis>, with automated certificate
59162 renewal; to publish the anchor information in DNSSEC-secured DNS via TLSA
59163 records for DANE clients (such as Exim and Postfix) and to publish anchor
59164 information for MTA-STS as well.  This is what is done for the <emphasis>exim.org</emphasis>
59165 domain itself (with caveats around occasionally broken MTA-STS because of
59166 incompatible specification changes prior to reaching RFC status).
59167 </para>
59168 </section>
59169 </chapter>
59170
59171 <chapter id="CHAPACL">
59172 <title>Access control lists</title>
59173 <para>
59174 <indexterm role="concept" id="IIDacl" class="startofrange">
59175 <primary>access control lists (ACLs)</primary>
59176 <secondary>description</secondary>
59177 </indexterm>
59178 <indexterm role="concept">
59179 <primary>control of incoming mail</primary>
59180 </indexterm>
59181 <indexterm role="concept">
59182 <primary>message</primary>
59183 <secondary>controlling incoming</secondary>
59184 </indexterm>
59185 <indexterm role="concept">
59186 <primary>policy control</primary>
59187 <secondary>access control lists</secondary>
59188 </indexterm>
59189 Access Control Lists (ACLs) are defined in a separate section of the runtime
59190 configuration file, headed by <quote>begin acl</quote>. Each ACL definition starts with a
59191 name, terminated by a colon. Here is a complete ACL section that contains just
59192 one very small ACL:
59193 </para>
59194 <literallayout class="monospaced">
59195 begin acl
59196 small_acl:
59197   accept   hosts = one.host.only
59198 </literallayout>
59199 <para>
59200 You can have as many lists as you like in the ACL section, and the order in
59201 which they appear does not matter. The lists are self-terminating.
59202 </para>
59203 <para>
59204 The majority of ACLs are used to control Exim&#x2019;s behaviour when it receives
59205 certain SMTP commands. This applies both to incoming TCP/IP connections, and
59206 when a local process submits a message using SMTP by specifying the <option>-bs</option>
59207 option. The most common use is for controlling which recipients are accepted
59208 in incoming messages. In addition, you can define an ACL that is used to check
59209 local non-SMTP messages. The default configuration file contains an example of
59210 a realistic ACL for checking RCPT commands. This is discussed in chapter
59211 <xref linkend="CHAPdefconfil"/>.
59212 </para>
59213 <section id="SECID188">
59214 <title>Testing ACLs</title>
59215 <para>
59216 The <option>-bh</option> command line option provides a way of testing your ACL
59217 configuration locally by running a fake SMTP session with which you interact.
59218 </para>
59219 </section>
59220 <section id="SECID189">
59221 <title>Specifying when ACLs are used</title>
59222 <para>
59223 <indexterm role="concept">
59224 <primary>access control lists (ACLs)</primary>
59225 <secondary>options for specifying</secondary>
59226 </indexterm>
59227 In order to cause an ACL to be used, you have to name it in one of the relevant
59228 options in the main part of the configuration. These options are:
59229 <indexterm role="concept">
59230 <primary>AUTH</primary>
59231 <secondary>ACL for</secondary>
59232 </indexterm>
59233 <indexterm role="concept">
59234 <primary>DATA</primary>
59235 <secondary>ACLs for</secondary>
59236 </indexterm>
59237 <indexterm role="concept">
59238 <primary>ETRN</primary>
59239 <secondary>ACL for</secondary>
59240 </indexterm>
59241 <indexterm role="concept">
59242 <primary>EXPN</primary>
59243 <secondary>ACL for</secondary>
59244 </indexterm>
59245 <indexterm role="concept">
59246 <primary>HELO</primary>
59247 <secondary>ACL for</secondary>
59248 </indexterm>
59249 <indexterm role="concept">
59250 <primary>EHLO</primary>
59251 <secondary>ACL for</secondary>
59252 </indexterm>
59253 <indexterm role="concept">
59254 <primary>DKIM</primary>
59255 <secondary>ACL for</secondary>
59256 </indexterm>
59257 <indexterm role="concept">
59258 <primary>MAIL</primary>
59259 <secondary>ACL for</secondary>
59260 </indexterm>
59261 <indexterm role="concept">
59262 <primary>QUIT, ACL for</primary>
59263 </indexterm>
59264 <indexterm role="concept">
59265 <primary>RCPT</primary>
59266 <secondary>ACL for</secondary>
59267 </indexterm>
59268 <indexterm role="concept">
59269 <primary>STARTTLS, ACL for</primary>
59270 </indexterm>
59271 <indexterm role="concept">
59272 <primary>VRFY</primary>
59273 <secondary>ACL for</secondary>
59274 </indexterm>
59275 <indexterm role="concept">
59276 <primary>SMTP</primary>
59277 <secondary>connection, ACL for</secondary>
59278 </indexterm>
59279 <indexterm role="concept">
59280 <primary>non-SMTP messages</primary>
59281 <secondary>ACLs for</secondary>
59282 </indexterm>
59283 <indexterm role="concept">
59284 <primary>MIME content scanning</primary>
59285 <secondary>ACL for</secondary>
59286 </indexterm>
59287 <indexterm role="concept">
59288 <primary>PRDR</primary>
59289 <secondary>ACL for</secondary>
59290 </indexterm>
59291 </para>
59292 <informaltable frame="none">
59293 <tgroup cols="2" colsep="0" rowsep="0">
59294 <colspec colwidth="140pt" align="left"/>
59295 <colspec colwidth="254pt" align="left"/>
59296 <tbody>
59297 <row>
59298 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp</option></entry>
59299 <entry>ACL for non-SMTP messages</entry>
59300 </row>
59301 <row>
59302 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_mime</option></entry>
59303 <entry>ACL for non-SMTP MIME parts</entry>
59304 </row>
59305 <row>
59306 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_not_smtp_start</option></entry>
59307 <entry>ACL at start of non-SMTP message</entry>
59308 </row>
59309 <row>
59310 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_auth</option></entry>
59311 <entry>ACL for AUTH</entry>
59312 </row>
59313 <row>
59314 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_connect</option></entry>
59315 <entry>ACL for start of SMTP connection</entry>
59316 </row>
59317 <row>
59318 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data</option></entry>
59319 <entry>ACL after DATA is complete</entry>
59320 </row>
59321 <row>
59322 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_data_prdr</option></entry>
59323 <entry>ACL for each recipient, after DATA is complete</entry>
59324 </row>
59325 <row>
59326 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_dkim</option></entry>
59327 <entry>ACL for each DKIM signer</entry>
59328 </row>
59329 <row>
59330 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_etrn</option></entry>
59331 <entry>ACL for ETRN</entry>
59332 </row>
59333 <row>
59334 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_expn</option></entry>
59335 <entry>ACL for EXPN</entry>
59336 </row>
59337 <row>
59338 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_helo</option></entry>
59339 <entry>ACL for HELO or EHLO</entry>
59340 </row>
59341 <row>
59342 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mail</option></entry>
59343 <entry>ACL for MAIL</entry>
59344 </row>
59345 <row>
59346 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mailauth</option></entry>
59347 <entry>ACL for the AUTH parameter of MAIL</entry>
59348 </row>
59349 <row>
59350 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_mime</option></entry>
59351 <entry>ACL for content-scanning MIME parts</entry>
59352 </row>
59353 <row>
59354 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_notquit</option></entry>
59355 <entry>ACL for non-QUIT terminations</entry>
59356 </row>
59357 <row>
59358 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_predata</option></entry>
59359 <entry>ACL at start of DATA command</entry>
59360 </row>
59361 <row>
59362 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_quit</option></entry>
59363 <entry>ACL for QUIT</entry>
59364 </row>
59365 <row>
59366 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_rcpt</option></entry>
59367 <entry>ACL for RCPT</entry>
59368 </row>
59369 <row>
59370 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_starttls</option></entry>
59371 <entry>ACL for STARTTLS</entry>
59372 </row>
59373 <row>
59374 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>acl_smtp_vrfy</option></entry>
59375 <entry>ACL for VRFY</entry>
59376 </row>
59377 </tbody>
59378 </tgroup>
59379 </informaltable>
59380 <para>
59381 For example, if you set
59382 </para>
59383 <literallayout class="monospaced">
59384 acl_smtp_rcpt = small_acl
59385 </literallayout>
59386 <para>
59387 the little ACL defined above is used whenever Exim receives a RCPT command
59388 in an SMTP dialogue. The majority of policy tests on incoming messages can be
59389 done when RCPT commands arrive. A rejection of RCPT should cause the
59390 sending MTA to give up on the recipient address contained in the RCPT
59391 command, whereas rejection at other times may cause the client MTA to keep on
59392 trying to deliver the message. It is therefore recommended that you do as much
59393 testing as possible at RCPT time.
59394 </para>
59395 </section>
59396 <section id="SECID190">
59397 <title>The non-SMTP ACLs</title>
59398 <para>
59399 <indexterm role="concept">
59400 <primary>non-SMTP messages</primary>
59401 <secondary>ACLs for</secondary>
59402 </indexterm>
59403 The non-SMTP ACLs apply to all non-interactive incoming messages, that is, they
59404 apply to batched SMTP as well as to non-SMTP messages. (Batched SMTP is not
59405 really SMTP.) Many of the ACL conditions (for example, host tests, and tests on
59406 the state of the SMTP connection such as encryption and authentication) are not
59407 relevant and are forbidden in these ACLs. However, the sender and recipients
59408 are known, so the <option>senders</option> and <option>sender_domains</option> conditions and the
59409 <varname>$sender_address</varname> and <varname>$recipients</varname> variables can be used. Variables such as
59410 <varname>$authenticated_sender</varname> are also available. You can specify added header lines
59411 in any of these ACLs.
59412 </para>
59413 <para>
59414 The <option>acl_not_smtp_start</option> ACL is run right at the start of receiving a
59415 non-SMTP message, before any of the message has been read. (This is the
59416 analogue of the <option>acl_smtp_predata</option> ACL for SMTP input.) In the case of
59417 batched SMTP input, it runs after the DATA command has been reached. The
59418 result of this ACL is ignored; it cannot be used to reject a message. If you
59419 really need to, you could set a value in an ACL variable here and reject based
59420 on that in the <option>acl_not_smtp</option> ACL. However, this ACL can be used to set
59421 controls, and in particular, it can be used to set
59422 </para>
59423 <literallayout class="monospaced">
59424 control = suppress_local_fixups
59425 </literallayout>
59426 <para>
59427 This cannot be used in the other non-SMTP ACLs because by the time they are
59428 run, it is too late.
59429 </para>
59430 <para>
59431 The <option>acl_not_smtp_mime</option> ACL is available only when Exim is compiled with the
59432 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
59433 </para>
59434 <para>
59435 The <option>acl_not_smtp</option> ACL is run just before the <function>local_scan()</function> function. Any
59436 kind of rejection is treated as permanent, because there is no way of sending a
59437 temporary error for these kinds of message.
59438 </para>
59439 </section>
59440 <section id="SECID191">
59441 <title>The SMTP connect ACL</title>
59442 <para>
59443 <indexterm role="concept">
59444 <primary>SMTP</primary>
59445 <secondary>connection, ACL for</secondary>
59446 </indexterm>
59447 <indexterm role="option">
59448 <primary><option>smtp_banner</option></primary>
59449 </indexterm>
59450 The ACL test specified by <option>acl_smtp_connect</option> happens at the start of an SMTP
59451 session, after the test specified by <option>host_reject_connection</option> (which is now
59452 an anomaly) and any TCP Wrappers testing (if configured). If the connection is
59453 accepted by an <option>accept</option> verb that has a <option>message</option> modifier, the contents of
59454 the message override the banner message that is otherwise specified by the
59455 <option>smtp_banner</option> option.
59456 </para>
59457 <para revisionflag="changed">
59458 For tls-on-connect connections, the ACL is run after the TLS connection
59459 is accepted (however, <option>host_reject_connection</option> is tested before).
59460 </para>
59461 </section>
59462 <section id="SECID192">
59463 <title>The EHLO/HELO ACL</title>
59464 <para>
59465 <indexterm role="concept">
59466 <primary>EHLO</primary>
59467 <secondary>ACL for</secondary>
59468 </indexterm>
59469 <indexterm role="concept">
59470 <primary>HELO</primary>
59471 <secondary>ACL for</secondary>
59472 </indexterm>
59473 The ACL test specified by <option>acl_smtp_helo</option> happens when the client issues an
59474 EHLO or HELO command, after the tests specified by <option>helo_accept_junk_hosts</option>,
59475 <option>helo_allow_chars</option>, <option>helo_verify_hosts</option>, and <option>helo_try_verify_hosts</option>.
59476 Note that a client may issue more than one EHLO or HELO command in an SMTP
59477 session, and indeed is required to issue a new EHLO or HELO after successfully
59478 setting up encryption following a STARTTLS command.
59479 </para>
59480 <para>
59481 Note also that a deny neither forces the client to go away nor means that
59482 mail will be refused on the connection.  Consider checking for
59483 <varname>$sender_helo_name</varname> being defined in a MAIL or RCPT ACL to do that.
59484 </para>
59485 <para>
59486 If the command is accepted by an <option>accept</option> verb that has a <option>message</option>
59487 modifier, the message may not contain more than one line (it will be truncated
59488 at the first newline and a panic logged if it does). Such a message cannot
59489 affect the EHLO options that are listed on the second and subsequent lines of
59490 an EHLO response.
59491 </para>
59492 </section>
59493 <section id="SECID193">
59494 <title>The DATA ACLs</title>
59495 <para>
59496 <indexterm role="concept">
59497 <primary>DATA</primary>
59498 <secondary>ACLs for</secondary>
59499 </indexterm>
59500 Two ACLs are associated with the DATA command, because it is two-stage
59501 command, with two responses being sent to the client.
59502 When the DATA command is received, the ACL defined by <option>acl_smtp_predata</option>
59503 is obeyed. This gives you control after all the RCPT commands, but before
59504 the message itself is received. It offers the opportunity to give a negative
59505 response to the DATA command before the data is transmitted. Header lines
59506 added by MAIL or RCPT ACLs are not visible at this time, but any that
59507 are defined here are visible when the <option>acl_smtp_data</option> ACL is run.
59508 </para>
59509 <para>
59510 You cannot test the contents of the message, for example, to verify addresses
59511 in the headers, at RCPT time or when the DATA command is received. Such
59512 tests have to appear in the ACL that is run after the message itself has been
59513 received, before the final response to the DATA command is sent. This is
59514 the ACL specified by <option>acl_smtp_data</option>, which is the second ACL that is
59515 associated with the DATA command.
59516 </para>
59517 <para>
59518 <indexterm role="concept">
59519 <primary>CHUNKING</primary>
59520 <secondary>BDAT command</secondary>
59521 </indexterm>
59522 <indexterm role="concept">
59523 <primary>BDAT</primary>
59524 <secondary>SMTP command</secondary>
59525 </indexterm>
59526 <indexterm role="concept">
59527 <primary>RFC 3030</primary>
59528 <secondary>CHUNKING</secondary>
59529 </indexterm>
59530 If CHUNKING was advertised and a BDAT command sequence is received,
59531 the <option>acl_smtp_predata</option> ACL is not run.
59532 The <option>acl_smtp_data</option> is run after the last BDAT command and all of
59533 the data specified is received.
59534 </para>
59535 <para>
59536 For both of these ACLs, it is not possible to reject individual recipients. An
59537 error response rejects the entire message. Unfortunately, it is known that some
59538 MTAs do not treat hard (5<emphasis>xx</emphasis>) responses to the DATA command (either
59539 before or after the data) correctly &ndash; they keep the message on their queues
59540 and try again later, but that is their problem, though it does waste some of
59541 your resources.
59542 </para>
59543 <para>
59544 The <option>acl_smtp_data</option> ACL is run after
59545 the <option>acl_smtp_data_prdr</option>,
59546 the <option>acl_smtp_dkim</option>
59547 and the <option>acl_smtp_mime</option> ACLs.
59548 </para>
59549 </section>
59550 <section id="SECTDKIMACL">
59551 <title>The SMTP DKIM ACL</title>
59552 <para>
59553 The <option>acl_smtp_dkim</option> ACL is available only when Exim is compiled with DKIM support
59554 enabled (which is the default).
59555 </para>
59556 <para>
59557 The ACL test specified by <option>acl_smtp_dkim</option> happens after a message has been
59558 received, and is executed for each DKIM signature found in a message.  If not
59559 otherwise specified, the default action is to accept.
59560 </para>
59561 <para>
59562 This ACL is evaluated before <option>acl_smtp_mime</option> and <option>acl_smtp_data</option>.
59563 </para>
59564 <para>
59565 For details on the operation of DKIM, see section <xref linkend="SECDKIM"/>.
59566 </para>
59567 </section>
59568 <section id="SECID194">
59569 <title>The SMTP MIME ACL</title>
59570 <para>
59571 The <option>acl_smtp_mime</option> option is available only when Exim is compiled with the
59572 content-scanning extension. For details, see chapter <xref linkend="CHAPexiscan"/>.
59573 </para>
59574 <para>
59575 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
59576 </para>
59577 </section>
59578 <section id="SECTPRDRACL">
59579 <title>The SMTP PRDR ACL</title>
59580 <para>
59581 <indexterm role="concept">
59582 <primary>PRDR</primary>
59583 <secondary>ACL for</secondary>
59584 </indexterm>
59585 <indexterm role="option">
59586 <primary><option>prdr_enable</option></primary>
59587 </indexterm>
59588 The <option>acl_smtp_data_prdr</option> ACL is available only when Exim is compiled
59589 with PRDR support enabled (which is the default).
59590 It becomes active only when the PRDR feature is negotiated between
59591 client and server for a message, and more than one recipient
59592 has been accepted.
59593 </para>
59594 <para>
59595 The ACL test specified by <option>acl_smtp_data_prdr</option> happens after a message
59596 has been received, and is executed once for each recipient of the message
59597 with <varname>$local_part</varname> and <varname>$domain</varname> valid.
59598 The test may accept, defer or deny for individual recipients.
59599 The <option>acl_smtp_data</option> will still be called after this ACL and
59600 can reject the message overall, even if this ACL has accepted it
59601 for some or all recipients.
59602 </para>
59603 <para>
59604 PRDR may be used to support per-user content filtering.  Without it
59605 one must defer any recipient after the first that has a different
59606 content-filter configuration.  With PRDR, the RCPT-time check
59607 <indexterm role="concept">
59608 <primary>PRDR</primary>
59609 <secondary>variable for</secondary>
59610 </indexterm>
59611 for this can be disabled when the variable <varname>$prdr_requested</varname>
59612 is <quote>yes</quote>.
59613 Any required difference in behaviour of the main DATA-time
59614 ACL should however depend on the PRDR-time ACL having run, as Exim
59615 will avoid doing so in some situations (e.g. single-recipient mails).
59616 </para>
59617 <para>
59618 See also the <option>prdr_enable</option> global option
59619 and the <option>hosts_try_prdr</option> smtp transport option.
59620 </para>
59621 <para>
59622 This ACL is evaluated after <option>acl_smtp_dkim</option> but before <option>acl_smtp_data</option>.
59623 If the ACL is not defined, processing completes as if
59624 the feature was not requested by the client.
59625 </para>
59626 </section>
59627 <section id="SECTQUITACL">
59628 <title>The QUIT ACL</title>
59629 <para>
59630 <indexterm role="concept">
59631 <primary>QUIT, ACL for</primary>
59632 </indexterm>
59633 The ACL for the SMTP QUIT command is anomalous, in that the outcome of the ACL
59634 does not affect the response code to QUIT, which is always 221. Thus, the ACL
59635 does not in fact control any access.
59636 For this reason, it may only accept
59637 or warn as its final result.
59638 </para>
59639 <para>
59640 This ACL can be used for tasks such as custom logging at the end of an SMTP
59641 session. For example, you can use ACL variables in other ACLs to count
59642 messages, recipients, etc., and log the totals at QUIT time using one or
59643 more <option>logwrite</option> modifiers on a <option>warn</option> verb.
59644 </para>
59645 <para>
59646 <emphasis role="bold">Warning</emphasis>: Only the <varname>$acl_c</varname><emphasis>x</emphasis> variables can be used for this, because
59647 the <varname>$acl_m</varname><emphasis>x</emphasis> variables are reset at the end of each incoming message.
59648 </para>
59649 <para>
59650 You do not need to have a final <option>accept</option>, but if you do, you can use a
59651 <option>message</option> modifier to specify custom text that is sent as part of the 221
59652 response to QUIT.
59653 </para>
59654 <para>
59655 This ACL is run only for a <quote>normal</quote> QUIT. For certain kinds of disastrous
59656 failure (for example, failure to open a log file, or when Exim is bombing out
59657 because it has detected an unrecoverable error), all SMTP commands from the
59658 client are given temporary error responses until QUIT is received or the
59659 connection is closed. In these special cases, the QUIT ACL does not run.
59660 </para>
59661 </section>
59662 <section id="SECTNOTQUITACL">
59663 <title>The not-QUIT ACL</title>
59664 <para>
59665 <indexterm role="variable">
59666 <primary><varname>$acl_smtp_notquit</varname></primary>
59667 </indexterm>
59668 The not-QUIT ACL, specified by <option>acl_smtp_notquit</option>, is run in most cases when
59669 an SMTP session ends without sending QUIT. However, when Exim itself is in bad
59670 trouble, such as being unable to write to its log files, this ACL is not run,
59671 because it might try to do things (such as write to log files) that make the
59672 situation even worse.
59673 </para>
59674 <para>
59675 Like the QUIT ACL, this ACL is provided to make it possible to do customized
59676 logging or to gather statistics, and its outcome is ignored. The <option>delay</option>
59677 modifier is forbidden in this ACL, and the only permitted verbs are <option>accept</option>
59678 and <option>warn</option>.
59679 </para>
59680 <para>
59681 <indexterm role="variable">
59682 <primary><varname>$smtp_notquit_reason</varname></primary>
59683 </indexterm>
59684 When the not-QUIT ACL is running, the variable <varname>$smtp_notquit_reason</varname> is set
59685 to a string that indicates the reason for the termination of the SMTP
59686 connection. The possible values are:
59687 </para>
59688 <informaltable frame="none">
59689 <tgroup cols="2" colsep="0" rowsep="0">
59690 <colspec colwidth="196pt" align="left"/>
59691 <colspec colwidth="254pt" align="left"/>
59692 <tbody>
59693 <row>
59694 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl-drop</literal></entry>
59695 <entry>Another ACL issued a <option>drop</option> command</entry>
59696 </row>
59697 <row>
59698 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>bad-commands</literal></entry>
59699 <entry>Too many unknown or non-mail commands</entry>
59700 </row>
59701 <row>
59702 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>command-timeout</literal></entry>
59703 <entry>Timeout while reading SMTP commands</entry>
59704 </row>
59705 <row>
59706 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection-lost</literal></entry>
59707 <entry>The SMTP connection has been lost</entry>
59708 </row>
59709 <row>
59710 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>data-timeout</literal></entry>
59711 <entry>Timeout while reading message data</entry>
59712 </row>
59713 <row>
59714 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-error</literal></entry>
59715 <entry>The <function>local_scan()</function> function crashed</entry>
59716 </row>
59717 <row>
59718 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>local-scan-timeout</literal></entry>
59719 <entry>The <function>local_scan()</function> function timed out</entry>
59720 </row>
59721 <row>
59722 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>signal-exit</literal></entry>
59723 <entry>SIGTERM or SIGINT</entry>
59724 </row>
59725 <row>
59726 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>synchronization-error</literal></entry>
59727 <entry>SMTP synchronization error</entry>
59728 </row>
59729 <row>
59730 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls-failed</literal></entry>
59731 <entry>TLS failed to start</entry>
59732 </row>
59733 </tbody>
59734 </tgroup>
59735 </informaltable>
59736 <para>
59737 In most cases when an SMTP connection is closed without having received QUIT,
59738 Exim sends an SMTP response message before actually closing the connection.
59739 With the exception of the <literal>acl-drop</literal> case, the default message can be
59740 overridden by the <option>message</option> modifier in the not-QUIT ACL. In the case of a
59741 <option>drop</option> verb in another ACL, it is the message from the other ACL that is
59742 used.
59743 </para>
59744 </section>
59745 <section id="SECID195">
59746 <title>Finding an ACL to use</title>
59747 <para>
59748 <indexterm role="concept">
59749 <primary>access control lists (ACLs)</primary>
59750 <secondary>finding which to use</secondary>
59751 </indexterm>
59752 The value of an <option>acl_smtp_</option><emphasis>xxx</emphasis> option is expanded before use, so
59753 you can use different ACLs in different circumstances. For example,
59754 </para>
59755 <literallayout class="monospaced">
59756 acl_smtp_rcpt = ${if ={25}{$interface_port} \
59757                      {acl_check_rcpt} {acl_check_rcpt_submit} }
59758 </literallayout>
59759 <para>
59760 In the default configuration file there are some example settings for
59761 providing an RFC 4409 message <quote>submission</quote> service on port 587 and
59762 an RFC 8314 <quote>submissions</quote> service on port 465. You can use a string
59763 expansion like this to choose an ACL for MUAs on these ports which is
59764 more appropriate for this purpose than the default ACL on port 25.
59765 </para>
59766 <para>
59767 The expanded string does not have to be the name of an ACL in the
59768 configuration file; there are other possibilities. Having expanded the
59769 string, Exim searches for an ACL as follows:
59770 </para>
59771 <itemizedlist>
59772 <listitem>
59773 <para>
59774 If the string begins with a slash, Exim uses it as a filename, and reads its
59775 contents as an ACL. The lines are processed in the same way as lines in the
59776 Exim configuration file. In particular, continuation lines are supported, blank
59777 lines are ignored, as are lines whose first non-whitespace character is <quote>#</quote>.
59778 If the file does not exist or cannot be read, an error occurs (typically
59779 causing a temporary failure of whatever caused the ACL to be run). For example:
59780 </para>
59781 <literallayout class="monospaced">
59782 acl_smtp_data = /etc/acls/\
59783   ${lookup{$sender_host_address}lsearch\
59784   {/etc/acllist}{$value}{default}}
59785 </literallayout>
59786 <para>
59787 This looks up an ACL file to use on the basis of the host&#x2019;s IP address, falling
59788 back to a default if the lookup fails. If an ACL is successfully read from a
59789 file, it is retained in memory for the duration of the Exim process, so that it
59790 can be re-used without having to re-read the file.
59791 </para>
59792 </listitem>
59793 <listitem>
59794 <para>
59795 If the string does not start with a slash, and does not contain any spaces,
59796 Exim searches the ACL section of the configuration for an ACL whose name
59797 matches the string.
59798 </para>
59799 </listitem>
59800 <listitem>
59801 <para>
59802 If no named ACL is found, or if the string contains spaces, Exim parses
59803 the string as an inline ACL. This can save typing in cases where you just
59804 want to have something like
59805 </para>
59806 <literallayout class="monospaced">
59807 acl_smtp_vrfy = accept
59808 </literallayout>
59809 <para>
59810 in order to allow free use of the VRFY command. Such a string may contain
59811 newlines; it is processed in the same way as an ACL that is read from a file.
59812 </para>
59813 </listitem>
59814 </itemizedlist>
59815 </section>
59816 <section id="SECID196">
59817 <title>ACL return codes</title>
59818 <para>
59819 <indexterm role="concept">
59820 <primary>access control lists (ACLs)</primary>
59821 <secondary>return codes</secondary>
59822 </indexterm>
59823 Except for the QUIT ACL, which does not affect the SMTP return code (see
59824 section <xref linkend="SECTQUITACL"/> above), the result of running an ACL is either
59825 <quote>accept</quote> or <quote>deny</quote>, or, if some test cannot be completed (for example, if a
59826 database is down), <quote>defer</quote>. These results cause 2<emphasis>xx</emphasis>, 5<emphasis>xx</emphasis>, and 4<emphasis>xx</emphasis>
59827 return codes, respectively, to be used in the SMTP dialogue. A fourth return,
59828 <quote>error</quote>, occurs when there is an error such as invalid syntax in the ACL.
59829 This also causes a 4<emphasis>xx</emphasis> return code.
59830 </para>
59831 <para>
59832 For the non-SMTP ACL, <quote>defer</quote> and <quote>error</quote> are treated in the same way as
59833 <quote>deny</quote>, because there is no mechanism for passing temporary errors to the
59834 submitters of non-SMTP messages.
59835 </para>
59836 <para>
59837 ACLs that are relevant to message reception may also return <quote>discard</quote>. This
59838 has the effect of <quote>accept</quote>, but causes either the entire message or an
59839 individual recipient address to be discarded. In other words, it is a
59840 blackholing facility. Use it with care.
59841 </para>
59842 <para>
59843 If the ACL for MAIL returns <quote>discard</quote>, all recipients are discarded, and no
59844 ACL is run for subsequent RCPT commands. The effect of <quote>discard</quote> in a
59845 RCPT ACL is to discard just the one recipient address. If there are no
59846 recipients left when the message&#x2019;s data is received, the DATA ACL is not
59847 run. A <quote>discard</quote> return from the DATA or the non-SMTP ACL discards all the
59848 remaining recipients. The <quote>discard</quote> return is not permitted for the
59849 <option>acl_smtp_predata</option> ACL.
59850 </para>
59851 <para>
59852 If the ACL for VRFY returns <quote>accept</quote>, a recipient verify (without callout)
59853 is done on the address and the result determines the SMTP response.
59854 </para>
59855 <para>
59856 <indexterm role="concept">
59857 <primary><function>local_scan()</function> function</primary>
59858 <secondary>when all recipients discarded</secondary>
59859 </indexterm>
59860 The <function>local_scan()</function> function is always run, even if there are no remaining
59861 recipients; it may create new recipients.
59862 </para>
59863 </section>
59864 <section id="SECID197">
59865 <title>Unset ACL options</title>
59866 <para>
59867 <indexterm role="concept">
59868 <primary>access control lists (ACLs)</primary>
59869 <secondary>unset options</secondary>
59870 </indexterm>
59871 The default actions when any of the <option>acl_</option><emphasis>xxx</emphasis> options are unset are not
59872 all the same. <emphasis role="bold">Note</emphasis>: These defaults apply only when the relevant ACL is
59873 not defined at all. For any defined ACL, the default action when control
59874 reaches the end of the ACL statements is <quote>deny</quote>.
59875 </para>
59876 <para>
59877 For <option>acl_smtp_quit</option> and <option>acl_not_smtp_start</option> there is no default because
59878 these two are ACLs that are used only for their side effects. They cannot be
59879 used to accept or reject anything.
59880 </para>
59881 <para>
59882 For <option>acl_not_smtp</option>, <option>acl_smtp_auth</option>, <option>acl_smtp_connect</option>,
59883 <option>acl_smtp_data</option>, <option>acl_smtp_helo</option>, <option>acl_smtp_mail</option>, <option>acl_smtp_mailauth</option>,
59884 <option>acl_smtp_mime</option>, <option>acl_smtp_predata</option>, and <option>acl_smtp_starttls</option>, the action
59885 when the ACL is not defined is <quote>accept</quote>.
59886 </para>
59887 <para>
59888 For the others (<option>acl_smtp_etrn</option>, <option>acl_smtp_expn</option>, <option>acl_smtp_rcpt</option>, and
59889 <option>acl_smtp_vrfy</option>), the action when the ACL is not defined is <quote>deny</quote>.
59890 This means that <option>acl_smtp_rcpt</option> must be defined in order to receive any
59891 messages over an SMTP connection. For an example, see the ACL in the default
59892 configuration file.
59893 </para>
59894 </section>
59895 <section id="SECID198">
59896 <title>Data for message ACLs</title>
59897 <para>
59898 <indexterm role="concept">
59899 <primary>access control lists (ACLs)</primary>
59900 <secondary>data for message ACL</secondary>
59901 </indexterm>
59902 <indexterm role="variable">
59903 <primary><varname>$domain</varname></primary>
59904 </indexterm>
59905 <indexterm role="variable">
59906 <primary><varname>$local_part</varname></primary>
59907 </indexterm>
59908 <indexterm role="variable">
59909 <primary><varname>$sender_address</varname></primary>
59910 </indexterm>
59911 <indexterm role="variable">
59912 <primary><varname>$sender_host_address</varname></primary>
59913 </indexterm>
59914 <indexterm role="variable">
59915 <primary><varname>$smtp_command</varname></primary>
59916 </indexterm>
59917 When a MAIL or RCPT ACL, or either of the DATA ACLs, is running, the variables
59918 that contain information about the host and the message&#x2019;s sender (for example,
59919 <varname>$sender_host_address</varname> and <varname>$sender_address</varname>) are set, and can be used in ACL
59920 statements. In the case of RCPT (but not MAIL or DATA), <varname>$domain</varname> and
59921 <varname>$local_part</varname> are set from the argument address. The entire SMTP command
59922 is available in <varname>$smtp_command</varname>.
59923 </para>
59924 <para>
59925 When an ACL for the AUTH parameter of MAIL is running, the variables that
59926 contain information about the host are set, but <varname>$sender_address</varname> is not yet
59927 set. Section <xref linkend="SECTauthparamail"/> contains a discussion of this parameter and
59928 how it is used.
59929 </para>
59930 <para>
59931 <indexterm role="variable">
59932 <primary><varname>$message_size</varname></primary>
59933 </indexterm>
59934 The <varname>$message_size</varname> variable is set to the value of the SIZE parameter on
59935 the MAIL command at MAIL, RCPT and pre-data time, or to -1 if
59936 that parameter is not given. The value is updated to the true message size by
59937 the time the final DATA ACL is run (after the message data has been
59938 received).
59939 </para>
59940 <para>
59941 <indexterm role="variable">
59942 <primary><varname>$rcpt_count</varname></primary>
59943 </indexterm>
59944 <indexterm role="variable">
59945 <primary><varname>$recipients_count</varname></primary>
59946 </indexterm>
59947 The <varname>$rcpt_count</varname> variable increases by one for each RCPT command received.
59948 The <varname>$recipients_count</varname> variable increases by one each time a RCPT command is
59949 accepted, so while an ACL for RCPT is being processed, it contains the number
59950 of previously accepted recipients. At DATA time (for both the DATA ACLs),
59951 <varname>$rcpt_count</varname> contains the total number of RCPT commands, and
59952 <varname>$recipients_count</varname> contains the total number of accepted recipients.
59953 </para>
59954 </section>
59955 <section id="SECTdatfornon">
59956 <title>Data for non-message ACLs</title>
59957 <para>
59958 <indexterm role="concept">
59959 <primary>access control lists (ACLs)</primary>
59960 <secondary>data for non-message ACL</secondary>
59961 </indexterm>
59962 <indexterm role="variable">
59963 <primary><varname>$smtp_command_argument</varname></primary>
59964 </indexterm>
59965 <indexterm role="variable">
59966 <primary><varname>$smtp_command</varname></primary>
59967 </indexterm>
59968 When an ACL is being run for AUTH, EHLO, ETRN, EXPN, HELO, STARTTLS, or VRFY,
59969 the remainder of the SMTP command line is placed in <varname>$smtp_command_argument</varname>,
59970 and the entire SMTP command is available in <varname>$smtp_command</varname>.
59971 These variables can be tested using a <option>condition</option> condition. For example,
59972 here is an ACL for use with AUTH, which insists that either the session is
59973 encrypted, or the CRAM-MD5 authentication method is used. In other words, it
59974 does not permit authentication methods that use cleartext passwords on
59975 unencrypted connections.
59976 </para>
59977 <literallayout class="monospaced">
59978 acl_check_auth:
59979   accept encrypted = *
59980   accept condition = ${if eq{${uc:$smtp_command_argument}}\
59981                      {CRAM-MD5}}
59982   deny   message   = TLS encryption or CRAM-MD5 required
59983 </literallayout>
59984 <para>
59985 (Another way of applying this restriction is to arrange for the authenticators
59986 that use cleartext passwords not to be advertised when the connection is not
59987 encrypted. You can use the generic <option>server_advertise_condition</option> authenticator
59988 option to do this.)
59989 </para>
59990 </section>
59991 <section id="SECID199">
59992 <title>Format of an ACL</title>
59993 <para>
59994 <indexterm role="concept">
59995 <primary>access control lists (ACLs)</primary>
59996 <secondary>format of</secondary>
59997 </indexterm>
59998 <indexterm role="concept">
59999 <primary>access control lists (ACLs)</primary>
60000 <secondary>verbs, definition of</secondary>
60001 </indexterm>
60002 An individual ACL consists of a number of statements. Each statement starts
60003 with a verb, optionally followed by a number of conditions and <quote>modifiers</quote>.
60004 Modifiers can change the way the verb operates, define error and log messages,
60005 set variables, insert delays, and vary the processing of accepted messages.
60006 </para>
60007 <para>
60008 If all the conditions are met, the verb is obeyed. The same condition may be
60009 used (with different arguments) more than once in the same statement. This
60010 provides a means of specifying an <quote>and</quote> conjunction between conditions. For
60011 example:
60012 </para>
60013 <literallayout class="monospaced">
60014 deny  dnslists = list1.example
60015       dnslists = list2.example
60016 </literallayout>
60017 <para>
60018 If there are no conditions, the verb is always obeyed. Exim stops evaluating
60019 the conditions and modifiers when it reaches a condition that fails. What
60020 happens then depends on the verb (and in one case, on a special modifier). Not
60021 all the conditions make sense at every testing point. For example, you cannot
60022 test a sender address in the ACL that is run for a VRFY command.
60023 </para>
60024 </section>
60025 <section id="SECID200">
60026 <title>ACL verbs</title>
60027 <para>
60028 The ACL verbs are as follows:
60029 </para>
60030 <itemizedlist>
60031 <listitem>
60032 <para>
60033 <indexterm role="concept">
60034 <primary><option>accept</option> ACL verb</primary>
60035 </indexterm>
60036 <option>accept</option>: If all the conditions are met, the ACL returns <quote>accept</quote>. If any
60037 of the conditions are not met, what happens depends on whether <option>endpass</option>
60038 appears among the conditions (for syntax see below). If the failing condition
60039 is before <option>endpass</option>, control is passed to the next ACL statement; if it is
60040 after <option>endpass</option>, the ACL returns <quote>deny</quote>. Consider this statement, used to
60041 check a RCPT command:
60042 </para>
60043 <literallayout class="monospaced">
60044 accept domains = +local_domains
60045        endpass
60046        verify = recipient
60047 </literallayout>
60048 <para>
60049 If the recipient domain does not match the <option>domains</option> condition, control
60050 passes to the next statement. If it does match, the recipient is verified, and
60051 the command is accepted if verification succeeds. However, if verification
60052 fails, the ACL yields <quote>deny</quote>, because the failing condition is after
60053 <option>endpass</option>.
60054 </para>
60055 <para>
60056 The <option>endpass</option> feature has turned out to be confusing to many people, so its
60057 use is not recommended nowadays. It is always possible to rewrite an ACL so
60058 that <option>endpass</option> is not needed, and it is no longer used in the default
60059 configuration.
60060 </para>
60061 <para>
60062 <indexterm role="concept">
60063 <primary><option>message</option> ACL modifier</primary>
60064 <secondary>with <option>accept</option></secondary>
60065 </indexterm>
60066 If a <option>message</option> modifier appears on an <option>accept</option> statement, its action
60067 depends on whether or not <option>endpass</option> is present. In the absence of <option>endpass</option>
60068 (when an <option>accept</option> verb either accepts or passes control to the next
60069 statement), <option>message</option> can be used to vary the message that is sent when an
60070 SMTP command is accepted. For example, in a RCPT ACL you could have:
60071 </para>
60072 <literallayout>
60073 <literal>accept  </literal>&lt;<emphasis>some conditions</emphasis>&gt;
60074 <literal>        message = OK, I will allow you through today</literal>
60075 </literallayout>
60076 <para>
60077 You can specify an SMTP response code, optionally followed by an <quote>extended
60078 response code</quote> at the start of the message, but the first digit must be the
60079 same as would be sent by default, which is 2 for an <option>accept</option> verb.
60080 </para>
60081 <para>
60082 If <option>endpass</option> is present in an <option>accept</option> statement, <option>message</option> specifies
60083 an error message that is used when access is denied. This behaviour is retained
60084 for backward compatibility, but current <quote>best practice</quote> is to avoid the use
60085 of <option>endpass</option>.
60086 </para>
60087 </listitem>
60088 <listitem>
60089 <para>
60090 <indexterm role="concept">
60091 <primary><option>defer</option> ACL verb</primary>
60092 </indexterm>
60093 <option>defer</option>: If all the conditions are true, the ACL returns <quote>defer</quote> which, in
60094 an SMTP session, causes a 4<emphasis>xx</emphasis> response to be given. For a non-SMTP ACL,
60095 <option>defer</option> is the same as <option>deny</option>, because there is no way of sending a
60096 temporary error. For a RCPT command, <option>defer</option> is much the same as using a
60097 <command>redirect</command> router and <literal>:defer:</literal> while verifying, but the <option>defer</option> verb can
60098 be used in any ACL, and even for a recipient it might be a simpler approach.
60099 </para>
60100 </listitem>
60101 <listitem>
60102 <para>
60103 <indexterm role="concept">
60104 <primary><option>deny</option> ACL verb</primary>
60105 </indexterm>
60106 <option>deny</option>: If all the conditions are met, the ACL returns <quote>deny</quote>. If any of
60107 the conditions are not met, control is passed to the next ACL statement. For
60108 example,
60109 </para>
60110 <literallayout class="monospaced">
60111 deny dnslists = blackholes.mail-abuse.org
60112 </literallayout>
60113 <para>
60114 rejects commands from hosts that are on a DNS black list.
60115 </para>
60116 </listitem>
60117 <listitem>
60118 <para>
60119 <indexterm role="concept">
60120 <primary><option>discard</option> ACL verb</primary>
60121 </indexterm>
60122 <option>discard</option>: This verb behaves like <option>accept</option>, except that it returns
60123 <quote>discard</quote> from the ACL instead of <quote>accept</quote>. It is permitted only on ACLs
60124 that are concerned with receiving messages. When all the conditions are true,
60125 the sending entity receives a <quote>success</quote> response. However, <option>discard</option> causes
60126 recipients to be discarded. If it is used in an ACL for RCPT, just the one
60127 recipient is discarded; if used for MAIL, DATA or in the non-SMTP ACL, all the
60128 message&#x2019;s recipients are discarded. Recipients that are discarded before DATA
60129 do not appear in the log line when the <option>received_recipients</option> log selector is set.
60130 </para>
60131 <para>
60132 If the <option>log_message</option> modifier is set when <option>discard</option> operates,
60133 its contents are added to the line that is automatically written to the log.
60134 The <option>message</option> modifier operates exactly as it does for <option>accept</option>.
60135 </para>
60136 </listitem>
60137 <listitem>
60138 <para>
60139 <indexterm role="concept">
60140 <primary><option>drop</option> ACL verb</primary>
60141 </indexterm>
60142 <option>drop</option>: This verb behaves like <option>deny</option>, except that an SMTP connection is
60143 forcibly closed after the 5<emphasis>xx</emphasis> error message has been sent. For example:
60144 </para>
60145 <literallayout class="monospaced">
60146 drop   condition = ${if &gt; {$rcpt_count}{20}}
60147        message   = I don't take more than 20 RCPTs
60148 </literallayout>
60149 <para>
60150 There is no difference between <option>deny</option> and <option>drop</option> for the connect-time ACL.
60151 The connection is always dropped after sending a 550 response.
60152 </para>
60153 </listitem>
60154 <listitem>
60155 <para>
60156 <indexterm role="concept">
60157 <primary><option>require</option> ACL verb</primary>
60158 </indexterm>
60159 <option>require</option>: If all the conditions are met, control is passed to the next ACL
60160 statement. If any of the conditions are not met, the ACL returns <quote>deny</quote>. For
60161 example, when checking a RCPT command,
60162 </para>
60163 <literallayout class="monospaced">
60164 require message = Sender did not verify
60165         verify  = sender
60166 </literallayout>
60167 <para>
60168 passes control to subsequent statements only if the message&#x2019;s sender can be
60169 verified. Otherwise, it rejects the command. Note the positioning of the
60170 <option>message</option> modifier, before the <option>verify</option> condition. The reason for this is
60171 discussed in section <xref linkend="SECTcondmodproc"/>.
60172 </para>
60173 </listitem>
60174 <listitem>
60175 <para>
60176 <indexterm role="concept">
60177 <primary><option>warn</option> ACL verb</primary>
60178 </indexterm>
60179 <option>warn</option>: If all the conditions are true, a line specified by the
60180 <option>log_message</option> modifier is written to Exim&#x2019;s main log. Control always passes
60181 to the next ACL statement. If any condition is false, the log line is not
60182 written. If an identical log line is requested several times in the same
60183 message, only one copy is actually written to the log. If you want to force
60184 duplicates to be written, use the <option>logwrite</option> modifier instead.
60185 </para>
60186 <para>
60187 If <option>log_message</option> is not present, a <option>warn</option> verb just checks its conditions
60188 and obeys any <quote>immediate</quote> modifiers (such as <option>control</option>, <option>set</option>,
60189 <option>logwrite</option>, <option>add_header</option>, and <option>remove_header</option>) that appear before the
60190 first failing condition. There is more about adding header lines in section
60191 <xref linkend="SECTaddheadacl"/>.
60192 </para>
60193 <para>
60194 If any condition on a <option>warn</option> statement cannot be completed (that is, there is
60195 some sort of defer), the log line specified by <option>log_message</option> is not written.
60196 This does not include the case of a forced failure from a lookup, which
60197 is considered to be a successful completion. After a defer, no further
60198 conditions or modifiers in the <option>warn</option> statement are processed. The incident
60199 is logged, and the ACL continues to be processed, from the next statement
60200 onwards.
60201 </para>
60202 <para>
60203 <indexterm role="variable">
60204 <primary><varname>$acl_verify_message</varname></primary>
60205 </indexterm>
60206 When one of the <option>warn</option> conditions is an address verification that fails, the
60207 text of the verification failure message is in <varname>$acl_verify_message</varname>. If you
60208 want this logged, you must set it up explicitly. For example:
60209 </para>
60210 <literallayout class="monospaced">
60211 warn   !verify = sender
60212        log_message = sender verify failed: $acl_verify_message
60213 </literallayout>
60214 </listitem>
60215 </itemizedlist>
60216 <para>
60217 At the end of each ACL there is an implicit unconditional <option>deny</option>.
60218 </para>
60219 <para>
60220 As you can see from the examples above, the conditions and modifiers are
60221 written one to a line, with the first one on the same line as the verb, and
60222 subsequent ones on following lines. If you have a very long condition, you can
60223 continue it onto several physical lines by the usual backslash continuation
60224 mechanism. It is conventional to align the conditions vertically.
60225 </para>
60226 </section>
60227 <section id="SECTaclvariables">
60228 <title>ACL variables</title>
60229 <para>
60230 <indexterm role="concept">
60231 <primary>access control lists (ACLs)</primary>
60232 <secondary>variables</secondary>
60233 </indexterm>
60234 There are some special variables that can be set during ACL processing. They
60235 can be used to pass information between different ACLs, different invocations
60236 of the same ACL in the same SMTP connection, and between ACLs and the routers,
60237 transports, and filters that are used to deliver a message. The names of these
60238 variables must begin with <varname>$acl_c</varname> or <varname>$acl_m</varname>, followed either by a digit or
60239 an underscore, but the remainder of the name can be any sequence of
60240 alphanumeric characters and underscores that you choose. There is no limit on
60241 the number of ACL variables. The two sets act as follows:
60242 </para>
60243 <itemizedlist>
60244 <listitem>
60245 <para>
60246 The values of those variables whose names begin with <varname>$acl_c</varname> persist
60247 throughout an SMTP connection. They are never reset. Thus, a value that is set
60248 while receiving one message is still available when receiving the next message
60249 on the same SMTP connection.
60250 </para>
60251 </listitem>
60252 <listitem>
60253 <para>
60254 The values of those variables whose names begin with <varname>$acl_m</varname> persist only
60255 while a message is being received. They are reset afterwards. They are also
60256 reset by MAIL, RSET, EHLO, HELO, and after starting up a TLS session.
60257 </para>
60258 </listitem>
60259 </itemizedlist>
60260 <para>
60261 When a message is accepted, the current values of all the ACL variables are
60262 preserved with the message and are subsequently made available at delivery
60263 time. The ACL variables are set by a modifier called <option>set</option>. For example:
60264 </para>
60265 <literallayout class="monospaced">
60266 accept hosts = whatever
60267        set acl_m4 = some value
60268 accept authenticated = *
60269        set acl_c_auth = yes
60270 </literallayout>
60271 <para>
60272 <emphasis role="bold">Note</emphasis>: A leading dollar sign is not used when naming a variable that is to
60273 be set. If you want to set a variable without taking any action, you can use a
60274 <option>warn</option> verb without any other modifiers or conditions.
60275 </para>
60276 <para>
60277 <indexterm role="option">
60278 <primary><option>strict_acl_vars</option></primary>
60279 </indexterm>
60280 What happens if a syntactically valid but undefined ACL variable is
60281 referenced depends on the setting of the <option>strict_acl_vars</option> option. If it is
60282 false (the default), an empty string is substituted; if it is true, an
60283 error is generated.
60284 </para>
60285 <para>
60286 Versions of Exim before 4.64 have a limited set of numbered variables, but
60287 their names are compatible, so there is no problem with upgrading.
60288 </para>
60289 </section>
60290 <section id="SECTcondmodproc">
60291 <title>Condition and modifier processing</title>
60292 <para>
60293 <indexterm role="concept">
60294 <primary>access control lists (ACLs)</primary>
60295 <secondary>conditions; processing</secondary>
60296 </indexterm>
60297 <indexterm role="concept">
60298 <primary>access control lists (ACLs)</primary>
60299 <secondary>modifiers; processing</secondary>
60300 </indexterm>
60301 An exclamation mark preceding a condition negates its result. For example:
60302 </para>
60303 <literallayout class="monospaced">
60304 deny   domains = *.dom.example
60305       !verify  = recipient
60306 </literallayout>
60307 <para>
60308 causes the ACL to return <quote>deny</quote> if the recipient domain ends in
60309 <emphasis>dom.example</emphasis> and the recipient address cannot be verified. Sometimes
60310 negation can be used on the right-hand side of a condition. For example, these
60311 two statements are equivalent:
60312 </para>
60313 <literallayout class="monospaced">
60314 deny  hosts = !192.168.3.4
60315 deny !hosts =  192.168.3.4
60316 </literallayout>
60317 <para>
60318 However, for many conditions (<option>verify</option> being a good example), only left-hand
60319 side negation of the whole condition is possible.
60320 </para>
60321 <para>
60322 The arguments of conditions and modifiers are expanded. A forced failure
60323 of an expansion causes a condition to be ignored, that is, it behaves as if the
60324 condition is true. Consider these two statements:
60325 </para>
60326 <literallayout class="monospaced">
60327 accept  senders = ${lookup{$host_name}lsearch\
60328                   {/some/file}{$value}fail}
60329 accept  senders = ${lookup{$host_name}lsearch\
60330                   {/some/file}{$value}{}}
60331 </literallayout>
60332 <para>
60333 Each attempts to look up a list of acceptable senders. If the lookup succeeds,
60334 the returned list is searched, but if the lookup fails the behaviour is
60335 different in the two cases. The <option>fail</option> in the first statement causes the
60336 condition to be ignored, leaving no further conditions. The <option>accept</option> verb
60337 therefore succeeds. The second statement, however, generates an empty list when
60338 the lookup fails. No sender can match an empty list, so the condition fails,
60339 and therefore the <option>accept</option> also fails.
60340 </para>
60341 <para>
60342 ACL modifiers appear mixed in with conditions in ACL statements. Some of them
60343 specify actions that are taken as the conditions for a statement are checked;
60344 others specify text for messages that are used when access is denied or a
60345 warning is generated. The <option>control</option> modifier affects the way an incoming
60346 message is handled.
60347 </para>
60348 <para>
60349 The positioning of the modifiers in an ACL statement is important, because the
60350 processing of a verb ceases as soon as its outcome is known. Only those
60351 modifiers that have already been encountered will take effect. For example,
60352 consider this use of the <option>message</option> modifier:
60353 </para>
60354 <literallayout class="monospaced">
60355 require message = Can't verify sender
60356         verify  = sender
60357         message = Can't verify recipient
60358         verify  = recipient
60359         message = This message cannot be used
60360 </literallayout>
60361 <para>
60362 If sender verification fails, Exim knows that the result of the statement is
60363 <quote>deny</quote>, so it goes no further. The first <option>message</option> modifier has been seen,
60364 so its text is used as the error message. If sender verification succeeds, but
60365 recipient verification fails, the second message is used. If recipient
60366 verification succeeds, the third message becomes <quote>current</quote>, but is never used
60367 because there are no more conditions to cause failure.
60368 </para>
60369 <para>
60370 For the <option>deny</option> verb, on the other hand, it is always the last <option>message</option>
60371 modifier that is used, because all the conditions must be true for rejection to
60372 happen. Specifying more than one <option>message</option> modifier does not make sense, and
60373 the message can even be specified after all the conditions. For example:
60374 </para>
60375 <literallayout class="monospaced">
60376 deny   hosts = ...
60377       !senders = *@my.domain.example
60378        message = Invalid sender from client host
60379 </literallayout>
60380 <para>
60381 The <quote>deny</quote> result does not happen until the end of the statement is reached,
60382 by which time Exim has set up the message.
60383 </para>
60384 </section>
60385 <section id="SECTACLmodi">
60386 <title>ACL modifiers</title>
60387 <para>
60388 <indexterm role="concept">
60389 <primary>access control lists (ACLs)</primary>
60390 <secondary>modifiers; list of</secondary>
60391 </indexterm>
60392 The ACL modifiers are as follows:
60393 </para>
60394 <variablelist>
60395 <varlistentry>
60396 <term><emphasis role="bold">add_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60397 <listitem>
60398 <para>
60399 This modifier specifies one or more header lines that are to be added to an
60400 incoming message, assuming, of course, that the message is ultimately
60401 accepted. For details, see section <xref linkend="SECTaddheadacl"/>.
60402 </para>
60403 </listitem></varlistentry>
60404 <varlistentry>
60405 <term><emphasis role="bold">continue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60406 <listitem>
60407 <para>
60408 <indexterm role="concept">
60409 <primary><option>continue</option> ACL modifier</primary>
60410 </indexterm>
60411 <indexterm role="concept">
60412 <primary>database</primary>
60413 <secondary>updating in ACL</secondary>
60414 </indexterm>
60415 This modifier does nothing of itself, and processing of the ACL always
60416 continues with the next condition or modifier. The value of <option>continue</option> is in
60417 the side effects of expanding its argument. Typically this could be used to
60418 update a database. It is really just a syntactic tidiness, to avoid having to
60419 write rather ugly lines like this:
60420 </para>
60421 <literallayout>
60422 <literal>condition = ${if eq{0}{</literal>&lt;<emphasis>some expansion</emphasis>&gt;<literal>}{true}{true}}</literal>
60423 </literallayout>
60424 <para>
60425 Instead, all you need is
60426 </para>
60427 <literallayout>
60428 <literal>continue = </literal>&lt;<emphasis>some expansion</emphasis>&gt;
60429 </literallayout>
60430 </listitem></varlistentry>
60431 <varlistentry>
60432 <term><emphasis role="bold">control</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60433 <listitem>
60434 <para>
60435 <indexterm role="concept">
60436 <primary><option>control</option> ACL modifier</primary>
60437 </indexterm>
60438 This modifier affects the subsequent processing of the SMTP connection or of an
60439 incoming message that is accepted. The effect of the first type of control
60440 lasts for the duration of the connection, whereas the effect of the second type
60441 lasts only until the current message has been received. The message-specific
60442 controls always apply to the whole message, not to individual recipients,
60443 even if the <option>control</option> modifier appears in a RCPT ACL.
60444 </para>
60445 <para>
60446 As there are now quite a few controls that can be applied, they are described
60447 separately in section <xref linkend="SECTcontrols"/>. The <option>control</option> modifier can be used
60448 in several different ways. For example:
60449 </para>
60450 <itemizedlist>
60451 <listitem>
60452 <para>
60453 It can be at the end of an <option>accept</option> statement:
60454 </para>
60455 <literallayout class="monospaced">
60456     accept  ...some conditions
60457             control = queue
60458 </literallayout>
60459 <para>
60460 In this case, the control is applied when this statement yields <quote>accept</quote>, in
60461 other words, when the conditions are all true.
60462 </para>
60463 </listitem>
60464 <listitem>
60465 <para>
60466 It can be in the middle of an <option>accept</option> statement:
60467 </para>
60468 <literallayout class="monospaced">
60469     accept  ...some conditions...
60470             control = queue
60471             ...some more conditions...
60472 </literallayout>
60473 <para>
60474 If the first set of conditions are true, the control is applied, even if the
60475 statement does not accept because one of the second set of conditions is false.
60476 In this case, some subsequent statement must yield <quote>accept</quote> for the control
60477 to be relevant.
60478 </para>
60479 </listitem>
60480 <listitem>
60481 <para>
60482 It can be used with <option>warn</option> to apply the control, leaving the
60483 decision about accepting or denying to a subsequent verb. For
60484 example:
60485 </para>
60486 <literallayout class="monospaced">
60487     warn    ...some conditions...
60488             control = freeze
60489     accept  ...
60490 </literallayout>
60491 <para>
60492 This example of <option>warn</option> does not contain <option>message</option>, <option>log_message</option>, or
60493 <option>logwrite</option>, so it does not add anything to the message and does not write a
60494 log entry.
60495 </para>
60496 </listitem>
60497 <listitem>
60498 <para>
60499 If you want to apply a control unconditionally, you can use it with a
60500 <option>require</option> verb. For example:
60501 </para>
60502 <literallayout class="monospaced">
60503     require  control = no_multiline_responses
60504 </literallayout>
60505 </listitem>
60506 </itemizedlist>
60507 </listitem></varlistentry>
60508 <varlistentry>
60509 <term><emphasis role="bold">delay</emphasis>&nbsp;=&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
60510 <listitem>
60511 <para>
60512 <indexterm role="concept">
60513 <primary><option>delay</option> ACL modifier</primary>
60514 </indexterm>
60515 <indexterm role="option">
60516 <primary><option>-bh</option></primary>
60517 </indexterm>
60518 This modifier may appear in any ACL except notquit. It causes Exim to wait for
60519 the time interval before proceeding. However, when testing Exim using the
60520 <option>-bh</option> option, the delay is not actually imposed (an appropriate message is
60521 output instead). The time is given in the usual Exim notation, and the delay
60522 happens as soon as the modifier is processed. In an SMTP session, pending
60523 output is flushed before the delay is imposed.
60524 </para>
60525 <para>
60526 Like <option>control</option>, <option>delay</option> can be used with <option>accept</option> or <option>deny</option>, for
60527 example:
60528 </para>
60529 <literallayout class="monospaced">
60530 deny    ...some conditions...
60531         delay = 30s
60532 </literallayout>
60533 <para>
60534 The delay happens if all the conditions are true, before the statement returns
60535 <quote>deny</quote>. Compare this with:
60536 </para>
60537 <literallayout class="monospaced">
60538 deny    delay = 30s
60539         ...some conditions...
60540 </literallayout>
60541 <para>
60542 which waits for 30s before processing the conditions. The <option>delay</option> modifier
60543 can also be used with <option>warn</option> and together with <option>control</option>:
60544 </para>
60545 <literallayout class="monospaced">
60546 warn    ...some conditions...
60547         delay = 2m
60548         control = freeze
60549 accept  ...
60550 </literallayout>
60551 <para>
60552 If <option>delay</option> is encountered when the SMTP PIPELINING extension is in use,
60553 responses to several commands are no longer buffered and sent in one packet (as
60554 they would normally be) because all output is flushed before imposing the
60555 delay. This optimization is disabled so that a number of small delays do not
60556 appear to the client as one large aggregated delay that might provoke an
60557 unwanted timeout. You can, however, disable output flushing for <option>delay</option> by
60558 using a <option>control</option> modifier to set <option>no_delay_flush</option>.
60559 </para>
60560 </listitem></varlistentry>
60561 <varlistentry>
60562 <term><emphasis role="bold">endpass</emphasis></term>
60563 <listitem>
60564 <para>
60565 <indexterm role="concept">
60566 <primary><option>endpass</option> ACL modifier</primary>
60567 </indexterm>
60568 This modifier, which has no argument, is recognized only in <option>accept</option> and
60569 <option>discard</option> statements. It marks the boundary between the conditions whose
60570 failure causes control to pass to the next statement, and the conditions whose
60571 failure causes the ACL to return <quote>deny</quote>. This concept has proved to be
60572 confusing to some people, so the use of <option>endpass</option> is no longer recommended as
60573 <quote>best practice</quote>. See the description of <option>accept</option> above for more details.
60574 </para>
60575 </listitem></varlistentry>
60576 <varlistentry>
60577 <term><emphasis role="bold">log_message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60578 <listitem>
60579 <para>
60580 <indexterm role="concept">
60581 <primary><option>log_message</option> ACL modifier</primary>
60582 </indexterm>
60583 This modifier sets up a message that is used as part of the log message if the
60584 ACL denies access or a <option>warn</option> statement&#x2019;s conditions are true. For example:
60585 </para>
60586 <literallayout class="monospaced">
60587 require log_message = wrong cipher suite $tls_in_cipher
60588         encrypted   = DES-CBC3-SHA
60589 </literallayout>
60590 <para>
60591 <option>log_message</option> is also used when recipients are discarded by <option>discard</option>. For
60592 example:
60593 </para>
60594 <literallayout>
60595 <literal>discard </literal>&lt;<emphasis>some conditions</emphasis>&gt;
60596 <literal>        log_message = Discarded $local_part@$domain because...</literal>
60597 </literallayout>
60598 <para>
60599 When access is denied, <option>log_message</option> adds to any underlying error message
60600 that may exist because of a condition failure. For example, while verifying a
60601 recipient address, a <emphasis>:fail:</emphasis> redirection might have already set up a
60602 message.
60603 </para>
60604 <para>
60605 The message may be defined before the conditions to which it applies, because
60606 the string expansion does not happen until Exim decides that access is to be
60607 denied. This means that any variables that are set by the condition are
60608 available for inclusion in the message. For example, the <varname>$dnslist_</varname>&lt;<emphasis>xxx</emphasis>&gt;
60609 variables are set after a DNS black list lookup succeeds. If the expansion of
60610 <option>log_message</option> fails, or if the result is an empty string, the modifier is
60611 ignored.
60612 </para>
60613 <para>
60614 <indexterm role="variable">
60615 <primary><varname>$acl_verify_message</varname></primary>
60616 </indexterm>
60617 If you want to use a <option>warn</option> statement to log the result of an address
60618 verification, you can use <varname>$acl_verify_message</varname> to include the verification
60619 error message.
60620 </para>
60621 <para>
60622 If <option>log_message</option> is used with a <option>warn</option> statement, <quote>Warning:</quote> is added to
60623 the start of the logged message. If the same warning log message is requested
60624 more than once while receiving  a single email message, only one copy is
60625 actually logged. If you want to log multiple copies, use <option>logwrite</option> instead
60626 of <option>log_message</option>. In the absence of <option>log_message</option> and <option>logwrite</option>, nothing
60627 is logged for a successful <option>warn</option> statement.
60628 </para>
60629 <para>
60630 If <option>log_message</option> is not present and there is no underlying error message (for
60631 example, from the failure of address verification), but <option>message</option> is present,
60632 the <option>message</option> text is used for logging rejections. However, if any text for
60633 logging contains newlines, only the first line is logged. In the absence of
60634 both <option>log_message</option> and <option>message</option>, a default built-in message is used for
60635 logging rejections.
60636 </para>
60637 </listitem></varlistentry>
60638 <varlistentry>
60639 <term><emphasis role="bold">log_reject_target</emphasis>&nbsp;=&nbsp;&lt;<emphasis>log name list</emphasis>&gt;</term>
60640 <listitem>
60641 <para>
60642 <indexterm role="concept">
60643 <primary><option>log_reject_target</option> ACL modifier</primary>
60644 </indexterm>
60645 <indexterm role="concept">
60646 <primary>logging in ACL</primary>
60647 <secondary>specifying which log</secondary>
60648 </indexterm>
60649 This modifier makes it possible to specify which logs are used for messages
60650 about ACL rejections. Its argument is a colon-separated list of words that can
60651 be <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote>. The default is <literal>main:reject</literal>. The list
60652 may be empty, in which case a rejection is not logged at all. For example, this
60653 ACL fragment writes no logging information when access is denied:
60654 </para>
60655 <literallayout>
60656 <literal>deny </literal>&lt;<emphasis>some conditions</emphasis>&gt;
60657 <literal>     log_reject_target =</literal>
60658 </literallayout>
60659 <para>
60660 This modifier can be used in SMTP and non-SMTP ACLs. It applies to both
60661 permanent and temporary rejections. Its effect lasts for the rest of the
60662 current ACL.
60663 </para>
60664 </listitem></varlistentry>
60665 <varlistentry>
60666 <term><emphasis role="bold">logwrite</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60667 <listitem>
60668 <para>
60669 <indexterm role="concept">
60670 <primary><option>logwrite</option> ACL modifier</primary>
60671 </indexterm>
60672 <indexterm role="concept">
60673 <primary>logging in ACL</primary>
60674 <secondary>immediate</secondary>
60675 </indexterm>
60676 This modifier writes a message to a log file as soon as it is encountered when
60677 processing an ACL. (Compare <option>log_message</option>, which, except in the case of
60678 <option>warn</option> and <option>discard</option>, is used only if the ACL statement denies
60679 access.) The <option>logwrite</option> modifier can be used to log special incidents in
60680 ACLs. For example:
60681 </para>
60682 <literallayout>
60683 <literal>accept </literal>&lt;<emphasis>some special conditions</emphasis>&gt;
60684 <literal>       control  = freeze</literal>
60685 <literal>       logwrite = froze message because ...</literal>
60686 </literallayout>
60687 <para>
60688 By default, the message is written to the main log. However, it may begin
60689 with a colon, followed by a comma-separated list of log names, and then
60690 another colon, to specify exactly which logs are to be written. For
60691 example:
60692 </para>
60693 <literallayout class="monospaced">
60694 logwrite = :main,reject: text for main and reject logs
60695 logwrite = :panic: text for panic log only
60696 </literallayout>
60697 </listitem></varlistentry>
60698 <varlistentry>
60699 <term><emphasis role="bold">message</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60700 <listitem>
60701 <para>
60702 <indexterm role="concept">
60703 <primary><option>message</option> ACL modifier</primary>
60704 </indexterm>
60705 This modifier sets up a text string that is expanded and used as a response
60706 message when an ACL statement terminates the ACL with an <quote>accept</quote>, <quote>deny</quote>,
60707 or <quote>defer</quote> response. (In the case of the <option>accept</option> and <option>discard</option> verbs,
60708 there is some complication if <option>endpass</option> is involved; see the description of
60709 <option>accept</option> for details.)
60710 </para>
60711 <para>
60712 The expansion of the message happens at the time Exim decides that the ACL is
60713 to end, not at the time it processes <option>message</option>. If the expansion fails, or
60714 generates an empty string, the modifier is ignored. Here is an example where
60715 <option>message</option> must be specified first, because the ACL ends with a rejection if
60716 the <option>hosts</option> condition fails:
60717 </para>
60718 <literallayout class="monospaced">
60719 require  message = Host not recognized
60720          hosts = 10.0.0.0/8
60721 </literallayout>
60722 <para>
60723 (Once a condition has failed, no further conditions or modifiers are
60724 processed.)
60725 </para>
60726 <para>
60727 <indexterm role="concept">
60728 <primary>SMTP</primary>
60729 <secondary>error codes</secondary>
60730 </indexterm>
60731 <indexterm role="option">
60732 <primary><option>smtp_banner</option></primary>
60733 </indexterm>
60734 For ACLs that are triggered by SMTP commands, the message is returned as part
60735 of the SMTP response. The use of <option>message</option> with <option>accept</option> (or <option>discard</option>)
60736 is meaningful only for SMTP, as no message is returned when a non-SMTP message
60737 is accepted. In the case of the connect ACL, accepting with a message modifier
60738 overrides the value of <option>smtp_banner</option>. For the EHLO/HELO ACL, a customized
60739 accept message may not contain more than one line (otherwise it will be
60740 truncated at the first newline and a panic logged), and it cannot affect the
60741 EHLO options.
60742 </para>
60743 <para>
60744 When SMTP is involved, the message may begin with an overriding response code,
60745 consisting of three digits optionally followed by an <quote>extended response code</quote>
60746 of the form <emphasis>n.n.n</emphasis>, each code being followed by a space. For example:
60747 </para>
60748 <literallayout class="monospaced">
60749 deny  message = 599 1.2.3 Host not welcome
60750       hosts = 192.168.34.0/24
60751 </literallayout>
60752 <para>
60753 The first digit of the supplied response code must be the same as would be sent
60754 by default. A panic occurs if it is not. Exim uses a 550 code when it denies
60755 access, but for the predata ACL, note that the default success code is 354, not
60756 2<emphasis>xx</emphasis>.
60757 </para>
60758 <para>
60759 Notwithstanding the previous paragraph, for the QUIT ACL, unlike the others,
60760 the message modifier cannot override the 221 response code.
60761 </para>
60762 <para>
60763 The text in a <option>message</option> modifier is literal; any quotes are taken as
60764 literals, but because the string is expanded, backslash escapes are processed
60765 anyway. If the message contains newlines, this gives rise to a multi-line SMTP
60766 response.
60767 </para>
60768 <para>
60769 <indexterm role="variable">
60770 <primary><varname>$acl_verify_message</varname></primary>
60771 </indexterm>
60772 While the text is being expanded, the <varname>$acl_verify_message</varname> variable
60773 contains any message previously set.
60774 Afterwards, <varname>$acl_verify_message</varname> is cleared.
60775 </para>
60776 <para>
60777 If <option>message</option> is used on a statement that verifies an address, the message
60778 specified overrides any message that is generated by the verification process.
60779 However, the original message is available in the variable
60780 <varname>$acl_verify_message</varname>, so you can incorporate it into your message if you
60781 wish. In particular, if you want the text from <option>:fail:</option> items in <command>redirect</command>
60782 routers to be passed back as part of the SMTP response, you should either not
60783 use a <option>message</option> modifier, or make use of <varname>$acl_verify_message</varname>.
60784 </para>
60785 <para>
60786 For compatibility with previous releases of Exim, a <option>message</option> modifier that
60787 is used with a <option>warn</option> verb behaves in a similar way to the <option>add_header</option>
60788 modifier, but this usage is now deprecated. However, <option>message</option> acts only when
60789 all the conditions are true, wherever it appears in an ACL command, whereas
60790 <option>add_header</option> acts as soon as it is encountered. If <option>message</option> is used with
60791 <option>warn</option> in an ACL that is not concerned with receiving a message, it has no
60792 effect.
60793 </para>
60794 </listitem></varlistentry>
60795 <varlistentry>
60796 <term><emphasis role="bold">queue</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60797 <listitem>
60798 <para>
60799 <indexterm role="concept">
60800 <primary><option>queue</option> ACL modifier</primary>
60801 </indexterm>
60802 <indexterm role="concept">
60803 <primary>named queues</primary>
60804 <secondary>selecting in ACL</secondary>
60805 </indexterm>
60806 This modifier specifies the use of a named queue for spool files
60807 for the message.
60808 It can only be used before the message is received (i.e. not in
60809 the DATA ACL).
60810 This could be used, for example, for known high-volume burst sources
60811 of traffic, or for quarantine of messages.
60812 Separate queue-runner processes will be needed for named queues.
60813 If the text after expansion is empty, the default queue is used.
60814 </para>
60815 </listitem></varlistentry>
60816 <varlistentry>
60817 <term><emphasis role="bold">remove_header</emphasis>&nbsp;=&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
60818 <listitem>
60819 <para>
60820 This modifier specifies one or more header names in a colon-separated list
60821  that are to be removed from an incoming message, assuming, of course, that
60822 the message is ultimately accepted. For details, see section <xref linkend="SECTremoveheadacl"/>.
60823 </para>
60824 </listitem></varlistentry>
60825 <varlistentry>
60826 <term><emphasis role="bold">set</emphasis>&nbsp;&lt;<emphasis>acl_name</emphasis>&gt;&nbsp;=&nbsp;&lt;<emphasis>value</emphasis>&gt;</term>
60827 <listitem>
60828 <para>
60829 <indexterm role="concept">
60830 <primary><option>set</option> ACL modifier</primary>
60831 </indexterm>
60832 This modifier puts a value into one of the ACL variables (see section
60833 <xref linkend="SECTaclvariables"/>).
60834 </para>
60835 </listitem></varlistentry>
60836 <varlistentry>
60837 <term><emphasis role="bold">udpsend</emphasis>&nbsp;=&nbsp;&lt;<emphasis>parameters</emphasis>&gt;</term>
60838 <listitem>
60839 <para>
60840 <indexterm role="concept">
60841 <primary>UDP communications</primary>
60842 </indexterm>
60843 This modifier sends a UDP packet, for purposes such as statistics
60844 collection or behaviour monitoring. The parameters are expanded, and
60845 the result of the expansion must be a colon-separated list consisting
60846 of a destination server, port number, and the packet contents. The
60847 server can be specified as a host name or IPv4 or IPv6 address. The
60848 separator can be changed with the usual angle bracket syntax. For
60849 example, you might want to collect information on which hosts connect
60850 when:
60851 </para>
60852 <literallayout class="monospaced">
60853 udpsend = &lt;; 2001:dB8::dead:beef ; 1234 ;\
60854              $tod_zulu $sender_host_address
60855 </literallayout>
60856 </listitem></varlistentry>
60857 </variablelist>
60858 </section>
60859 <section id="SECTcontrols">
60860 <title>Use of the control modifier</title>
60861 <para>
60862 <indexterm role="concept">
60863 <primary><option>control</option> ACL modifier</primary>
60864 </indexterm>
60865 The <option>control</option> modifier supports the following settings:
60866 </para>
60867 <variablelist>
60868 <varlistentry>
60869 <term><emphasis role="bold">control&nbsp;=&nbsp;allow_auth_unadvertised</emphasis></term>
60870 <listitem>
60871 <para>
60872 This modifier allows a client host to use the SMTP AUTH command even when it
60873 has not been advertised in response to EHLO. Furthermore, because there are
60874 apparently some really broken clients that do this, Exim will accept AUTH after
60875 HELO (rather than EHLO) when this control is set. It should be used only if you
60876 really need it, and you should limit its use to those broken clients that do
60877 not work without it. For example:
60878 </para>
60879 <literallayout class="monospaced">
60880 warn hosts   = 192.168.34.25
60881      control = allow_auth_unadvertised
60882 </literallayout>
60883 <para>
60884 Normally, when an Exim server receives an AUTH command, it checks the name of
60885 the authentication mechanism that is given in the command to ensure that it
60886 matches an advertised mechanism. When this control is set, the check that a
60887 mechanism has been advertised is bypassed. Any configured mechanism can be used
60888 by the client. This control is permitted only in the connection and HELO ACLs.
60889 </para>
60890 </listitem></varlistentry>
60891 <varlistentry>
60892 <term><emphasis role="bold">control&nbsp;=&nbsp;caseful_local_part</emphasis></term>
60893 <term><emphasis role="bold">control&nbsp;=&nbsp;caselower_local_part</emphasis></term>
60894 <listitem>
60895 <para>
60896 <indexterm role="concept">
60897 <primary>access control lists (ACLs)</primary>
60898 <secondary>case of local part in</secondary>
60899 </indexterm>
60900 <indexterm role="concept">
60901 <primary>case of local parts</primary>
60902 </indexterm>
60903 <indexterm role="variable">
60904 <primary><varname>$local_part</varname></primary>
60905 </indexterm>
60906 These two controls are permitted only in the ACL specified by <option>acl_smtp_rcpt</option>
60907 (that is, during RCPT processing). By default, the contents of <varname>$local_part</varname>
60908 are lower cased before ACL processing. If <quote>caseful_local_part</quote> is specified,
60909 any uppercase letters in the original local part are restored in <varname>$local_part</varname>
60910 for the rest of the ACL, or until a control that sets <quote>caselower_local_part</quote>
60911 is encountered.
60912 </para>
60913 <para>
60914 These controls affect only the current recipient. Moreover, they apply only to
60915 local part handling that takes place directly in the ACL (for example, as a key
60916 in lookups). If a test to verify the recipient is obeyed, the case-related
60917 handling of the local part during the verification is controlled by the router
60918 configuration (see the <option>caseful_local_part</option> generic router option).
60919 </para>
60920 <para>
60921 This facility could be used, for example, to add a spam score to local parts
60922 containing upper case letters. For example, using <varname>$acl_m4</varname> to accumulate the
60923 spam score:
60924 </para>
60925 <literallayout class="monospaced">
60926 warn  control = caseful_local_part
60927       set acl_m4 = ${eval:\
60928                      $acl_m4 + \
60929                      ${if match{$local_part}{[A-Z]}{1}{0}}\
60930                     }
60931       control = caselower_local_part
60932 </literallayout>
60933 <para>
60934 Notice that we put back the lower cased version afterwards, assuming that
60935 is what is wanted for subsequent tests.
60936 </para>
60937 </listitem></varlistentry>
60938 <varlistentry>
60939 <term><emphasis role="bold">control&nbsp;=&nbsp;cutthrough_delivery/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
60940 <listitem>
60941 <para>
60942 <indexterm role="concept">
60943 <primary>access control lists (ACLs)</primary>
60944 <secondary>cutthrough routing</secondary>
60945 </indexterm>
60946 <indexterm role="concept">
60947 <primary>cutthrough</primary>
60948 <secondary>requesting</secondary>
60949 </indexterm>
60950 This option requests delivery be attempted while the item is being received.
60951 </para>
60952 <para>
60953 The option is usable in the RCPT ACL.
60954 If enabled for a message received via smtp and routed to an smtp transport,
60955 and only one transport, interface, destination host and port combination
60956 is used for all recipients of the message,
60957 then the delivery connection is made while the receiving connection is open
60958 and data is copied from one to the other.
60959 </para>
60960 <para>
60961 An attempt to set this option for any recipient but the first
60962 for a mail will be quietly ignored.
60963 If a recipient-verify callout
60964 (with use_sender)
60965 connection is subsequently
60966 requested in the same ACL it is held open and used for
60967 any subsequent recipients and the data,
60968 otherwise one is made after the initial RCPT ACL completes.
60969 </para>
60970 <para>
60971 Note that routers are used in verify mode,
60972 and cannot depend on content of received headers.
60973 Note also that headers cannot be
60974 modified by any of the post-data ACLs (DATA, MIME and DKIM).
60975 Headers may be modified by routers (subject to the above) and transports.
60976 The <emphasis>Received-By:</emphasis> header is generated as soon as the body reception starts,
60977 rather than the traditional time after the full message is received;
60978 this will affect the timestamp.
60979 </para>
60980 <para>
60981 All the usual ACLs are called; if one results in the message being
60982 rejected, all effort spent in delivery (including the costs on
60983 the ultimate destination) will be wasted.
60984 Note that in the case of data-time ACLs this includes the entire
60985 message body.
60986 </para>
60987 <para>
60988 Cutthrough delivery is not supported via transport-filters or when DKIM signing
60989 of outgoing messages is done, because it sends data to the ultimate destination
60990 before the entire message has been received from the source.
60991 It is not supported for messages received with the SMTP PRDR
60992 or CHUNKING
60993 options in use.
60994 </para>
60995 <para>
60996 Should the ultimate destination system positively accept or reject the mail,
60997 a corresponding indication is given to the source system and nothing is queued.
60998 If the item is successfully delivered in cutthrough mode
60999 the delivery log lines are tagged with "&gt;&gt;" rather than "=&gt;" and appear
61000 before the acceptance "&lt;=" line.
61001 </para>
61002 <para>
61003 If there is a temporary error the item is queued for later delivery in the
61004 usual fashion.
61005 This behaviour can be adjusted by appending the option <emphasis role="bold">defer=</emphasis>&lt;<emphasis>value</emphasis>&gt;
61006 to the control; the default value is <quote>spool</quote> and the alternate value
61007 <quote>pass</quote> copies an SMTP defer response from the target back to the initiator
61008 and does not queue the message.
61009 Note that this is independent of any recipient verify conditions in the ACL.
61010 </para>
61011 <para>
61012 Delivery in this mode avoids the generation of a bounce mail to a
61013 (possibly faked)
61014 sender when the destination system is doing content-scan based rejection.
61015 </para>
61016 </listitem></varlistentry>
61017 <varlistentry>
61018 <term><emphasis role="bold">control&nbsp;=&nbsp;debug/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
61019 <listitem>
61020 <para>
61021 <indexterm role="concept">
61022 <primary>access control lists (ACLs)</primary>
61023 <secondary>enabling debug logging</secondary>
61024 </indexterm>
61025 <indexterm role="concept">
61026 <primary>debugging</primary>
61027 <secondary>enabling from an ACL</secondary>
61028 </indexterm>
61029 This control turns on debug logging, almost as though Exim had been invoked
61030 with <literal>-d</literal>, with the output going to a new logfile in the usual logs directory,
61031 by default called <emphasis>debuglog</emphasis>.
61032 </para>
61033 <para revisionflag="changed">
61034 Logging set up by the control will be maintained across spool residency.
61035 </para>
61036 <para revisionflag="changed">
61037 Options are a slash-separated list.
61038 If an option takes an argument, the option name and argument are separated by
61039 an equals character.
61040 Several options are supported:
61041 </para>
61042 <literallayout>
61043 tag=&lt;<emphasis>suffix</emphasis>&gt;         The filename can be adjusted with thise option.
61044                      The argument, which may access any variables already defined,
61045                      is appended to the default name.
61046
61047 opts=&lt;<emphasis>debug&nbsp;options</emphasis>&gt; The argument specififes what is to be logged,
61048                      using the same values as the <literal>-d</literal> command-line option.
61049
61050 stop                 Logging started with this control may be
61051                      stopped by using this option.
61052
61053 kill                 Logging started with this control may be
61054                      stopped by using this option.
61055                      Additionally the debug file will be removed,
61056                      providing one means for speculative debug tracing.
61057
61058 pretrigger=&lt;<emphasis>size</emphasis>&gt;    This option specifies a memory buffuer to be used
61059                      for pre-trigger debug capture.
61060                      Debug lines are recorded in the buffer until
61061                      and if) a trigger occurs; at which time they are
61062                      dumped to the debug file.  Newer lines displace the
61063                      oldest if the buffer is full.  After a trigger,
61064                      immediate writes to file are done as normal.
61065
61066 trigger=&lt;<emphasis>reason</emphasis>&gt;     This option selects cause for the pretrigger buffer
61067                      see above) to be copied to file.  A reason of $*now*
61068                      take effect immediately; one of <emphasis role="bold">paniclog</emphasis> triggers
61069                      on a write to the panic log.
61070 </literallayout>
61071 <para>
61072 Some examples (which depend on variables that don&#x2019;t exist in all
61073 contexts):
61074 </para>
61075 <literallayout class="monospaced">
61076       control = debug
61077       control = debug/tag=.$sender_host_address
61078       control = debug/opts=+expand+acl
61079       control = debug/tag=.$message_exim_id/opts=+expand
61080       control = debug/kill
61081       control = debug/opts=+all/pretrigger=1024/trigger=paniclog
61082       control = debug/trigger=now
61083 </literallayout>
61084 </listitem></varlistentry>
61085 <varlistentry>
61086 <term><emphasis role="bold">control&nbsp;=&nbsp;dkim_disable_verify</emphasis></term>
61087 <listitem>
61088 <para>
61089 <indexterm role="concept">
61090 <primary>disable DKIM verify</primary>
61091 </indexterm>
61092 <indexterm role="concept">
61093 <primary>DKIM</primary>
61094 <secondary>disable verify</secondary>
61095 </indexterm>
61096 This control turns off DKIM verification processing entirely.  For details on
61097 the operation and configuration of DKIM, see section <xref linkend="SECDKIM"/>.
61098 </para>
61099 </listitem></varlistentry>
61100 <varlistentry>
61101 <term><emphasis role="bold">control&nbsp;=&nbsp;dmarc_disable_verify</emphasis></term>
61102 <listitem>
61103 <para>
61104 <indexterm role="concept">
61105 <primary>disable DMARC verify</primary>
61106 </indexterm>
61107 <indexterm role="concept">
61108 <primary>DMARC</primary>
61109 <secondary>disable verify</secondary>
61110 </indexterm>
61111 This control turns off DMARC verification processing entirely.  For details on
61112 the operation and configuration of DMARC, see section <xref linkend="SECDMARC"/>.
61113 </para>
61114 </listitem></varlistentry>
61115 <varlistentry>
61116 <term><emphasis role="bold">control&nbsp;=&nbsp;dscp/</emphasis>&lt;<emphasis>value</emphasis>&gt;</term>
61117 <listitem>
61118 <para>
61119 <indexterm role="concept">
61120 <primary>access control lists (ACLs)</primary>
61121 <secondary>setting DSCP value</secondary>
61122 </indexterm>
61123 <indexterm role="concept">
61124 <primary>DSCP</primary>
61125 <secondary>inbound</secondary>
61126 </indexterm>
61127 This option causes the DSCP value associated with the socket for the inbound
61128 connection to be adjusted to a given value, given as one of a number of fixed
61129 strings or to numeric value.
61130 The <option>-bI:dscp</option> option may be used to ask Exim which names it knows of.
61131 Common values include <literal>throughput</literal>, <literal>mincost</literal>, and on newer systems
61132 <literal>ef</literal>, <literal>af41</literal>, etc.  Numeric values may be in the range 0 to 0x3F.
61133 </para>
61134 <para>
61135 The outbound packets from Exim will be marked with this value in the header
61136 (for IPv4, the TOS field; for IPv6, the TCLASS field); there is no guarantee
61137 that these values will have any effect, not be stripped by networking
61138 equipment, or do much of anything without cooperation with your Network
61139 Engineer and those of all network operators between the source and destination.
61140 </para>
61141 </listitem></varlistentry>
61142 <varlistentry>
61143 <term><emphasis role="bold">control&nbsp;=&nbsp;enforce_sync</emphasis></term>
61144 <term><emphasis role="bold">control&nbsp;=&nbsp;no_enforce_sync</emphasis></term>
61145 <listitem>
61146 <para>
61147 <indexterm role="concept">
61148 <primary>SMTP</primary>
61149 <secondary>synchronization checking</secondary>
61150 </indexterm>
61151 <indexterm role="concept">
61152 <primary>synchronization checking in SMTP</primary>
61153 </indexterm>
61154 These controls make it possible to be selective about when SMTP synchronization
61155 is enforced. The global option <option>smtp_enforce_sync</option> specifies the initial
61156 state of the switch (it is true by default). See the description of this option
61157 in chapter <xref linkend="CHAPmainconfig"/> for details of SMTP synchronization checking.
61158 </para>
61159 <para>
61160 The effect of these two controls lasts for the remainder of the SMTP
61161 connection. They can appear in any ACL except the one for the non-SMTP
61162 messages. The most straightforward place to put them is in the ACL defined by
61163 <option>acl_smtp_connect</option>, which is run at the start of an incoming SMTP connection,
61164 before the first synchronization check. The expected use is to turn off the
61165 synchronization checks for badly-behaved hosts that you nevertheless need to
61166 work with.
61167 </para>
61168 </listitem></varlistentry>
61169 <varlistentry>
61170 <term><emphasis role="bold">control&nbsp;=&nbsp;fakedefer/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
61171 <listitem>
61172 <para>
61173 <indexterm role="concept">
61174 <primary>fake defer</primary>
61175 </indexterm>
61176 <indexterm role="concept">
61177 <primary>defer, fake</primary>
61178 </indexterm>
61179 This control works in exactly the same way as <option>fakereject</option> (described below)
61180 except that it causes an SMTP 450 response after the message data instead of a
61181 550 response. You must take care when using <option>fakedefer</option> because it causes the
61182 messages to be duplicated when the sender retries. Therefore, you should not
61183 use <option>fakedefer</option> if the message is to be delivered normally.
61184 </para>
61185 </listitem></varlistentry>
61186 <varlistentry>
61187 <term><emphasis role="bold">control&nbsp;=&nbsp;fakereject/</emphasis>&lt;<emphasis>message</emphasis>&gt;</term>
61188 <listitem>
61189 <para>
61190 <indexterm role="concept">
61191 <primary>fake rejection</primary>
61192 </indexterm>
61193 <indexterm role="concept">
61194 <primary>rejection, fake</primary>
61195 </indexterm>
61196 This control is permitted only for the MAIL, RCPT, and DATA ACLs, in other
61197 words, only when an SMTP message is being received. If Exim accepts the
61198 message, instead the final 250 response, a 550 rejection message is sent.
61199 However, Exim proceeds to deliver the message as normal. The control applies
61200 only to the current message, not to any subsequent ones that may be received in
61201 the same SMTP connection.
61202 </para>
61203 <para>
61204 The text for the 550 response is taken from the <option>control</option> modifier. If no
61205 message is supplied, the following is used:
61206 </para>
61207 <literallayout class="monospaced">
61208 550-Your message has been rejected but is being
61209 550-kept for evaluation.
61210 550-If it was a legitimate message, it may still be
61211 550 delivered to the target recipient(s).
61212 </literallayout>
61213 <para>
61214 This facility should be used with extreme caution.
61215 </para>
61216 </listitem></varlistentry>
61217 <varlistentry>
61218 <term><emphasis role="bold">control&nbsp;=&nbsp;freeze</emphasis></term>
61219 <listitem>
61220 <para>
61221 <indexterm role="concept">
61222 <primary>frozen messages</primary>
61223 <secondary>forcing in ACL</secondary>
61224 </indexterm>
61225 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
61226 other words, only when a message is being received. If the message is accepted,
61227 it is placed on Exim&#x2019;s queue and frozen. The control applies only to the
61228 current message, not to any subsequent ones that may be received in the same
61229 SMTP connection.
61230 </para>
61231 <para>
61232 This modifier can optionally be followed by <literal>/no_tell</literal>. If the global option
61233 <option>freeze_tell</option> is set, it is ignored for the current message (that is, nobody
61234 is told about the freezing), provided all the <emphasis role="bold">control=freeze</emphasis> modifiers that
61235 are obeyed for the current message have the <literal>/no_tell</literal> option.
61236 </para>
61237 </listitem></varlistentry>
61238 <varlistentry>
61239 <term><emphasis role="bold">control&nbsp;=&nbsp;no_delay_flush</emphasis></term>
61240 <listitem>
61241 <para>
61242 <indexterm role="concept">
61243 <primary>SMTP</primary>
61244 <secondary>output flushing, disabling for delay</secondary>
61245 </indexterm>
61246 Exim normally flushes SMTP output before implementing a delay in an ACL, to
61247 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
61248 use. This control, as long as it is encountered before the <option>delay</option> modifier,
61249 disables such output flushing.
61250 </para>
61251 </listitem></varlistentry>
61252 <varlistentry>
61253 <term><emphasis role="bold">control&nbsp;=&nbsp;no_callout_flush</emphasis></term>
61254 <listitem>
61255 <para>
61256 <indexterm role="concept">
61257 <primary>SMTP</primary>
61258 <secondary>output flushing, disabling for callout</secondary>
61259 </indexterm>
61260 Exim normally flushes SMTP output before performing a callout in an ACL, to
61261 avoid unexpected timeouts in clients when the SMTP PIPELINING extension is in
61262 use. This control, as long as it is encountered before the <option>verify</option> condition
61263 that causes the callout, disables such output flushing.
61264 </para>
61265 </listitem></varlistentry>
61266 <varlistentry>
61267 <term><emphasis role="bold">control&nbsp;=&nbsp;no_mbox_unspool</emphasis></term>
61268 <listitem>
61269 <para>
61270 This control is available when Exim is compiled with the content scanning
61271 extension. Content scanning may require a copy of the current message, or parts
61272 of it, to be written in <quote>mbox format</quote> to a spool file, for passing to a virus
61273 or spam scanner. Normally, such copies are deleted when they are no longer
61274 needed. If this control is set, the copies are not deleted. The control applies
61275 only to the current message, not to any subsequent ones that may be received in
61276 the same SMTP connection. It is provided for debugging purposes and is unlikely
61277 to be useful in production.
61278 </para>
61279 </listitem></varlistentry>
61280 <varlistentry>
61281 <term><emphasis role="bold">control&nbsp;=&nbsp;no_multiline_responses</emphasis></term>
61282 <listitem>
61283 <para>
61284 <indexterm role="concept">
61285 <primary>multiline responses, suppressing</primary>
61286 </indexterm>
61287 This control is permitted for any ACL except the one for non-SMTP messages.
61288 It seems that there are broken clients in use that cannot handle multiline
61289 SMTP responses, despite the fact that RFC 821 defined them over 20 years ago.
61290 </para>
61291 <para>
61292 If this control is set, multiline SMTP responses from ACL rejections are
61293 suppressed. One way of doing this would have been to put out these responses as
61294 one long line. However, RFC 2821 specifies a maximum of 512 bytes per response
61295 (<quote>use multiline responses for more</quote> it says &ndash; ha!), and some of the
61296 responses might get close to that. So this facility, which is after all only a
61297 sop to broken clients, is implemented by doing two very easy things:
61298 </para>
61299 <itemizedlist>
61300 <listitem>
61301 <para>
61302 Extra information that is normally output as part of a rejection caused by
61303 sender verification failure is omitted. Only the final line (typically <quote>sender
61304 verification failed</quote>) is sent.
61305 </para>
61306 </listitem>
61307 <listitem>
61308 <para>
61309 If a <option>message</option> modifier supplies a multiline response, only the first
61310 line is output.
61311 </para>
61312 </listitem>
61313 </itemizedlist>
61314 <para>
61315 The setting of the switch can, of course, be made conditional on the
61316 calling host. Its effect lasts until the end of the SMTP connection.
61317 </para>
61318 </listitem></varlistentry>
61319 <varlistentry>
61320 <term><emphasis role="bold">control&nbsp;=&nbsp;no_pipelining</emphasis></term>
61321 <listitem>
61322 <para>
61323 <indexterm role="concept">
61324 <primary>PIPELINING</primary>
61325 <secondary>suppressing advertising</secondary>
61326 </indexterm>
61327 <indexterm role="concept">
61328 <primary>ESMTP extensions</primary>
61329 <secondary>PIPELINING</secondary>
61330 </indexterm>
61331 This control turns off the advertising of the PIPELINING extension to SMTP in
61332 the current session. To be useful, it must be obeyed before Exim sends its
61333 response to an EHLO command. Therefore, it should normally appear in an ACL
61334 controlled by <option>acl_smtp_connect</option> or <option>acl_smtp_helo</option>. See also
61335 <option>pipelining_advertise_hosts</option>.
61336 </para>
61337 </listitem></varlistentry>
61338 <varlistentry>
61339 <term><emphasis role="bold">control&nbsp;=&nbsp;queue/</emphasis>&lt;<emphasis>options</emphasis>&gt;*</term>
61340 <term><emphasis role="bold">control&nbsp;=&nbsp;queue_only</emphasis></term>
61341 <listitem>
61342 <para>
61343 <indexterm role="option">
61344 <primary><option>queue</option></primary>
61345 </indexterm>
61346 <indexterm role="option">
61347 <primary><option>queue_only</option></primary>
61348 </indexterm>
61349 <indexterm role="concept">
61350 <primary>queueing incoming messages</primary>
61351 </indexterm>
61352 <indexterm role="concept">
61353 <primary>queueing</primary>
61354 <secondary>forcing in ACL</secondary>
61355 </indexterm>
61356 <indexterm role="concept">
61357 <primary>first pass routing</primary>
61358 </indexterm>
61359 This control is permitted only for the MAIL, RCPT, DATA, and non-SMTP ACLs, in
61360 other words, only when a message is being received. If the message is accepted,
61361 it is placed on Exim&#x2019;s queue and left there for delivery by a subsequent queue
61362 runner.
61363 If used with no options set,
61364 no immediate delivery process is started. In other words, it has the
61365 effect as the <option>queue_only</option> global option or <emphasis>-odq</emphasis> command-line option.
61366 </para>
61367 <para>
61368 If the <emphasis>first_pass_route</emphasis> option is given then
61369 the behaviour is like the command-line <emphasis>-oqds</emphasis> option;
61370 a delivery process is started which stops short of making
61371 any SMTP delivery.  The benefit is that the hints database will be updated for
61372 the message being waiting for a specific host, and a later queue run will be
61373 able to send all such messages on a single connection.
61374 </para>
61375 <para>
61376 The control only applies to the current message, not to any subsequent ones that
61377  may be received in the same SMTP connection.
61378 </para>
61379 </listitem></varlistentry>
61380 <varlistentry>
61381 <term><emphasis role="bold">control&nbsp;=&nbsp;submission/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
61382 <listitem>
61383 <para>
61384 <indexterm role="concept">
61385 <primary>message</primary>
61386 <secondary>submission</secondary>
61387 </indexterm>
61388 <indexterm role="concept">
61389 <primary>submission mode</primary>
61390 </indexterm>
61391 This control is permitted only for the MAIL, RCPT, and start of data ACLs (the
61392 latter is the one defined by <option>acl_smtp_predata</option>). Setting it tells Exim that
61393 the current message is a submission from a local MUA. In this case, Exim
61394 operates in <quote>submission mode</quote>, and applies certain fixups to the message if
61395 necessary. For example, it adds a <emphasis>Date:</emphasis> header line if one is not present.
61396 This control is not permitted in the <option>acl_smtp_data</option> ACL, because that is too
61397 late (the message has already been created).
61398 </para>
61399 <para>
61400 Chapter <xref linkend="CHAPmsgproc"/> describes the processing that Exim applies to
61401 messages. Section <xref linkend="SECTsubmodnon"/> covers the processing that happens in
61402 submission mode; the available options for this control are described there.
61403 The control applies only to the current message, not to any subsequent ones
61404 that may be received in the same SMTP connection.
61405 </para>
61406 </listitem></varlistentry>
61407 <varlistentry>
61408 <term><emphasis role="bold">control&nbsp;=&nbsp;suppress_local_fixups</emphasis></term>
61409 <listitem>
61410 <para>
61411 <indexterm role="concept">
61412 <primary>submission fixups, suppressing</primary>
61413 </indexterm>
61414 This control applies to locally submitted (non TCP/IP) messages, and is the
61415 complement of <literal>control = submission</literal>. It disables the fixups that are
61416 normally applied to locally-submitted messages. Specifically:
61417 </para>
61418 <itemizedlist>
61419 <listitem>
61420 <para>
61421 Any <emphasis>Sender:</emphasis> header line is left alone (in this respect, it is a
61422 dynamic version of <option>local_sender_retain</option>).
61423 </para>
61424 </listitem>
61425 <listitem>
61426 <para>
61427 No <emphasis>Message-ID:</emphasis>, <emphasis>From:</emphasis>, or <emphasis>Date:</emphasis> header lines are added.
61428 </para>
61429 </listitem>
61430 <listitem>
61431 <para>
61432 There is no check that <emphasis>From:</emphasis> corresponds to the actual sender.
61433 </para>
61434 </listitem>
61435 </itemizedlist>
61436 <para>
61437 This control may be useful when a remotely-originated message is accepted,
61438 passed to some scanning program, and then re-submitted for delivery. It can be
61439 used only in the <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
61440 and <option>acl_not_smtp_start</option> ACLs, because it has to be set before the message&#x2019;s
61441 data is read.
61442 </para>
61443 <para>
61444 <emphasis role="bold">Note:</emphasis> This control applies only to the current message, not to any others
61445 that are being submitted at the same time using <option>-bs</option> or <option>-bS</option>.
61446 </para>
61447 </listitem></varlistentry>
61448 <varlistentry>
61449 <term><emphasis role="bold">control&nbsp;=&nbsp;utf8_downconvert</emphasis></term>
61450 <listitem>
61451 <para>
61452 This control enables conversion of UTF-8 in message envelope addresses
61453 to a-label form.
61454 For details see section <xref linkend="SECTi18nMTA"/>.
61455 </para>
61456 </listitem></varlistentry>
61457 </variablelist>
61458 </section>
61459 <section id="SECTsummesfix">
61460 <title>Summary of message fixup control</title>
61461 <para>
61462 All four possibilities for message fixups can be specified:
61463 </para>
61464 <itemizedlist>
61465 <listitem>
61466 <para>
61467 Locally submitted, fixups applied: the default.
61468 </para>
61469 </listitem>
61470 <listitem>
61471 <para>
61472 Locally submitted, no fixups applied: use
61473 <literal>control = suppress_local_fixups</literal>.
61474 </para>
61475 </listitem>
61476 <listitem>
61477 <para>
61478 Remotely submitted, no fixups applied: the default.
61479 </para>
61480 </listitem>
61481 <listitem>
61482 <para>
61483 Remotely submitted, fixups applied: use <literal>control = submission</literal>.
61484 </para>
61485 </listitem>
61486 </itemizedlist>
61487 </section>
61488 <section id="SECTaddheadacl">
61489 <title>Adding header lines in ACLs</title>
61490 <para>
61491 <indexterm role="concept">
61492 <primary>header lines</primary>
61493 <secondary>adding in an ACL</secondary>
61494 </indexterm>
61495 <indexterm role="concept">
61496 <primary>header lines</primary>
61497 <secondary>position of added lines</secondary>
61498 </indexterm>
61499 <indexterm role="concept">
61500 <primary><option>add_header</option> ACL modifier</primary>
61501 </indexterm>
61502 The <option>add_header</option> modifier can be used to add one or more extra header lines
61503 to an incoming message, as in this example:
61504 </para>
61505 <literallayout class="monospaced">
61506 warn dnslists = sbl.spamhaus.org : \
61507                 dialup.mail-abuse.org
61508      add_header = X-blacklisted-at: $dnslist_domain
61509 </literallayout>
61510 <para>
61511 The <option>add_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
61512 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
61513 receiving a message). The message must ultimately be accepted for
61514 <option>add_header</option> to have any significant effect. You can use <option>add_header</option> with
61515 any ACL verb, including <option>deny</option> (though this is potentially useful only in a
61516 RCPT ACL).
61517 </para>
61518 <para>
61519 Headers will not be added to the message if the modifier is used in
61520 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
61521 </para>
61522 <para>
61523 Leading and trailing newlines are removed from
61524 the data for the <option>add_header</option> modifier; if it then
61525 contains one or more newlines that
61526 are not followed by a space or a tab, it is assumed to contain multiple header
61527 lines. Each one is checked for valid syntax; <literal>X-ACL-Warn:</literal> is added to the
61528 front of any line that is not a valid header line.
61529 </para>
61530 <para>
61531 Added header lines are accumulated during the MAIL, RCPT, and predata ACLs.
61532 They are added to the message before processing the DATA and MIME ACLs.
61533 However, if an identical header line is requested more than once, only one copy
61534 is actually added to the message. Further header lines may be accumulated
61535 during the DATA and MIME ACLs, after which they are added to the message, again
61536 with duplicates suppressed. Thus, it is possible to add two identical header
61537 lines to an SMTP message, but only if one is added before DATA and one after.
61538 In the case of non-SMTP messages, new headers are accumulated during the
61539 non-SMTP ACLs, and are added to the message after all the ACLs have run. If a
61540 message is rejected after DATA or by the non-SMTP ACL, all added header lines
61541 are included in the entry that is written to the reject log.
61542 </para>
61543 <para>
61544 <indexterm role="concept">
61545 <primary>header lines</primary>
61546 <secondary>added; visibility of</secondary>
61547 </indexterm>
61548 Header lines are not visible in string expansions
61549 of message headers
61550 until they are added to the
61551 message. It follows that header lines defined in the MAIL, RCPT, and predata
61552 ACLs are not visible until the DATA ACL and MIME ACLs are run. Similarly,
61553 header lines that are added by the DATA or MIME ACLs are not visible in those
61554 ACLs. Because of this restriction, you cannot use header lines as a way of
61555 passing data between (for example) the MAIL and RCPT ACLs. If you want to do
61556 this, you can use ACL variables, as described in section
61557 <xref linkend="SECTaclvariables"/>.
61558 </para>
61559 <para>
61560 The list of headers yet to be added is given by the <option>$headers_added</option> variable.
61561 </para>
61562 <para>
61563 The <option>add_header</option> modifier acts immediately as it is encountered during the
61564 processing of an ACL. Notice the difference between these two cases:
61565 </para>
61566 <literallayout>
61567 <literal>accept add_header = ADDED: some text</literal>
61568 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
61569
61570 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
61571 <literal>       add_header = ADDED: some text</literal>
61572 </literallayout>
61573 <para>
61574 In the first case, the header line is always added, whether or not the
61575 condition is true. In the second case, the header line is added only if the
61576 condition is true. Multiple occurrences of <option>add_header</option> may occur in the same
61577 ACL statement. All those that are encountered before a condition fails are
61578 honoured.
61579 </para>
61580 <para>
61581 <indexterm role="concept">
61582 <primary><option>warn</option> ACL verb</primary>
61583 </indexterm>
61584 For compatibility with previous versions of Exim, a <option>message</option> modifier for a
61585 <option>warn</option> verb acts in the same way as <option>add_header</option>, except that it takes
61586 effect only if all the conditions are true, even if it appears before some of
61587 them. Furthermore, only the last occurrence of <option>message</option> is honoured. This
61588 usage of <option>message</option> is now deprecated. If both <option>add_header</option> and <option>message</option>
61589 are present on a <option>warn</option> verb, both are processed according to their
61590 specifications.
61591 </para>
61592 <para>
61593 By default, new header lines are added to a message at the end of the existing
61594 header lines. However, you can specify that any particular header line should
61595 be added right at the start (before all the <emphasis>Received:</emphasis> lines), immediately
61596 after the first block of <emphasis>Received:</emphasis> lines, or immediately before any line
61597 that is not a <emphasis>Received:</emphasis> or <emphasis>Resent-something:</emphasis> header.
61598 </para>
61599 <para>
61600 This is done by specifying <quote>:at_start:</quote>, <quote>:after_received:</quote>, or
61601 <quote>:at_start_rfc:</quote> (or, for completeness, <quote>:at_end:</quote>) before the text of the
61602 header line, respectively. (Header text cannot start with a colon, as there has
61603 to be a header name first.) For example:
61604 </para>
61605 <literallayout class="monospaced">
61606 warn add_header = \
61607        :after_received:X-My-Header: something or other...
61608 </literallayout>
61609 <para>
61610 If more than one header line is supplied in a single <option>add_header</option> modifier,
61611 each one is treated independently and can therefore be placed differently. If
61612 you add more than one line at the start, or after the Received: block, they end
61613 up in reverse order.
61614 </para>
61615 <para>
61616 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
61617 added in an ACL. It does NOT work for header lines that are added in a
61618 system filter or in a router or transport.
61619 </para>
61620 </section>
61621 <section id="SECTremoveheadacl">
61622 <title>Removing header lines in ACLs</title>
61623 <para>
61624 <indexterm role="concept">
61625 <primary>header lines</primary>
61626 <secondary>removing in an ACL</secondary>
61627 </indexterm>
61628 <indexterm role="concept">
61629 <primary>header lines</primary>
61630 <secondary>position of removed lines</secondary>
61631 </indexterm>
61632 <indexterm role="concept">
61633 <primary><option>remove_header</option> ACL modifier</primary>
61634 </indexterm>
61635 The <option>remove_header</option> modifier can be used to remove one or more header lines
61636 from an incoming message, as in this example:
61637 </para>
61638 <literallayout class="monospaced">
61639 warn   message        = Remove internal headers
61640        remove_header  = x-route-mail1 : x-route-mail2
61641 </literallayout>
61642 <para>
61643 The <option>remove_header</option> modifier is permitted in the MAIL, RCPT, PREDATA, DATA,
61644 MIME, DKIM, and non-SMTP ACLs (in other words, those that are concerned with
61645 receiving a message). The message must ultimately be accepted for
61646 <option>remove_header</option> to have any significant effect. You can use <option>remove_header</option>
61647 with any ACL verb, including <option>deny</option>, though this is really not useful for
61648 any verb that doesn&#x2019;t result in a delivered message.
61649 </para>
61650 <para>
61651 Headers will not be removed from the message if the modifier is used in
61652 DATA, MIME or DKIM ACLs for a message delivered by cutthrough routing.
61653 </para>
61654 <para>
61655 More than one header can be removed at the same time by using a colon separated
61656 list of header names. The header matching is case insensitive. Wildcards are
61657 not permitted, nor is list expansion performed, so you cannot use hostlists to
61658 create a list of headers, however both connection and message variable expansion
61659 are performed (<option>$acl_c_*</option> and <option>$acl_m_*</option>), illustrated in this example:
61660 </para>
61661 <literallayout class="monospaced">
61662 warn   hosts           = +internal_hosts
61663        set acl_c_ihdrs = x-route-mail1 : x-route-mail2
61664 warn   message         = Remove internal headers
61665        remove_header   = $acl_c_ihdrs
61666 </literallayout>
61667 <para>
61668 Header names for removal are accumulated during the MAIL, RCPT, and predata ACLs.
61669 Matching header lines are removed from the message before processing the DATA and MIME ACLs.
61670 If multiple header lines match, all are removed.
61671 There is no harm in attempting to remove the same header twice nor in removing
61672 a non-existent header. Further header lines to be removed may be accumulated
61673 during the DATA and MIME ACLs, after which they are removed from the message,
61674 if present. In the case of non-SMTP messages, headers to be removed are
61675 accumulated during the non-SMTP ACLs, and are removed from the message after
61676 all the ACLs have run. If a message is rejected after DATA or by the non-SMTP
61677 ACL, there really is no effect because there is no logging of what headers
61678 would have been removed.
61679 </para>
61680 <para>
61681 <indexterm role="concept">
61682 <primary>header lines</primary>
61683 <secondary>removed; visibility of</secondary>
61684 </indexterm>
61685 Header lines are not visible in string expansions until the DATA phase when it
61686 is received. Any header lines removed in the MAIL, RCPT, and predata ACLs are
61687 not visible in the DATA ACL and MIME ACLs. Similarly, header lines that are
61688 removed by the DATA or MIME ACLs are still visible in those ACLs. Because of
61689 this restriction, you cannot use header lines as a way of controlling data
61690 passed between (for example) the MAIL and RCPT ACLs. If you want to do this,
61691 you should instead use ACL variables, as described in section
61692 <xref linkend="SECTaclvariables"/>.
61693 </para>
61694 <para>
61695 The <option>remove_header</option> modifier acts immediately as it is encountered during the
61696 processing of an ACL. Notice the difference between these two cases:
61697 </para>
61698 <literallayout>
61699 <literal>accept remove_header = X-Internal</literal>
61700 <literal>       </literal>&lt;<emphasis>some condition</emphasis>&gt;
61701
61702 <literal>accept </literal>&lt;<emphasis>some condition</emphasis>&gt;
61703 <literal>       remove_header = X-Internal</literal>
61704 </literallayout>
61705 <para>
61706 In the first case, the header line is always removed, whether or not the
61707 condition is true. In the second case, the header line is removed only if the
61708 condition is true. Multiple occurrences of <option>remove_header</option> may occur in the
61709 same ACL statement. All those that are encountered before a condition fails
61710 are honoured.
61711 </para>
61712 <para>
61713 <emphasis role="bold">Warning</emphasis>: This facility currently applies only to header lines that are
61714 present during ACL processing. It does NOT remove header lines that are added
61715 in a system filter or in a router or transport.
61716 </para>
61717 </section>
61718 <section id="SECTaclconditions">
61719 <title>ACL conditions</title>
61720 <para>
61721 <indexterm role="concept">
61722 <primary>access control lists (ACLs)</primary>
61723 <secondary>conditions; list of</secondary>
61724 </indexterm>
61725 Some of the conditions listed in this section are available only when Exim is
61726 compiled with the content-scanning extension. They are included here briefly
61727 for completeness. More detailed descriptions can be found in the discussion on
61728 content scanning in chapter <xref linkend="CHAPexiscan"/>.
61729 </para>
61730 <para>
61731 Not all conditions are relevant in all circumstances. For example, testing
61732 senders and recipients does not make sense in an ACL that is being run as the
61733 result of the arrival of an ETRN command, and checks on message headers can be
61734 done only in the ACLs specified by <option>acl_smtp_data</option> and <option>acl_not_smtp</option>. You
61735 can use the same condition (with different parameters) more than once in the
61736 same ACL statement. This provides a way of specifying an <quote>and</quote> conjunction.
61737 The conditions are as follows:
61738 </para>
61739 <variablelist>
61740 <varlistentry>
61741 <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>
61742 <listitem>
61743 <para>
61744 <indexterm role="concept">
61745 <primary>access control lists (ACLs)</primary>
61746 <secondary>nested</secondary>
61747 </indexterm>
61748 <indexterm role="concept">
61749 <primary>access control lists (ACLs)</primary>
61750 <secondary>indirect</secondary>
61751 </indexterm>
61752 <indexterm role="concept">
61753 <primary>access control lists (ACLs)</primary>
61754 <secondary>arguments</secondary>
61755 </indexterm>
61756 <indexterm role="concept">
61757 <primary><option>acl</option> ACL condition</primary>
61758 </indexterm>
61759 The possible values of the argument are the same as for the
61760 <option>acl_smtp_</option><emphasis>xxx</emphasis> options. The named or inline ACL is run. If it returns
61761 <quote>accept</quote> the condition is true; if it returns <quote>deny</quote> the condition is
61762 false. If it returns <quote>defer</quote>, the current ACL returns <quote>defer</quote> unless the
61763 condition is on a <option>warn</option> verb. In that case, a <quote>defer</quote> return makes the
61764 condition false. This means that further processing of the <option>warn</option> verb
61765 ceases, but processing of the ACL continues.
61766 </para>
61767 <para>
61768 If the argument is a named ACL, up to nine space-separated optional values
61769 can be appended; they appear within the called ACL in $acl_arg1 to $acl_arg9,
61770 and $acl_narg is set to the count of values.
61771 Previous values of these variables are restored after the call returns.
61772 The name and values are expanded separately.
61773 Note that spaces in complex expansions which are used as arguments
61774 will act as argument separators.
61775 </para>
61776 <para>
61777 If the nested <option>acl</option> returns <quote>drop</quote> and the outer condition denies access,
61778 the connection is dropped. If it returns <quote>discard</quote>, the verb must be
61779 <option>accept</option> or <option>discard</option>, and the action is taken immediately &ndash; no further
61780 conditions are tested.
61781 </para>
61782 <para>
61783 ACLs may be nested up to 20 deep; the limit exists purely to catch runaway
61784 loops. This condition allows you to use different ACLs in different
61785 circumstances. For example, different ACLs can be used to handle RCPT commands
61786 for different local users or different local domains.
61787 </para>
61788 </listitem></varlistentry>
61789 <varlistentry>
61790 <term><emphasis role="bold">authenticated&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
61791 <listitem>
61792 <para>
61793 <indexterm role="concept">
61794 <primary><option>authenticated</option> ACL condition</primary>
61795 </indexterm>
61796 <indexterm role="concept">
61797 <primary>authentication</primary>
61798 <secondary>ACL checking</secondary>
61799 </indexterm>
61800 <indexterm role="concept">
61801 <primary>access control lists (ACLs)</primary>
61802 <secondary>testing for authentication</secondary>
61803 </indexterm>
61804 If the SMTP connection is not authenticated, the condition is false. Otherwise,
61805 the name of the authenticator is tested against the list. To test for
61806 authentication by any authenticator, you can set
61807 </para>
61808 <literallayout class="monospaced">
61809 authenticated = *
61810 </literallayout>
61811 </listitem></varlistentry>
61812 <varlistentry>
61813 <term><emphasis role="bold">condition&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string</emphasis>&gt;</term>
61814 <listitem>
61815 <para>
61816 <indexterm role="concept">
61817 <primary><option>condition</option> ACL condition</primary>
61818 </indexterm>
61819 <indexterm role="concept">
61820 <primary>customizing</primary>
61821 <secondary>ACL condition</secondary>
61822 </indexterm>
61823 <indexterm role="concept">
61824 <primary>access control lists (ACLs)</primary>
61825 <secondary>customized test</secondary>
61826 </indexterm>
61827 <indexterm role="concept">
61828 <primary>access control lists (ACLs)</primary>
61829 <secondary>testing, customized</secondary>
61830 </indexterm>
61831 This feature allows you to make up custom conditions. If the result of
61832 expanding the string is an empty string, the number zero, or one of the strings
61833 <quote>no</quote> or <quote>false</quote>, the condition is false. If the result is any non-zero
61834 number, or one of the strings <quote>yes</quote> or <quote>true</quote>, the condition is true. For
61835 any other value, some error is assumed to have occurred, and the ACL returns
61836 <quote>defer</quote>. However, if the expansion is forced to fail, the condition is
61837 ignored. The effect is to treat it as true, whether it is positive or
61838 negative.
61839 </para>
61840 </listitem></varlistentry>
61841 <varlistentry>
61842 <term><emphasis role="bold">decode&nbsp;=&nbsp;</emphasis>&lt;<emphasis>location</emphasis>&gt;</term>
61843 <listitem>
61844 <para>
61845 <indexterm role="concept">
61846 <primary><option>decode</option> ACL condition</primary>
61847 </indexterm>
61848 This condition is available only when Exim is compiled with the
61849 content-scanning extension, and it is allowed only in the ACL defined by
61850 <option>acl_smtp_mime</option>. It causes the current MIME part to be decoded into a file.
61851 If all goes well, the condition is true. It is false only if there are
61852 problems such as a syntax error or a memory shortage. For more details, see
61853 chapter <xref linkend="CHAPexiscan"/>.
61854 </para>
61855 </listitem></varlistentry>
61856 <varlistentry>
61857 <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>
61858 <listitem>
61859 <para>
61860 <indexterm role="concept">
61861 <primary><option>dnslists</option> ACL condition</primary>
61862 </indexterm>
61863 <indexterm role="concept">
61864 <primary>DNS list</primary>
61865 <secondary>in ACL</secondary>
61866 </indexterm>
61867 <indexterm role="concept">
61868 <primary>black list (DNS)</primary>
61869 </indexterm>
61870 <indexterm role="concept">
61871 <primary>access control lists (ACLs)</primary>
61872 <secondary>testing a DNS list</secondary>
61873 </indexterm>
61874 This condition checks for entries in DNS black lists. These are also known as
61875 <quote>RBL lists</quote>, after the original Realtime Blackhole List, but note that the
61876 use of the lists at <emphasis>mail-abuse.org</emphasis> now carries a charge. There are too many
61877 different variants of this condition to describe briefly here. See sections
61878 <xref linkend="SECTmorednslists"/>&ndash;<xref linkend="SECTmorednslistslast"/> for details.
61879 </para>
61880 </listitem></varlistentry>
61881 <varlistentry>
61882 <term><emphasis role="bold">domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
61883 <listitem>
61884 <para>
61885 <indexterm role="concept">
61886 <primary><option>domains</option> ACL condition</primary>
61887 </indexterm>
61888 <indexterm role="concept">
61889 <primary>domain</primary>
61890 <secondary>ACL checking</secondary>
61891 </indexterm>
61892 <indexterm role="concept">
61893 <primary>access control lists (ACLs)</primary>
61894 <secondary>testing a recipient domain</secondary>
61895 </indexterm>
61896 <indexterm role="variable">
61897 <primary><varname>$domain_data</varname></primary>
61898 </indexterm>
61899 This condition is relevant only after a RCPT command. It checks that the domain
61900 of the recipient address is in the domain list. If percent-hack processing is
61901 enabled, it is done before this test is done. If the check succeeds with a
61902 lookup, the result of the lookup is placed in <varname>$domain_data</varname> until the next
61903 <option>domains</option> test.
61904 </para>
61905 <para>
61906 <emphasis role="bold">Note carefully</emphasis> (because many people seem to fall foul of this): you cannot
61907 use <option>domains</option> in a DATA ACL.
61908 </para>
61909 </listitem></varlistentry>
61910 <varlistentry>
61911 <term><emphasis role="bold">encrypted&nbsp;=&nbsp;</emphasis>&lt;<emphasis>string&nbsp;list</emphasis>&gt;</term>
61912 <listitem>
61913 <para>
61914 <indexterm role="concept">
61915 <primary><option>encrypted</option> ACL condition</primary>
61916 </indexterm>
61917 <indexterm role="concept">
61918 <primary>encryption</primary>
61919 <secondary>checking in an ACL</secondary>
61920 </indexterm>
61921 <indexterm role="concept">
61922 <primary>access control lists (ACLs)</primary>
61923 <secondary>testing for encryption</secondary>
61924 </indexterm>
61925 If the SMTP connection is not encrypted, the condition is false. Otherwise, the
61926 name of the cipher suite in use is tested against the list. To test for
61927 encryption without testing for any specific cipher suite(s), set
61928 </para>
61929 <literallayout class="monospaced">
61930 encrypted = *
61931 </literallayout>
61932 </listitem></varlistentry>
61933 <varlistentry>
61934 <term><emphasis role="bold">hosts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>host&nbsp;list</emphasis>&gt;</term>
61935 <listitem>
61936 <para>
61937 <indexterm role="concept">
61938 <primary><option>hosts</option> ACL condition</primary>
61939 </indexterm>
61940 <indexterm role="concept">
61941 <primary>host</primary>
61942 <secondary>ACL checking</secondary>
61943 </indexterm>
61944 <indexterm role="concept">
61945 <primary>access control lists (ACLs)</primary>
61946 <secondary>testing the client host</secondary>
61947 </indexterm>
61948 This condition tests that the calling host matches the host list. If you have
61949 name lookups or wildcarded host names and IP addresses in the same host list,
61950 you should normally put the IP addresses first. For example, you could have:
61951 </para>
61952 <literallayout class="monospaced">
61953 accept hosts = 10.9.8.7 : dbm;/etc/friendly/hosts
61954 </literallayout>
61955 <para>
61956 The lookup in this example uses the host name for its key. This is implied by
61957 the lookup type <quote>dbm</quote>. (For a host address lookup you would use <quote>net-dbm</quote>
61958 and it wouldn&#x2019;t matter which way round you had these two items.)
61959 </para>
61960 <para>
61961 The reason for the problem with host names lies in the left-to-right way that
61962 Exim processes lists. It can test IP addresses without doing any DNS lookups,
61963 but when it reaches an item that requires a host name, it fails if it cannot
61964 find a host name to compare with the pattern. If the above list is given in the
61965 opposite order, the <option>accept</option> statement fails for a host whose name cannot be
61966 found, even if its IP address is 10.9.8.7.
61967 </para>
61968 <para>
61969 If you really do want to do the name check first, and still recognize the IP
61970 address even if the name lookup fails, you can rewrite the ACL like this:
61971 </para>
61972 <literallayout class="monospaced">
61973 accept hosts = dbm;/etc/friendly/hosts
61974 accept hosts = 10.9.8.7
61975 </literallayout>
61976 <para>
61977 The default action on failing to find the host name is to assume that the host
61978 is not in the list, so the first <option>accept</option> statement fails. The second
61979 statement can then check the IP address.
61980 </para>
61981 <para>
61982 <indexterm role="variable">
61983 <primary><varname>$host_data</varname></primary>
61984 </indexterm>
61985 If a <option>hosts</option> condition is satisfied by means of a lookup, the result
61986 of the lookup is made available in the <varname>$host_data</varname> variable. This
61987 allows you, for example, to set up a statement like this:
61988 </para>
61989 <literallayout class="monospaced">
61990 deny  hosts = net-lsearch;/some/file
61991       message = $host_data
61992 </literallayout>
61993 <para>
61994 which gives a custom error message for each denied host.
61995 </para>
61996 </listitem></varlistentry>
61997 <varlistentry>
61998 <term><emphasis role="bold">local_parts&nbsp;=&nbsp;</emphasis>&lt;<emphasis>local&nbsp;part&nbsp;list</emphasis>&gt;</term>
61999 <listitem>
62000 <para>
62001 <indexterm role="concept">
62002 <primary><option>local_parts</option> ACL condition</primary>
62003 </indexterm>
62004 <indexterm role="concept">
62005 <primary>local part</primary>
62006 <secondary>ACL checking</secondary>
62007 </indexterm>
62008 <indexterm role="concept">
62009 <primary>access control lists (ACLs)</primary>
62010 <secondary>testing a local part</secondary>
62011 </indexterm>
62012 <indexterm role="variable">
62013 <primary><varname>$local_part_data</varname></primary>
62014 </indexterm>
62015 This condition is relevant only after a RCPT command. It checks that the local
62016 part of the recipient address is in the list. If percent-hack processing is
62017 enabled, it is done before this test. If the check succeeds with a lookup, the
62018 result of the lookup is placed in <varname>$local_part_data</varname>, which remains set until
62019 the next <option>local_parts</option> test.
62020 </para>
62021 </listitem></varlistentry>
62022 <varlistentry>
62023 <term><emphasis role="bold">malware&nbsp;=&nbsp;</emphasis>&lt;<emphasis>option</emphasis>&gt;</term>
62024 <listitem>
62025 <para>
62026 <indexterm role="concept">
62027 <primary><option>malware</option> ACL condition</primary>
62028 </indexterm>
62029 <indexterm role="concept">
62030 <primary>access control lists (ACLs)</primary>
62031 <secondary>virus scanning</secondary>
62032 </indexterm>
62033 <indexterm role="concept">
62034 <primary>access control lists (ACLs)</primary>
62035 <secondary>scanning for viruses</secondary>
62036 </indexterm>
62037 This condition is available only when Exim is compiled with the
62038 content-scanning extension
62039 and only after a DATA command.
62040 It causes the incoming message to be scanned for
62041 viruses. For details, see chapter <xref linkend="CHAPexiscan"/>.
62042 </para>
62043 </listitem></varlistentry>
62044 <varlistentry>
62045 <term><emphasis role="bold">mime_regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
62046 <listitem>
62047 <para>
62048 <indexterm role="concept">
62049 <primary><option>mime_regex</option> ACL condition</primary>
62050 </indexterm>
62051 <indexterm role="concept">
62052 <primary>access control lists (ACLs)</primary>
62053 <secondary>testing by regex matching</secondary>
62054 </indexterm>
62055 This condition is available only when Exim is compiled with the
62056 content-scanning extension, and it is allowed only in the ACL defined by
62057 <option>acl_smtp_mime</option>. It causes the current MIME part to be scanned for a match
62058 with any of the regular expressions. For details, see chapter
62059 <xref linkend="CHAPexiscan"/>.
62060 </para>
62061 </listitem></varlistentry>
62062 <varlistentry>
62063 <term><emphasis role="bold">ratelimit&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
62064 <listitem>
62065 <para>
62066 <indexterm role="concept">
62067 <primary>rate limiting</primary>
62068 </indexterm>
62069 This condition can be used to limit the rate at which a user or host submits
62070 messages. Details are given in section <xref linkend="SECTratelimiting"/>.
62071 </para>
62072 </listitem></varlistentry>
62073 <varlistentry>
62074 <term><emphasis role="bold">recipients&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
62075 <listitem>
62076 <para>
62077 <indexterm role="concept">
62078 <primary><option>recipients</option> ACL condition</primary>
62079 </indexterm>
62080 <indexterm role="concept">
62081 <primary>recipient</primary>
62082 <secondary>ACL checking</secondary>
62083 </indexterm>
62084 <indexterm role="concept">
62085 <primary>access control lists (ACLs)</primary>
62086 <secondary>testing a recipient</secondary>
62087 </indexterm>
62088 This condition is relevant only after a RCPT command. It checks the entire
62089 recipient address against a list of recipients.
62090 </para>
62091 </listitem></varlistentry>
62092 <varlistentry>
62093 <term><emphasis role="bold">regex&nbsp;=&nbsp;</emphasis>&lt;<emphasis>list&nbsp;of&nbsp;regular&nbsp;expressions</emphasis>&gt;</term>
62094 <listitem>
62095 <para>
62096 <indexterm role="concept">
62097 <primary><option>regex</option> ACL condition</primary>
62098 </indexterm>
62099 <indexterm role="concept">
62100 <primary>access control lists (ACLs)</primary>
62101 <secondary>testing by regex matching</secondary>
62102 </indexterm>
62103 This condition is available only when Exim is compiled with the
62104 content-scanning extension, and is available only in the DATA, MIME, and
62105 non-SMTP ACLs. It causes the incoming message to be scanned for a match with
62106 any of the regular expressions. For details, see chapter <xref linkend="CHAPexiscan"/>.
62107 </para>
62108 </listitem></varlistentry>
62109 <varlistentry revisionflag="changed">
62110 <term><emphasis role="bold">seen&nbsp;=&nbsp;</emphasis>&lt;<emphasis>parameters</emphasis>&gt;</term>
62111 <listitem>
62112 <para revisionflag="changed">
62113 <indexterm role="concept">
62114 <primary><option>sseen</option> ACL condition</primary>
62115 </indexterm>
62116 This condition can be used to test if a situation has been previously met,
62117 for example for greylisting.
62118 Details are given in section <xref linkend="SECTseen"/>.
62119 </para>
62120 </listitem></varlistentry>
62121 <varlistentry>
62122 <term><emphasis role="bold">sender_domains&nbsp;=&nbsp;</emphasis>&lt;<emphasis>domain&nbsp;list</emphasis>&gt;</term>
62123 <listitem>
62124 <para>
62125 <indexterm role="concept">
62126 <primary><option>sender_domains</option> ACL condition</primary>
62127 </indexterm>
62128 <indexterm role="concept">
62129 <primary>sender</primary>
62130 <secondary>ACL checking</secondary>
62131 </indexterm>
62132 <indexterm role="concept">
62133 <primary>access control lists (ACLs)</primary>
62134 <secondary>testing a sender domain</secondary>
62135 </indexterm>
62136 <indexterm role="variable">
62137 <primary><varname>$domain</varname></primary>
62138 </indexterm>
62139 <indexterm role="variable">
62140 <primary><varname>$sender_address_domain</varname></primary>
62141 </indexterm>
62142 This condition tests the domain of the sender of the message against the given
62143 domain list. <emphasis role="bold">Note</emphasis>: The domain of the sender address is in
62144 <varname>$sender_address_domain</varname>. It is <emphasis>not</emphasis> put in <varname>$domain</varname> during the testing
62145 of this condition. This is an exception to the general rule for testing domain
62146 lists. It is done this way so that, if this condition is used in an ACL for a
62147 RCPT command, the recipient&#x2019;s domain (which is in <varname>$domain</varname>) can be used to
62148 influence the sender checking.
62149 </para>
62150 <para>
62151 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
62152 relaying, because sender addresses are easily, and commonly, forged.
62153 </para>
62154 </listitem></varlistentry>
62155 <varlistentry>
62156 <term><emphasis role="bold">senders&nbsp;=&nbsp;</emphasis>&lt;<emphasis>address&nbsp;list</emphasis>&gt;</term>
62157 <listitem>
62158 <para>
62159 <indexterm role="concept">
62160 <primary><option>senders</option> ACL condition</primary>
62161 </indexterm>
62162 <indexterm role="concept">
62163 <primary>sender</primary>
62164 <secondary>ACL checking</secondary>
62165 </indexterm>
62166 <indexterm role="concept">
62167 <primary>access control lists (ACLs)</primary>
62168 <secondary>testing a sender</secondary>
62169 </indexterm>
62170 This condition tests the sender of the message against the given list. To test
62171 for a bounce message, which has an empty sender, set
62172 </para>
62173 <literallayout class="monospaced">
62174 senders = :
62175 </literallayout>
62176 <para>
62177 <emphasis role="bold">Warning</emphasis>: It is a bad idea to use this condition on its own as a control on
62178 relaying, because sender addresses are easily, and commonly, forged.
62179 </para>
62180 </listitem></varlistentry>
62181 <varlistentry>
62182 <term><emphasis role="bold">spam&nbsp;=&nbsp;</emphasis>&lt;<emphasis>username</emphasis>&gt;</term>
62183 <listitem>
62184 <para>
62185 <indexterm role="concept">
62186 <primary><option>spam</option> ACL condition</primary>
62187 </indexterm>
62188 <indexterm role="concept">
62189 <primary>access control lists (ACLs)</primary>
62190 <secondary>scanning for spam</secondary>
62191 </indexterm>
62192 This condition is available only when Exim is compiled with the
62193 content-scanning extension. It causes the incoming message to be scanned by
62194 SpamAssassin. For details, see chapter <xref linkend="CHAPexiscan"/>.
62195 </para>
62196 </listitem></varlistentry>
62197 <varlistentry>
62198 <term><emphasis role="bold">verify&nbsp;=&nbsp;certificate</emphasis></term>
62199 <listitem>
62200 <para>
62201 <indexterm role="concept">
62202 <primary><option>verify</option> ACL condition</primary>
62203 </indexterm>
62204 <indexterm role="concept">
62205 <primary>TLS</primary>
62206 <secondary>client certificate verification</secondary>
62207 </indexterm>
62208 <indexterm role="concept">
62209 <primary>certificate</primary>
62210 <secondary>verification of client</secondary>
62211 </indexterm>
62212 <indexterm role="concept">
62213 <primary>access control lists (ACLs)</primary>
62214 <secondary>certificate verification</secondary>
62215 </indexterm>
62216 <indexterm role="concept">
62217 <primary>access control lists (ACLs)</primary>
62218 <secondary>testing a TLS certificate</secondary>
62219 </indexterm>
62220 This condition is true in an SMTP session if the session is encrypted, and a
62221 certificate was received from the client, and the certificate was verified. The
62222 server requests a certificate only if the client matches <option>tls_verify_hosts</option>
62223 or <option>tls_try_verify_hosts</option> (see chapter <xref linkend="CHAPTLS"/>).
62224 </para>
62225 </listitem></varlistentry>
62226 <varlistentry>
62227 <term><emphasis role="bold">verify&nbsp;=&nbsp;csa</emphasis></term>
62228 <listitem>
62229 <para>
62230 <indexterm role="concept">
62231 <primary>CSA verification</primary>
62232 </indexterm>
62233 This condition checks whether the sending host (the client) is authorized to
62234 send email. Details of how this works are given in section
62235 <xref linkend="SECTverifyCSA"/>.
62236 </para>
62237 </listitem></varlistentry>
62238 <varlistentry>
62239 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_names_ascii</emphasis></term>
62240 <listitem>
62241 <para>
62242 <indexterm role="concept">
62243 <primary><option>verify</option> ACL condition</primary>
62244 </indexterm>
62245 <indexterm role="concept">
62246 <primary>access control lists (ACLs)</primary>
62247 <secondary>verifying header names only ASCII</secondary>
62248 </indexterm>
62249 <indexterm role="concept">
62250 <primary>header lines</primary>
62251 <secondary>verifying header names only ASCII</secondary>
62252 </indexterm>
62253 <indexterm role="concept">
62254 <primary>verifying</primary>
62255 <secondary>header names only ASCII</secondary>
62256 </indexterm>
62257 This condition is relevant only in an ACL that is run after a message has been
62258 received.
62259 This usually means an ACL specified by <option>acl_smtp_data</option> or <option>acl_not_smtp</option>.
62260 It checks all header names (not the content) to make sure
62261 there are no non-ASCII characters, also excluding control characters.  The
62262 allowable characters are decimal ASCII values 33 through 126.
62263 </para>
62264 <para>
62265 Exim itself will handle headers with non-ASCII characters, but it can cause
62266 problems for downstream applications, so this option will allow their
62267 detection and rejection in the DATA ACL&#x2019;s.
62268 </para>
62269 </listitem></varlistentry>
62270 <varlistentry>
62271 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62272 <listitem>
62273 <para>
62274 <indexterm role="concept">
62275 <primary><option>verify</option> ACL condition</primary>
62276 </indexterm>
62277 <indexterm role="concept">
62278 <primary>access control lists (ACLs)</primary>
62279 <secondary>verifying sender in the header</secondary>
62280 </indexterm>
62281 <indexterm role="concept">
62282 <primary>header lines</primary>
62283 <secondary>verifying the sender in</secondary>
62284 </indexterm>
62285 <indexterm role="concept">
62286 <primary>sender</primary>
62287 <secondary>verifying in header</secondary>
62288 </indexterm>
62289 <indexterm role="concept">
62290 <primary>verifying</primary>
62291 <secondary>sender in header</secondary>
62292 </indexterm>
62293 This condition is relevant only in an ACL that is run after a message has been
62294 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
62295 <option>acl_not_smtp</option>. It checks that there is a verifiable address in at least one
62296 of the <emphasis>Sender:</emphasis>, <emphasis>Reply-To:</emphasis>, or <emphasis>From:</emphasis> header lines. Such an address
62297 is loosely thought of as a <quote>sender</quote> address (hence the name of the test).
62298 However, an address that appears in one of these headers need not be an address
62299 that accepts bounce messages; only sender addresses in envelopes are required
62300 to accept bounces. Therefore, if you use the callout option on this check, you
62301 might want to arrange for a non-empty address in the MAIL command.
62302 </para>
62303 <para>
62304 Details of address verification and the options are given later, starting at
62305 section <xref linkend="SECTaddressverification"/> (callouts are described in section
62306 <xref linkend="SECTcallver"/>). You can combine this condition with the <option>senders</option>
62307 condition to restrict it to bounce messages only:
62308 </para>
62309 <literallayout class="monospaced">
62310 deny    senders = :
62311        !verify  = header_sender
62312         message = A valid sender header is required for bounces
62313 </literallayout>
62314 </listitem></varlistentry>
62315 <varlistentry>
62316 <term><emphasis role="bold">verify&nbsp;=&nbsp;header_syntax</emphasis></term>
62317 <listitem>
62318 <para>
62319 <indexterm role="concept">
62320 <primary><option>verify</option> ACL condition</primary>
62321 </indexterm>
62322 <indexterm role="concept">
62323 <primary>access control lists (ACLs)</primary>
62324 <secondary>verifying header syntax</secondary>
62325 </indexterm>
62326 <indexterm role="concept">
62327 <primary>header lines</primary>
62328 <secondary>verifying syntax</secondary>
62329 </indexterm>
62330 <indexterm role="concept">
62331 <primary>verifying</primary>
62332 <secondary>header syntax</secondary>
62333 </indexterm>
62334 This condition is relevant only in an ACL that is run after a message has been
62335 received, that is, in an ACL specified by <option>acl_smtp_data</option> or
62336 <option>acl_not_smtp</option>. It checks the syntax of all header lines that can contain
62337 lists of addresses (<emphasis>Sender:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>,
62338 and <emphasis>Bcc:</emphasis>), returning true if there are no problems.
62339 Unqualified addresses (local parts without domains) are
62340 permitted only in locally generated messages and from hosts that match
62341 <option>sender_unqualified_hosts</option> or <option>recipient_unqualified_hosts</option>, as
62342 appropriate.
62343 </para>
62344 <para>
62345 Note that this condition is a syntax check only. However, a common spamming
62346 ploy used to be to send syntactically invalid headers such as
62347 </para>
62348 <literallayout class="monospaced">
62349 To: @
62350 </literallayout>
62351 <para>
62352 and this condition can be used to reject such messages, though they are not as
62353 common as they used to be.
62354 </para>
62355 </listitem></varlistentry>
62356 <varlistentry>
62357 <term><emphasis role="bold">verify&nbsp;=&nbsp;helo</emphasis></term>
62358 <listitem>
62359 <para>
62360 <indexterm role="concept">
62361 <primary><option>verify</option> ACL condition</primary>
62362 </indexterm>
62363 <indexterm role="concept">
62364 <primary>access control lists (ACLs)</primary>
62365 <secondary>verifying HELO/EHLO</secondary>
62366 </indexterm>
62367 <indexterm role="concept">
62368 <primary>HELO</primary>
62369 <secondary>verifying</secondary>
62370 </indexterm>
62371 <indexterm role="concept">
62372 <primary>EHLO</primary>
62373 <secondary>verifying</secondary>
62374 </indexterm>
62375 <indexterm role="concept">
62376 <primary>verifying</primary>
62377 <secondary>EHLO</secondary>
62378 </indexterm>
62379 <indexterm role="concept">
62380 <primary>verifying</primary>
62381 <secondary>HELO</secondary>
62382 </indexterm>
62383 This condition is true if a HELO or EHLO command has been received from the
62384 client host, and its contents have been verified. If there has been no previous
62385 attempt to verify the HELO/EHLO contents, it is carried out when this
62386 condition is encountered. See the description of the <option>helo_verify_hosts</option> and
62387 <option>helo_try_verify_hosts</option> options for details of how to request verification
62388 independently of this condition, and for detail of the verification.
62389 </para>
62390 <para>
62391 For SMTP input that does not come over TCP/IP (the <option>-bs</option> command line
62392 option), this condition is always true.
62393 </para>
62394 </listitem></varlistentry>
62395 <varlistentry>
62396 <term><emphasis role="bold">verify&nbsp;=&nbsp;not_blind/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62397 <listitem>
62398 <para>
62399 <indexterm role="concept">
62400 <primary>verifying</primary>
62401 <secondary>not blind</secondary>
62402 </indexterm>
62403 <indexterm role="concept">
62404 <primary>bcc recipients, verifying none</primary>
62405 </indexterm>
62406 This condition checks that there are no blind (bcc) recipients in the message.
62407 Every envelope recipient must appear either in a <emphasis>To:</emphasis> header line or in a
62408 <emphasis>Cc:</emphasis> header line for this condition to be true. Local parts are checked
62409 case-sensitively; domains are checked case-insensitively. If <emphasis>Resent-To:</emphasis> or
62410 <emphasis>Resent-Cc:</emphasis> header lines exist, they are also checked. This condition can be
62411 used only in a DATA or non-SMTP ACL.
62412 </para>
62413 <para>
62414 There is one possible option, <literal>case_insensitive</literal>.  If this is present then
62415 local parts are checked case-insensitively.
62416 </para>
62417 <para>
62418 There are, of course, many legitimate messages that make use of blind (bcc)
62419 recipients. This check should not be used on its own for blocking messages.
62420 </para>
62421 </listitem></varlistentry>
62422 <varlistentry>
62423 <term><emphasis role="bold">verify&nbsp;=&nbsp;recipient/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62424 <listitem>
62425 <para>
62426 <indexterm role="concept">
62427 <primary><option>verify</option> ACL condition</primary>
62428 </indexterm>
62429 <indexterm role="concept">
62430 <primary>access control lists (ACLs)</primary>
62431 <secondary>verifying recipient</secondary>
62432 </indexterm>
62433 <indexterm role="concept">
62434 <primary>recipient</primary>
62435 <secondary>verifying</secondary>
62436 </indexterm>
62437 <indexterm role="concept">
62438 <primary>verifying</primary>
62439 <secondary>recipient</secondary>
62440 </indexterm>
62441 <indexterm role="variable">
62442 <primary><varname>$address_data</varname></primary>
62443 </indexterm>
62444 This condition is relevant only after a RCPT command. It verifies the current
62445 recipient. Details of address verification are given later, starting at section
62446 <xref linkend="SECTaddressverification"/>. After a recipient has been verified, the value
62447 of <varname>$address_data</varname> is the last value that was set while routing the address.
62448 This applies even if the verification fails. When an address that is being
62449 verified is redirected to a single address, verification continues with the new
62450 address, and in that case, the subsequent value of <varname>$address_data</varname> is the
62451 value for the child address.
62452 </para>
62453 </listitem></varlistentry>
62454 <varlistentry>
62455 <term><emphasis role="bold">verify&nbsp;=&nbsp;reverse_host_lookup/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62456 <listitem>
62457 <para>
62458 <indexterm role="concept">
62459 <primary><option>verify</option> ACL condition</primary>
62460 </indexterm>
62461 <indexterm role="concept">
62462 <primary>access control lists (ACLs)</primary>
62463 <secondary>verifying host reverse lookup</secondary>
62464 </indexterm>
62465 <indexterm role="concept">
62466 <primary>host</primary>
62467 <secondary>verifying reverse lookup</secondary>
62468 </indexterm>
62469 This condition ensures that a verified host name has been looked up from the IP
62470 address of the client host. (This may have happened already if the host name
62471 was needed for checking a host list, or if the host matched <option>host_lookup</option>.)
62472 Verification ensures that the host name obtained from a reverse DNS lookup, or
62473 one of its aliases, does, when it is itself looked up in the DNS, yield the
62474 original IP address.
62475 </para>
62476 <para>
62477 There is one possible option, <literal>defer_ok</literal>.  If this is present and a
62478 DNS operation returns a temporary error, the verify condition succeeds.
62479 </para>
62480 <para>
62481 If this condition is used for a locally generated message (that is, when there
62482 is no client host involved), it always succeeds.
62483 </para>
62484 </listitem></varlistentry>
62485 <varlistentry>
62486 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62487 <listitem>
62488 <para>
62489 <indexterm role="concept">
62490 <primary><option>verify</option> ACL condition</primary>
62491 </indexterm>
62492 <indexterm role="concept">
62493 <primary>access control lists (ACLs)</primary>
62494 <secondary>verifying sender</secondary>
62495 </indexterm>
62496 <indexterm role="concept">
62497 <primary>sender</primary>
62498 <secondary>verifying</secondary>
62499 </indexterm>
62500 <indexterm role="concept">
62501 <primary>verifying</primary>
62502 <secondary>sender</secondary>
62503 </indexterm>
62504 This condition is relevant only after a MAIL or RCPT command, or after a
62505 message has been received (the <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs). If
62506 the message&#x2019;s sender is empty (that is, this is a bounce message), the
62507 condition is true. Otherwise, the sender address is verified.
62508 </para>
62509 <para>
62510 <indexterm role="variable">
62511 <primary><varname>$address_data</varname></primary>
62512 </indexterm>
62513 <indexterm role="variable">
62514 <primary><varname>$sender_address_data</varname></primary>
62515 </indexterm>
62516 If there is data in the <varname>$address_data</varname> variable at the end of routing, its
62517 value is placed in <varname>$sender_address_data</varname> at the end of verification. This
62518 value can be used in subsequent conditions and modifiers in the same ACL
62519 statement. It does not persist after the end of the current statement. If you
62520 want to preserve the value for longer, you can save it in an ACL variable.
62521 </para>
62522 <para>
62523 Details of verification are given later, starting at section
62524 <xref linkend="SECTaddressverification"/>. Exim caches the result of sender verification,
62525 to avoid doing it more than once per message.
62526 </para>
62527 </listitem></varlistentry>
62528 <varlistentry>
62529 <term><emphasis role="bold">verify&nbsp;=&nbsp;sender=</emphasis>&lt;<emphasis>address</emphasis>&gt;<emphasis role="bold">/</emphasis>&lt;<emphasis>options</emphasis>&gt;</term>
62530 <listitem>
62531 <para>
62532 <indexterm role="concept">
62533 <primary><option>verify</option> ACL condition</primary>
62534 </indexterm>
62535 This is a variation of the previous option, in which a modified address is
62536 verified as a sender.
62537 </para>
62538 <para>
62539 Note that &#x2019;/&#x2019; is legal in local-parts; if the address may have such
62540 (eg. is generated from the received message)
62541 they must be protected from the options parsing by doubling:
62542 </para>
62543 <literallayout class="monospaced">
62544 verify = sender=${listquote{/}{${address:$h_sender:}}}
62545 </literallayout>
62546 </listitem></varlistentry>
62547 </variablelist>
62548 </section>
62549 <section id="SECTmorednslists">
62550 <title>Using DNS lists</title>
62551 <para>
62552 <indexterm role="concept">
62553 <primary>DNS list</primary>
62554 <secondary>in ACL</secondary>
62555 </indexterm>
62556 <indexterm role="concept">
62557 <primary>black list (DNS)</primary>
62558 </indexterm>
62559 <indexterm role="concept">
62560 <primary>access control lists (ACLs)</primary>
62561 <secondary>testing a DNS list</secondary>
62562 </indexterm>
62563 In its simplest form, the <option>dnslists</option> condition tests whether the calling host
62564 is on at least one of a number of DNS lists by looking up the inverted IP
62565 address in one or more DNS domains. (Note that DNS list domains are not mail
62566 domains, so the <literal>+</literal> syntax for named lists doesn&#x2019;t work - it is used for
62567 special options instead.) For example, if the calling host&#x2019;s IP
62568 address is 192.168.62.43, and the ACL statement is
62569 </para>
62570 <literallayout class="monospaced">
62571 deny dnslists = blackholes.mail-abuse.org : \
62572                 dialups.mail-abuse.org
62573 </literallayout>
62574 <para>
62575 the following records are looked up:
62576 </para>
62577 <literallayout class="monospaced">
62578 43.62.168.192.blackholes.mail-abuse.org
62579 43.62.168.192.dialups.mail-abuse.org
62580 </literallayout>
62581 <para>
62582 As soon as Exim finds an existing DNS record, processing of the list stops.
62583 Thus, multiple entries on the list provide an <quote>or</quote> conjunction. If you want
62584 to test that a host is on more than one list (an <quote>and</quote> conjunction), you can
62585 use two separate conditions:
62586 </para>
62587 <literallayout class="monospaced">
62588 deny dnslists = blackholes.mail-abuse.org
62589      dnslists = dialups.mail-abuse.org
62590 </literallayout>
62591 <para>
62592 If a DNS lookup times out or otherwise fails to give a decisive answer, Exim
62593 behaves as if the host does not match the list item, that is, as if the DNS
62594 record does not exist. If there are further items in the DNS list, they are
62595 processed.
62596 </para>
62597 <para>
62598 This is usually the required action when <option>dnslists</option> is used with <option>deny</option>
62599 (which is the most common usage), because it prevents a DNS failure from
62600 blocking mail. However, you can change this behaviour by putting one of the
62601 following special items in the list:
62602 </para>
62603 <informaltable frame="none">
62604 <tgroup cols="2" colsep="0" rowsep="0">
62605 <colspec colwidth="1pt" align="left"/>
62606 <colspec colwidth="1pt" align="left"/>
62607 <tbody>
62608 <row>
62609 <entry>&nbsp;&nbsp;&nbsp;&nbsp;+include_unknown</entry>
62610 <entry>behave as if the item is on the list</entry>
62611 </row>
62612 <row>
62613 <entry>&nbsp;&nbsp;&nbsp;&nbsp;+exclude_unknown</entry>
62614 <entry>behave as if the item is not on the list (default)</entry>
62615 </row>
62616 <row>
62617 <entry>&nbsp;&nbsp;&nbsp;&nbsp;+defer_unknown  </entry>
62618 <entry>give a temporary error</entry>
62619 </row>
62620 </tbody>
62621 </tgroup>
62622 </informaltable>
62623 <para>
62624 <indexterm role="concept">
62625 <primary><literal>+include_unknown</literal></primary>
62626 </indexterm>
62627 <indexterm role="concept">
62628 <primary><literal>+exclude_unknown</literal></primary>
62629 </indexterm>
62630 <indexterm role="concept">
62631 <primary><literal>+defer_unknown</literal></primary>
62632 </indexterm>
62633 Each of these applies to any subsequent items on the list. For example:
62634 </para>
62635 <literallayout class="monospaced">
62636 deny dnslists = +defer_unknown : foo.bar.example
62637 </literallayout>
62638 <para>
62639 Testing the list of domains stops as soon as a match is found. If you want to
62640 warn for one list and block for another, you can use two different statements:
62641 </para>
62642 <literallayout class="monospaced">
62643 deny  dnslists = blackholes.mail-abuse.org
62644 warn  dnslists = dialups.mail-abuse.org
62645       message  = X-Warn: sending host is on dialups list
62646 </literallayout>
62647 <para>
62648 <indexterm role="concept">
62649 <primary>caching</primary>
62650 <secondary>of dns lookup</secondary>
62651 </indexterm>
62652 <indexterm role="concept">
62653 <primary>DNS</primary>
62654 <secondary>TTL</secondary>
62655 </indexterm>
62656 DNS list lookups are cached by Exim for the duration of the SMTP session
62657 (but limited by the DNS return TTL value),
62658 so a lookup based on the IP address is done at most once for any incoming
62659 connection (assuming long-enough TTL).
62660 Exim does not share information between multiple incoming
62661 connections (but your local name server cache should be active).
62662 </para>
62663 <para>
62664 There are a number of DNS lists to choose from, some commercial, some free,
62665 or free for small deployments.  An overview can be found at
62666 <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>.
62667 </para>
62668 </section>
62669 <section id="SECID201">
62670 <title>Specifying the IP address for a DNS list lookup</title>
62671 <para>
62672 <indexterm role="concept">
62673 <primary>DNS list</primary>
62674 <secondary>keyed by explicit IP address</secondary>
62675 </indexterm>
62676 By default, the IP address that is used in a DNS list lookup is the IP address
62677 of the calling host. However, you can specify another IP address by listing it
62678 after the domain name, introduced by a slash. For example:
62679 </para>
62680 <literallayout class="monospaced">
62681 deny dnslists = black.list.tld/192.168.1.2
62682 </literallayout>
62683 <para>
62684 This feature is not very helpful with explicit IP addresses; it is intended for
62685 use with IP addresses that are looked up, for example, the IP addresses of the
62686 MX hosts or nameservers of an email sender address. For an example, see section
62687 <xref linkend="SECTmulkeyfor"/> below.
62688 </para>
62689 </section>
62690 <section id="SECID202">
62691 <title>DNS lists keyed on domain names</title>
62692 <para>
62693 <indexterm role="concept">
62694 <primary>DNS list</primary>
62695 <secondary>keyed by domain name</secondary>
62696 </indexterm>
62697 There are some lists that are keyed on domain names rather than inverted IP
62698 addresses (see, e.g., the <emphasis>domain based zones</emphasis> link at
62699 <emphasis role="bold"><ulink url="http://www.rfc-ignorant.org/">http://www.rfc-ignorant.org/</ulink></emphasis>). No reversing of components is used
62700 with these lists. You can change the name that is looked up in a DNS list by
62701 listing it after the domain name, introduced by a slash. For example,
62702 </para>
62703 <literallayout class="monospaced">
62704 deny  dnslists = dsn.rfc-ignorant.org/$sender_address_domain
62705       message  = Sender's domain is listed at $dnslist_domain
62706 </literallayout>
62707 <para>
62708 This particular example is useful only in ACLs that are obeyed after the
62709 RCPT or DATA commands, when a sender address is available. If (for
62710 example) the message&#x2019;s sender is <emphasis>user@tld.example</emphasis> the name that is looked
62711 up by this example is
62712 </para>
62713 <literallayout class="monospaced">
62714 tld.example.dsn.rfc-ignorant.org
62715 </literallayout>
62716 <para>
62717 A single <option>dnslists</option> condition can contain entries for both names and IP
62718 addresses. For example:
62719 </para>
62720 <literallayout class="monospaced">
62721 deny dnslists = sbl.spamhaus.org : \
62722                 dsn.rfc-ignorant.org/$sender_address_domain
62723 </literallayout>
62724 <para>
62725 The first item checks the sending host&#x2019;s IP address; the second checks a domain
62726 name. The whole condition is true if either of the DNS lookups succeeds.
62727 </para>
62728 </section>
62729 <section id="SECTmulkeyfor">
62730 <title>Multiple explicit keys for a DNS list</title>
62731 <para>
62732 <indexterm role="concept">
62733 <primary>DNS list</primary>
62734 <secondary>multiple keys for</secondary>
62735 </indexterm>
62736 The syntax described above for looking up explicitly-defined values (either
62737 names or IP addresses) in a DNS blacklist is a simplification. After the domain
62738 name for the DNS list, what follows the slash can in fact be a list of items.
62739 As with all lists in Exim, the default separator is a colon. However, because
62740 this is a sublist within the list of DNS blacklist domains, it is necessary
62741 either to double the separators like this:
62742 </para>
62743 <literallayout class="monospaced">
62744 dnslists = black.list.tld/name.1::name.2
62745 </literallayout>
62746 <para>
62747 or to change the separator character, like this:
62748 </para>
62749 <literallayout class="monospaced">
62750 dnslists = black.list.tld/&lt;;name.1;name.2
62751 </literallayout>
62752 <para>
62753 If an item in the list is an IP address, it is inverted before the DNS
62754 blacklist domain is appended. If it is not an IP address, no inversion
62755 occurs. Consider this condition:
62756 </para>
62757 <literallayout class="monospaced">
62758 dnslists = black.list.tld/&lt;;192.168.1.2;a.domain
62759 </literallayout>
62760 <para>
62761 The DNS lookups that occur are:
62762 </para>
62763 <literallayout class="monospaced">
62764 2.1.168.192.black.list.tld
62765 a.domain.black.list.tld
62766 </literallayout>
62767 <para>
62768 Once a DNS record has been found (that matches a specific IP return
62769 address, if specified &ndash; see section <xref linkend="SECTaddmatcon"/>), no further lookups
62770 are done. If there is a temporary DNS error, the rest of the sublist of domains
62771 or IP addresses is tried. A temporary error for the whole dnslists item occurs
62772 only if no other DNS lookup in this sublist succeeds. In other words, a
62773 successful lookup for any of the items in the sublist overrides a temporary
62774 error for a previous item.
62775 </para>
62776 <para>
62777 The ability to supply a list of items after the slash is in some sense just a
62778 syntactic convenience. These two examples have the same effect:
62779 </para>
62780 <literallayout class="monospaced">
62781 dnslists = black.list.tld/a.domain : black.list.tld/b.domain
62782 dnslists = black.list.tld/a.domain::b.domain
62783 </literallayout>
62784 <para>
62785 However, when the data for the list is obtained from a lookup, the second form
62786 is usually much more convenient. Consider this example:
62787 </para>
62788 <literallayout class="monospaced">
62789 deny dnslists = sbl.spamhaus.org/&lt;|${lookup dnsdb {&gt;|a=&lt;|\
62790                                    ${lookup dnsdb {&gt;|mxh=\
62791                                    $sender_address_domain} }} }
62792      message  = The mail servers for the domain \
62793                 $sender_address_domain \
62794                 are listed at $dnslist_domain ($dnslist_value); \
62795                 see $dnslist_text.
62796 </literallayout>
62797 <para>
62798 Note the use of <literal>&gt;|</literal> in the dnsdb lookup to specify the separator for
62799 multiple DNS records. The inner dnsdb lookup produces a list of MX hosts
62800 and the outer dnsdb lookup finds the IP addresses for these hosts. The result
62801 of expanding the condition might be something like this:
62802 </para>
62803 <literallayout class="monospaced">
62804 dnslists = sbl.spamhaus.org/&lt;|192.168.2.3|192.168.5.6|...
62805 </literallayout>
62806 <para>
62807 Thus, this example checks whether or not the IP addresses of the sender
62808 domain&#x2019;s mail servers are on the Spamhaus black list.
62809 </para>
62810 <para>
62811 The key that was used for a successful DNS list lookup is put into the variable
62812 <varname>$dnslist_matched</varname> (see section <xref linkend="SECID204"/>).
62813 </para>
62814 </section>
62815 <section id="SECID203">
62816 <title>Data returned by DNS lists</title>
62817 <para>
62818 <indexterm role="concept">
62819 <primary>DNS list</primary>
62820 <secondary>data returned from</secondary>
62821 </indexterm>
62822 DNS lists are constructed using address records in the DNS. The original RBL
62823 just used the address 127.0.0.1 on the right hand side of each record, but the
62824 RBL+ list and some other lists use a number of values with different meanings.
62825 The values used on the RBL+ list are:
62826 </para>
62827 <informaltable frame="none">
62828 <tgroup cols="2" colsep="0" rowsep="0">
62829 <colspec colwidth="1pt" align="left"/>
62830 <colspec colwidth="1pt" align="left"/>
62831 <tbody>
62832 <row>
62833 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.1</entry>
62834 <entry>RBL</entry>
62835 </row>
62836 <row>
62837 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.2</entry>
62838 <entry>DUL</entry>
62839 </row>
62840 <row>
62841 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.3</entry>
62842 <entry>DUL and RBL</entry>
62843 </row>
62844 <row>
62845 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.4</entry>
62846 <entry>RSS</entry>
62847 </row>
62848 <row>
62849 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.5</entry>
62850 <entry>RSS and RBL</entry>
62851 </row>
62852 <row>
62853 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.6</entry>
62854 <entry>RSS and DUL</entry>
62855 </row>
62856 <row>
62857 <entry>&nbsp;&nbsp;&nbsp;&nbsp;127.1.0.7</entry>
62858 <entry>RSS and DUL and RBL</entry>
62859 </row>
62860 </tbody>
62861 </tgroup>
62862 </informaltable>
62863 <para>
62864 Section <xref linkend="SECTaddmatcon"/> below describes how you can distinguish between
62865 different values. Some DNS lists may return more than one address record;
62866 see section <xref linkend="SECThanmuldnsrec"/> for details of how they are checked.
62867 </para>
62868 <para>
62869 Values returned by a properly running DBSBL should be in the 127.0.0.0/8
62870 range. If a DNSBL operator loses control of the domain, lookups on it
62871 may start returning other addresses.  Because of this, Exim now ignores
62872 returned values outside the 127/8 region.
62873 </para>
62874 </section>
62875 <section id="SECID204">
62876 <title>Variables set from DNS lists</title>
62877 <para>
62878 <indexterm role="concept">
62879 <primary>expansion</primary>
62880 <secondary>variables, set from DNS list</secondary>
62881 </indexterm>
62882 <indexterm role="concept">
62883 <primary>DNS list</primary>
62884 <secondary>variables set from</secondary>
62885 </indexterm>
62886 <indexterm role="variable">
62887 <primary><varname>$dnslist_domain</varname></primary>
62888 </indexterm>
62889 <indexterm role="variable">
62890 <primary><varname>$dnslist_matched</varname></primary>
62891 </indexterm>
62892 <indexterm role="variable">
62893 <primary><varname>$dnslist_text</varname></primary>
62894 </indexterm>
62895 <indexterm role="variable">
62896 <primary><varname>$dnslist_value</varname></primary>
62897 </indexterm>
62898 When an entry is found in a DNS list, the variable <varname>$dnslist_domain</varname> contains
62899 the name of the overall domain that matched (for example,
62900 <literal>spamhaus.example</literal>), <varname>$dnslist_matched</varname> contains the key within that domain
62901 (for example, <literal>192.168.5.3</literal>), and <varname>$dnslist_value</varname> contains the data from
62902 the DNS record. When the key is an IP address, it is not reversed in
62903 <varname>$dnslist_matched</varname> (though it is, of course, in the actual lookup). In simple
62904 cases, for example:
62905 </para>
62906 <literallayout class="monospaced">
62907 deny dnslists = spamhaus.example
62908 </literallayout>
62909 <para>
62910 the key is also available in another variable (in this case,
62911 <varname>$sender_host_address</varname>). In more complicated cases, however, this is not true.
62912 For example, using a data lookup (as described in section <xref linkend="SECTmulkeyfor"/>)
62913 might generate a dnslists lookup like this:
62914 </para>
62915 <literallayout class="monospaced">
62916 deny dnslists = spamhaus.example/&lt;|192.168.1.2|192.168.6.7|...
62917 </literallayout>
62918 <para>
62919 If this condition succeeds, the value in <varname>$dnslist_matched</varname> might be
62920 <literal>192.168.6.7</literal> (for example).
62921 </para>
62922 <para>
62923 If more than one address record is returned by the DNS lookup, all the IP
62924 addresses are included in <varname>$dnslist_value</varname>, separated by commas and spaces.
62925 The variable <varname>$dnslist_text</varname> contains the contents of any associated TXT
62926 record. For lists such as RBL+ the TXT record for a merged entry is often not
62927 very meaningful. See section <xref linkend="SECTmordetinf"/> for a way of obtaining more
62928 information.
62929 </para>
62930 <para>
62931 You can use the DNS list variables in <option>message</option> or <option>log_message</option> modifiers
62932 &ndash; even if these appear before the condition in the ACL, they are not
62933 expanded until after it has failed. For example:
62934 </para>
62935 <literallayout class="monospaced">
62936 deny    hosts = !+local_networks
62937         message = $sender_host_address is listed \
62938                   at $dnslist_domain
62939         dnslists = rbl-plus.mail-abuse.example
62940 </literallayout>
62941 </section>
62942 <section id="SECTaddmatcon">
62943 <title>Additional matching conditions for DNS lists</title>
62944 <para>
62945 <indexterm role="concept">
62946 <primary>DNS list</primary>
62947 <secondary>matching specific returned data</secondary>
62948 </indexterm>
62949 You can add an equals sign and an IP address after a <option>dnslists</option> domain name
62950 in order to restrict its action to DNS records with a matching right hand side.
62951 For example,
62952 </para>
62953 <literallayout class="monospaced">
62954 deny dnslists = rblplus.mail-abuse.org=127.0.0.2
62955 </literallayout>
62956 <para>
62957 rejects only those hosts that yield 127.0.0.2. Without this additional data,
62958 any address record is considered to be a match. For the moment, we assume
62959 that the DNS lookup returns just one record. Section <xref linkend="SECThanmuldnsrec"/>
62960 describes how multiple records are handled.
62961 </para>
62962 <para>
62963 More than one IP address may be given for checking, using a comma as a
62964 separator. These are alternatives &ndash; if any one of them matches, the
62965 <option>dnslists</option> condition is true. For example:
62966 </para>
62967 <literallayout class="monospaced">
62968 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
62969 </literallayout>
62970 <para>
62971 If you want to specify a constraining address list and also specify names or IP
62972 addresses to be looked up, the constraining address list must be specified
62973 first. For example:
62974 </para>
62975 <literallayout class="monospaced">
62976 deny dnslists = dsn.rfc-ignorant.org\
62977                 =127.0.0.2/$sender_address_domain
62978 </literallayout>
62979 <para>
62980 If the character <literal>&amp;</literal> is used instead of <literal>=</literal>, the comparison for each
62981 listed IP address is done by a bitwise <quote>and</quote> instead of by an equality test.
62982 In other words, the listed addresses are used as bit masks. The comparison is
62983 true if all the bits in the mask are present in the address that is being
62984 tested. For example:
62985 </para>
62986 <literallayout class="monospaced">
62987 dnslists = a.b.c&amp;0.0.0.3
62988 </literallayout>
62989 <para>
62990 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
62991 want to test whether one bit or another bit is present (as opposed to both
62992 being present), you must use multiple values. For example:
62993 </para>
62994 <literallayout class="monospaced">
62995 dnslists = a.b.c&amp;0.0.0.1,0.0.0.2
62996 </literallayout>
62997 <para>
62998 matches if the final component of the address is an odd number or two times
62999 an odd number.
63000 </para>
63001 </section>
63002 <section id="SECID205">
63003 <title>Negated DNS matching conditions</title>
63004 <para>
63005 You can supply a negative list of IP addresses as part of a <option>dnslists</option>
63006 condition. Whereas
63007 </para>
63008 <literallayout class="monospaced">
63009 deny  dnslists = a.b.c=127.0.0.2,127.0.0.3
63010 </literallayout>
63011 <para>
63012 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
63013 IP address yielded by the list is either 127.0.0.2 or 127.0.0.3</quote>,
63014 </para>
63015 <literallayout class="monospaced">
63016 deny  dnslists = a.b.c!=127.0.0.2,127.0.0.3
63017 </literallayout>
63018 <para>
63019 means <quote>deny if the host is in the black list at the domain <emphasis>a.b.c</emphasis> and the
63020 IP address yielded by the list is not 127.0.0.2 and not 127.0.0.3</quote>. In other
63021 words, the result of the test is inverted if an exclamation mark appears before
63022 the <literal>=</literal> (or the <literal>&amp;</literal>) sign.
63023 </para>
63024 <para>
63025 <emphasis role="bold">Note</emphasis>: This kind of negation is not the same as negation in a domain,
63026 host, or address list (which is why the syntax is different).
63027 </para>
63028 <para>
63029 If you are using just one list, the negation syntax does not gain you much. The
63030 previous example is precisely equivalent to
63031 </para>
63032 <literallayout class="monospaced">
63033 deny  dnslists = a.b.c
63034      !dnslists = a.b.c=127.0.0.2,127.0.0.3
63035 </literallayout>
63036 <para>
63037 However, if you are using multiple lists, the negation syntax is clearer.
63038 Consider this example:
63039 </para>
63040 <literallayout class="monospaced">
63041 deny  dnslists = sbl.spamhaus.org : \
63042                  list.dsbl.org : \
63043                  dnsbl.njabl.org!=127.0.0.3 : \
63044                  relays.ordb.org
63045 </literallayout>
63046 <para>
63047 Using only positive lists, this would have to be:
63048 </para>
63049 <literallayout class="monospaced">
63050 deny  dnslists = sbl.spamhaus.org : \
63051                  list.dsbl.org
63052 deny  dnslists = dnsbl.njabl.org
63053      !dnslists = dnsbl.njabl.org=127.0.0.3
63054 deny  dnslists = relays.ordb.org
63055 </literallayout>
63056 <para>
63057 which is less clear, and harder to maintain.
63058 </para>
63059 <para>
63060 Negation can also be used with a bitwise-and restriction.
63061 The dnslists condition with only be trus if a result is returned
63062 by the lookup which, anded with the restriction, is all zeroes.
63063 For example:
63064 </para>
63065 <literallayout class="monospaced">
63066 deny dnslists = zen.spamhaus.org!&amp;0.255.255.0
63067 </literallayout>
63068 </section>
63069 <section id="SECThanmuldnsrec">
63070 <title>Handling multiple DNS records from a DNS list</title>
63071 <para>
63072 A DNS lookup for a <option>dnslists</option> condition may return more than one DNS record,
63073 thereby providing more than one IP address. When an item in a <option>dnslists</option> list
63074 is followed by <literal>=</literal> or <literal>&amp;</literal> and a list of IP addresses, in order to restrict
63075 the match to specific results from the DNS lookup, there are two ways in which
63076 the checking can be handled. For example, consider the condition:
63077 </para>
63078 <literallayout class="monospaced">
63079 dnslists = a.b.c=127.0.0.1
63080 </literallayout>
63081 <para>
63082 What happens if the DNS lookup for the incoming IP address yields both
63083 127.0.0.1 and 127.0.0.2 by means of two separate DNS records? Is the
63084 condition true because at least one given value was found, or is it false
63085 because at least one of the found values was not listed? And how does this
63086 affect negated conditions? Both possibilities are provided for with the help of
63087 additional separators <literal>==</literal> and <literal>=&amp;</literal>.
63088 </para>
63089 <itemizedlist>
63090 <listitem>
63091 <para>
63092 If <literal>=</literal> or <literal>&amp;</literal> is used, the condition is true if any one of the looked up
63093 IP addresses matches one of the listed addresses. For the example above, the
63094 condition is true because 127.0.0.1 matches.
63095 </para>
63096 </listitem>
63097 <listitem>
63098 <para>
63099 If <literal>==</literal> or <literal>=&amp;</literal> is used, the condition is true only if every one of the
63100 looked up IP addresses matches one of the listed addresses. If the condition is
63101 changed to:
63102 </para>
63103 <literallayout class="monospaced">
63104 dnslists = a.b.c==127.0.0.1
63105 </literallayout>
63106 <para>
63107 and the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
63108 false because 127.0.0.2 is not listed. You would need to have:
63109 </para>
63110 <literallayout class="monospaced">
63111 dnslists = a.b.c==127.0.0.1,127.0.0.2
63112 </literallayout>
63113 <para>
63114 for the condition to be true.
63115 </para>
63116 </listitem>
63117 </itemizedlist>
63118 <para>
63119 When <literal>!</literal> is used to negate IP address matching, it inverts the result, giving
63120 the precise opposite of the behaviour above. Thus:
63121 </para>
63122 <itemizedlist>
63123 <listitem>
63124 <para>
63125 If <literal>!=</literal> or <literal>!&amp;</literal> is used, the condition is true if none of the looked up IP
63126 addresses matches one of the listed addresses. Consider:
63127 </para>
63128 <literallayout class="monospaced">
63129 dnslists = a.b.c!&amp;0.0.0.1
63130 </literallayout>
63131 <para>
63132 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
63133 false because 127.0.0.1 matches.
63134 </para>
63135 </listitem>
63136 <listitem>
63137 <para>
63138 If <literal>!==</literal> or <literal>!=&amp;</literal> is used, the condition is true if there is at least one
63139 looked up IP address that does not match. Consider:
63140 </para>
63141 <literallayout class="monospaced">
63142 dnslists = a.b.c!=&amp;0.0.0.1
63143 </literallayout>
63144 <para>
63145 If the DNS lookup yields both 127.0.0.1 and 127.0.0.2, the condition is
63146 true, because 127.0.0.2 does not match. You would need to have:
63147 </para>
63148 <literallayout class="monospaced">
63149 dnslists = a.b.c!=&amp;0.0.0.1,0.0.0.2
63150 </literallayout>
63151 <para>
63152 for the condition to be false.
63153 </para>
63154 </listitem>
63155 </itemizedlist>
63156 <para>
63157 When the DNS lookup yields only a single IP address, there is no difference
63158 between <literal>=</literal> and <literal>==</literal> and between <literal>&amp;</literal> and <literal>=&amp;</literal>.
63159 </para>
63160 </section>
63161 <section id="SECTmordetinf">
63162 <title>Detailed information from merged DNS lists</title>
63163 <para>
63164 <indexterm role="concept">
63165 <primary>DNS list</primary>
63166 <secondary>information from merged</secondary>
63167 </indexterm>
63168 When the facility for restricting the matching IP values in a DNS list is used,
63169 the text from the TXT record that is set in <varname>$dnslist_text</varname> may not reflect
63170 the true reason for rejection. This happens when lists are merged and the IP
63171 address in the A record is used to distinguish them; unfortunately there is
63172 only one TXT record. One way round this is not to use merged lists, but that
63173 can be inefficient because it requires multiple DNS lookups where one would do
63174 in the vast majority of cases when the host of interest is not on any of the
63175 lists.
63176 </para>
63177 <para>
63178 A less inefficient way of solving this problem is available. If
63179 two domain names, comma-separated, are given, the second is used first to
63180 do an initial check, making use of any IP value restrictions that are set.
63181 If there is a match, the first domain is used, without any IP value
63182 restrictions, to get the TXT record. As a byproduct of this, there is also
63183 a check that the IP being tested is indeed on the first list. The first
63184 domain is the one that is put in <varname>$dnslist_domain</varname>. For example:
63185 </para>
63186 <literallayout class="monospaced">
63187 deny   dnslists = \
63188          sbl.spamhaus.org,sbl-xbl.spamhaus.org=127.0.0.2 : \
63189          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
63190        message  = \
63191          rejected because $sender_host_address is blacklisted \
63192          at $dnslist_domain\n$dnslist_text
63193 </literallayout>
63194 <para>
63195 For the first blacklist item, this starts by doing a lookup in
63196 <emphasis>sbl-xbl.spamhaus.org</emphasis> and testing for a 127.0.0.2 return. If there is a
63197 match, it then looks in <emphasis>sbl.spamhaus.org</emphasis>, without checking the return
63198 value, and as long as something is found, it looks for the corresponding TXT
63199 record. If there is no match in <emphasis>sbl-xbl.spamhaus.org</emphasis>, nothing more is done.
63200 The second blacklist item is processed similarly.
63201 </para>
63202 <para>
63203 If you are interested in more than one merged list, the same list must be
63204 given several times, but because the results of the DNS lookups are cached,
63205 the DNS calls themselves are not repeated. For example:
63206 </para>
63207 <literallayout class="monospaced">
63208 deny dnslists = \
63209          http.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.2 : \
63210          socks.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.3 : \
63211          misc.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.4 : \
63212          dul.dnsbl.sorbs.net,dnsbl.sorbs.net=127.0.0.10
63213 </literallayout>
63214 <para>
63215 In this case there is one lookup in <emphasis>dnsbl.sorbs.net</emphasis>, and if none of the IP
63216 values matches (or if no record is found), this is the only lookup that is
63217 done. Only if there is a match is one of the more specific lists consulted.
63218 </para>
63219 </section>
63220 <section id="SECTmorednslistslast">
63221 <title>DNS lists and IPv6</title>
63222 <para>
63223 <indexterm role="concept">
63224 <primary>IPv6</primary>
63225 <secondary>DNS black lists</secondary>
63226 </indexterm>
63227 <indexterm role="concept">
63228 <primary>DNS list</primary>
63229 <secondary>IPv6 usage</secondary>
63230 </indexterm>
63231 If Exim is asked to do a dnslist lookup for an IPv6 address, it inverts it
63232 nibble by nibble. For example, if the calling host&#x2019;s IP address is
63233 3ffe:ffff:836f:0a00:000a:0800:200a:c031, Exim might look up
63234 </para>
63235 <literallayout class="monospaced">
63236 1.3.0.c.a.0.0.2.0.0.8.0.a.0.0.0.0.0.a.0.f.6.3.8.
63237   f.f.f.f.e.f.f.3.blackholes.mail-abuse.org
63238 </literallayout>
63239 <para>
63240 (split over two lines here to fit on the page). Unfortunately, some of the DNS
63241 lists contain wildcard records, intended for IPv4, that interact badly with
63242 IPv6. For example, the DNS entry
63243 </para>
63244 <literallayout class="monospaced">
63245 *.3.some.list.example.    A    127.0.0.1
63246 </literallayout>
63247 <para>
63248 is probably intended to put the entire 3.0.0.0/8 IPv4 network on the list.
63249 Unfortunately, it also matches the entire 3::/4 IPv6 network.
63250 </para>
63251 <para>
63252 You can exclude IPv6 addresses from DNS lookups by making use of a suitable
63253 <option>condition</option> condition, as in this example:
63254 </para>
63255 <literallayout class="monospaced">
63256 deny   condition = ${if isip4{$sender_host_address}}
63257        dnslists  = some.list.example
63258 </literallayout>
63259 <para>
63260 If an explicit key is being used for a DNS lookup and it may be an IPv6
63261 address you should specify alternate list separators for both the outer
63262 (DNS list name) list and inner (lookup keys) list:
63263 </para>
63264 <literallayout class="monospaced">
63265        dnslists = &lt;; dnsbl.example.com/&lt;|$acl_m_addrslist
63266 </literallayout>
63267 </section>
63268 <section id="SECTseen" revisionflag="changed">
63269 <title>Previously seen user and hosts</title>
63270 <para revisionflag="changed">
63271 <indexterm role="concept">
63272 <primary><option>sseen</option> ACL condition</primary>
63273 </indexterm>
63274 <indexterm role="concept">
63275 <primary>greylisting</primary>
63276 </indexterm>
63277 The <option>seen</option> ACL condition can be used to test whether a
63278 situation has been previously met.
63279 It uses a hints database to record a timestamp against a key.
63280 host. The syntax of the condition is:
63281 </para>
63282 <literallayout revisionflag="changed">
63283 <literal>seen =</literal> &lt;<emphasis>optional flag</emphasis>&gt;&lt;<emphasis>time interval</emphasis>&gt; <literal>/</literal> &lt;<emphasis>options</emphasis>&gt;
63284 </literallayout>
63285 <para revisionflag="changed">
63286 For example,
63287 </para>
63288 <literallayout class="monospaced" revisionflag="changed">
63289 defer   seen = -5m / key=${sender_host_address}_$local_part@$domain
63290 </literallayout>
63291 <para revisionflag="changed">
63292 in a RCPT ACL will implement simple greylisting.
63293 </para>
63294 <para revisionflag="changed">
63295 The parameters for the condition are
63296 a possible minus sign,
63297 then an interval,
63298 then, slash-separated, a list of options.
63299 The interval is taken as an offset before the current time,
63300 and used for the test.
63301 If the interval is preceded by a minus sign then the condition returns
63302 whether a record is found which is before the test time.
63303 Otherwise, the condition returns whether one is found which is since the
63304 test time.
63305 </para>
63306 <para revisionflag="changed">
63307 Options are read in order with later ones overriding earlier ones.
63308 </para>
63309 <para revisionflag="changed">
63310 The default key is <varname>$sender_host_address</varname>.
63311 An explicit key can be set using a <option>key=value</option> option.
63312 </para>
63313 <para revisionflag="changed">
63314 If a <option>readonly</option> option is given then
63315 no record create or update is done.
63316 If a <option>write</option> option is given then
63317 a record create or update is always done.
63318 An update is done if the test is for <quote>since</quote>.
63319 If none of those hold and there was no existing record,
63320 a record is created.
63321 </para>
63322 <para revisionflag="changed">
63323 Creates and updates are marked with the current time.
63324 </para>
63325 <para revisionflag="changed">
63326 Finally, a <quote>before</quote> test which succeeds, and for which the record
63327 is old enough, will be refreshed with a timestamp of the test time.
63328 This can prevent tidying of the database from removing the entry.
63329 The interval for this is, by default, 10 days.
63330 An explicit interval can be set using a
63331 <option>refresh=value</option> option.
63332 </para>
63333 <para revisionflag="changed">
63334 Note that <quote>seen</quote> should be added to the list of hints databases
63335 for maintenance if this ACL condition is used.
63336 </para>
63337 </section>
63338 <section id="SECTratelimiting">
63339 <title>Rate limiting incoming messages</title>
63340 <para>
63341 <indexterm role="concept">
63342 <primary>rate limiting</primary>
63343 <secondary>client sending</secondary>
63344 </indexterm>
63345 <indexterm role="concept">
63346 <primary>limiting client sending rates</primary>
63347 </indexterm>
63348 <indexterm role="option">
63349 <primary><option>smtp_ratelimit_*</option></primary>
63350 </indexterm>
63351 The <option>ratelimit</option> ACL condition can be used to measure and control the rate at
63352 which clients can send email. This is more powerful than the
63353 <option>smtp_ratelimit_*</option> options, because those options control the rate of
63354 commands in a single SMTP session only, whereas the <option>ratelimit</option> condition
63355 works across all connections (concurrent and sequential) from the same client
63356 host. The syntax of the <option>ratelimit</option> condition is:
63357 </para>
63358 <literallayout>
63359 <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;
63360 </literallayout>
63361 <para>
63362 If the average client sending rate is less than <emphasis>m</emphasis> messages per time
63363 period <emphasis>p</emphasis> then the condition is false; otherwise it is true.
63364 </para>
63365 <para>
63366 As a side-effect, the <option>ratelimit</option> condition sets the expansion variable
63367 <varname>$sender_rate</varname> to the client&#x2019;s computed rate, <varname>$sender_rate_limit</varname> to the
63368 configured value of <emphasis>m</emphasis>, and <varname>$sender_rate_period</varname> to the configured value
63369 of <emphasis>p</emphasis>.
63370 </para>
63371 <para>
63372 The parameter <emphasis>p</emphasis> is the smoothing time constant, in the form of an Exim
63373 time interval, for example, <literal>8h</literal> for eight hours. A larger time constant
63374 means that it takes Exim longer to forget a client&#x2019;s past behaviour. The
63375 parameter <emphasis>m</emphasis> is the maximum number of messages that a client is permitted to
63376 send in each time interval. It also specifies the number of messages permitted
63377 in a fast burst. By increasing both <emphasis>m</emphasis> and <emphasis>p</emphasis> but keeping <emphasis>m/p</emphasis>
63378 constant, you can allow a client to send more messages in a burst without
63379 changing its long-term sending rate limit. Conversely, if <emphasis>m</emphasis> and <emphasis>p</emphasis> are
63380 both small, messages must be sent at an even rate.
63381 </para>
63382 <para>
63383 There is a script in <filename>util/ratelimit.pl</filename> which extracts sending rates from
63384 log files, to assist with choosing appropriate settings for <emphasis>m</emphasis> and <emphasis>p</emphasis>
63385 when deploying the <option>ratelimit</option> ACL condition. The script prints usage
63386 instructions when it is run with no arguments.
63387 </para>
63388 <para>
63389 The key is used to look up the data for calculating the client&#x2019;s average
63390 sending rate. This data is stored in Exim&#x2019;s spool directory, alongside the
63391 retry and other hints databases. The default key is <varname>$sender_host_address</varname>,
63392 which means Exim computes the sending rate of each client host IP address.
63393 By changing the key you can change how Exim identifies clients for the purpose
63394 of ratelimiting. For example, to limit the sending rate of each authenticated
63395 user, independent of the computer they are sending from, set the key to
63396 <varname>$authenticated_id</varname>. You must ensure that the lookup key is meaningful; for
63397 example, <varname>$authenticated_id</varname> is only meaningful if the client has
63398 authenticated (which you can check with the <option>authenticated</option> ACL condition).
63399 </para>
63400 <para>
63401 The lookup key does not have to identify clients: If you want to limit the
63402 rate at which a recipient receives messages, you can use the key
63403 <literal>$local_part@$domain</literal> with the <option>per_rcpt</option> option (see below) in a RCPT
63404 ACL.
63405 </para>
63406 <para>
63407 Each <option>ratelimit</option> condition can have up to four options. A <option>per_*</option> option
63408 specifies what Exim measures the rate of, for example, messages or recipients
63409 or bytes. You can adjust the measurement using the <option>unique=</option> and/or
63410 <option>count=</option> options. You can also control when Exim updates the recorded rate
63411 using a <option>strict</option>, <option>leaky</option>, or <option>readonly</option> option. The options are
63412 separated by a slash, like the other parameters. They may appear in any order.
63413 </para>
63414 <para>
63415 Internally, Exim appends the smoothing constant <emphasis>p</emphasis> onto the lookup key with
63416 any options that alter the meaning of the stored data. The limit <emphasis>m</emphasis> is not
63417 stored, so you can alter the configured maximum rate and Exim will still
63418 remember clients&#x2019; past behaviour. If you change the <option>per_*</option> mode or add or
63419 remove the <option>unique=</option> option, the lookup key changes so Exim will forget past
63420 behaviour. The lookup key is not affected by changes to the update mode and
63421 the <option>count=</option> option.
63422 </para>
63423 </section>
63424 <section id="ratoptmea">
63425 <title>Ratelimit options for what is being measured</title>
63426 <para>
63427 <indexterm role="concept">
63428 <primary>rate limiting</primary>
63429 <secondary>per_* options</secondary>
63430 </indexterm>
63431 The <option>per_conn</option> option limits the client&#x2019;s connection rate. It is not
63432 normally used in the <option>acl_not_smtp</option>, <option>acl_not_smtp_mime</option>, or
63433 <option>acl_not_smtp_start</option> ACLs.
63434 </para>
63435 <para>
63436 The <option>per_mail</option> option limits the client&#x2019;s rate of sending messages. This is
63437 the default if none of the <option>per_*</option> options is specified. It can be used in
63438 <option>acl_smtp_mail</option>, <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>, <option>acl_smtp_mime</option>,
63439 <option>acl_smtp_data</option>, or <option>acl_not_smtp</option>.
63440 </para>
63441 <para>
63442 The <option>per_byte</option> option limits the sender&#x2019;s email bandwidth. It can be used in
63443 the same ACLs as the <option>per_mail</option> option, though it is best to use this option
63444 in the <option>acl_smtp_mime</option>, <option>acl_smtp_data</option> or <option>acl_not_smtp</option> ACLs; if it is
63445 used in an earlier ACL, Exim relies on the SIZE parameter given by the client
63446 in its MAIL command, which may be inaccurate or completely missing. You can
63447 follow the limit <emphasis>m</emphasis> in the configuration with K, M, or G to specify limits
63448 in kilobytes, megabytes, or gigabytes, respectively.
63449 </para>
63450 <para>
63451 The <option>per_rcpt</option> option causes Exim to limit the rate at which recipients are
63452 accepted. It can be used in the <option>acl_smtp_rcpt</option>, <option>acl_smtp_predata</option>,
63453 <option>acl_smtp_mime</option>, or <option>acl_smtp_data</option> ACLs. In
63454 <option>acl_smtp_rcpt</option> the rate is updated one recipient at a time; in the other
63455 ACLs the rate is updated with the total (accepted) recipient count in one go. Note that
63456 in either case the rate limiting engine will see a message with many
63457 recipients as a large high-speed burst.
63458 </para>
63459 <para>
63460 The <option>per_addr</option> option is like the <option>per_rcpt</option> option, except it counts the
63461 number of different recipients that the client has sent messages to in the
63462 last time period. That is, if the client repeatedly sends messages to the same
63463 recipient, its measured rate is not increased. This option can only be used in
63464 <option>acl_smtp_rcpt</option>.
63465 </para>
63466 <para>
63467 The <option>per_cmd</option> option causes Exim to recompute the rate every time the
63468 condition is processed. This can be used to limit the rate of any SMTP
63469 command. If it is used in multiple ACLs it can limit the aggregate rate of
63470 multiple different commands.
63471 </para>
63472 <para>
63473 The <option>count=</option> option can be used to alter how much Exim adds to the client&#x2019;s
63474 measured rate. For example, the <option>per_byte</option> option is equivalent to
63475 <literal>per_mail/count=$message_size</literal>. If there is no <option>count=</option> option, Exim
63476 increases the measured rate by one (except for the <option>per_rcpt</option> option in ACLs
63477 other than <option>acl_smtp_rcpt</option>). The count does not have to be an integer.
63478 </para>
63479 <para>
63480 The <option>unique=</option> option is described in section <xref linkend="ratoptuniq"/> below.
63481 </para>
63482 </section>
63483 <section id="ratoptupd">
63484 <title>Ratelimit update modes</title>
63485 <para>
63486 <indexterm role="concept">
63487 <primary>rate limiting</primary>
63488 <secondary>reading data without updating</secondary>
63489 </indexterm>
63490 You can specify one of three options with the <option>ratelimit</option> condition to
63491 control when its database is updated. This section describes the <option>readonly</option>
63492 mode, and the next section describes the <option>strict</option> and <option>leaky</option> modes.
63493 </para>
63494 <para>
63495 If the <option>ratelimit</option> condition is used in <option>readonly</option> mode, Exim looks up a
63496 previously-computed rate to check against the limit.
63497 </para>
63498 <para>
63499 For example, you can test the client&#x2019;s sending rate and deny it access (when
63500 it is too fast) in the connect ACL. If the client passes this check then it
63501 can go on to send a message, in which case its recorded rate will be updated
63502 in the MAIL ACL. Subsequent connections from the same client will check this
63503 new rate.
63504 </para>
63505 <literallayout class="monospaced">
63506 acl_check_connect:
63507  deny ratelimit = 100 / 5m / readonly
63508       log_message = RATE CHECK: $sender_rate/$sender_rate_period \
63509                   (max $sender_rate_limit)
63510 # ...
63511 acl_check_mail:
63512  warn ratelimit = 100 / 5m / strict
63513       log_message = RATE UPDATE: $sender_rate/$sender_rate_period \
63514                   (max $sender_rate_limit)
63515 </literallayout>
63516 <para>
63517 If Exim encounters multiple <option>ratelimit</option> conditions with the same key when
63518 processing a message then it may increase the client&#x2019;s measured rate more than
63519 it should. For example, this will happen if you check the <option>per_rcpt</option> option
63520 in both <option>acl_smtp_rcpt</option> and <option>acl_smtp_data</option>. However it&#x2019;s OK to check the
63521 same <option>ratelimit</option> condition multiple times in the same ACL. You can avoid any
63522 multiple update problems by using the <option>readonly</option> option on later ratelimit
63523 checks.
63524 </para>
63525 <para>
63526 The <option>per_*</option> options described above do not make sense in some ACLs. If you
63527 use a <option>per_*</option> option in an ACL where it is not normally permitted then the
63528 update mode defaults to <option>readonly</option> and you cannot specify the <option>strict</option> or
63529 <option>leaky</option> modes. In other ACLs the default update mode is <option>leaky</option> (see the
63530 next section) so you must specify the <option>readonly</option> option explicitly.
63531 </para>
63532 </section>
63533 <section id="ratoptfast">
63534 <title>Ratelimit options for handling fast clients</title>
63535 <para>
63536 <indexterm role="concept">
63537 <primary>rate limiting</primary>
63538 <secondary>strict and leaky modes</secondary>
63539 </indexterm>
63540 If a client&#x2019;s average rate is greater than the maximum, the rate limiting
63541 engine can react in two possible ways, depending on the presence of the
63542 <option>strict</option> or <option>leaky</option> update modes. This is independent of the other
63543 counter-measures (such as rejecting the message) that may be specified by the
63544 rest of the ACL.
63545 </para>
63546 <para>
63547 The <option>leaky</option> (default) option means that the client&#x2019;s recorded rate is not
63548 updated if it is above the limit. The effect of this is that Exim measures the
63549 client&#x2019;s average rate of successfully sent email,
63550 up to the given limit.
63551 This is appropriate if the countermeasure when the condition is true
63552 consists of refusing the message, and
63553 is generally the better choice if you have clients that retry automatically.
63554 If the action when true is anything more complex then this option is
63555 likely not what is wanted.
63556 </para>
63557 <para>
63558 The <option>strict</option> option means that the client&#x2019;s recorded rate is always
63559 updated. The effect of this is that Exim measures the client&#x2019;s average rate
63560 of attempts to send email, which can be much higher than the maximum it is
63561 actually allowed. If the client is over the limit it may be subjected to
63562 counter-measures by the ACL. It must slow down and allow sufficient time to
63563 pass that its computed rate falls below the maximum before it can send email
63564 again. The time (the number of smoothing periods) it must wait and not
63565 attempt to send mail can be calculated with this formula:
63566 </para>
63567 <literallayout class="monospaced">
63568         ln(peakrate/maxrate)
63569 </literallayout>
63570 </section>
63571 <section id="ratoptuniq">
63572 <title>Limiting the rate of different events</title>
63573 <para>
63574 <indexterm role="concept">
63575 <primary>rate limiting</primary>
63576 <secondary>counting unique events</secondary>
63577 </indexterm>
63578 The <option>ratelimit</option> <option>unique=</option> option controls a mechanism for counting the
63579 rate of different events. For example, the <option>per_addr</option> option uses this
63580 mechanism to count the number of different recipients that the client has
63581 sent messages to in the last time period; it is equivalent to
63582 <literal>per_rcpt/unique=$local_part@$domain</literal>. You could use this feature to
63583 measure the rate that a client uses different sender addresses with the
63584 options <literal>per_mail/unique=$sender_address</literal>.
63585 </para>
63586 <para>
63587 For each <option>ratelimit</option> key Exim stores the set of <option>unique=</option> values that it
63588 has seen for that key. The whole set is thrown away when it is older than the
63589 rate smoothing period <emphasis>p</emphasis>, so each different event is counted at most once
63590 per period. In the <option>leaky</option> update mode, an event that causes the client to
63591 go over the limit is not added to the set, in the same way that the client&#x2019;s
63592 recorded rate is not updated in the same situation.
63593 </para>
63594 <para>
63595 When you combine the <option>unique=</option> and <option>readonly</option> options, the specific
63596 <option>unique=</option> value is ignored, and Exim just retrieves the client&#x2019;s stored
63597 rate.
63598 </para>
63599 <para>
63600 The <option>unique=</option> mechanism needs more space in the ratelimit database than the
63601 other <option>ratelimit</option> options in order to store the event set. The number of
63602 unique values is potentially as large as the rate limit, so the extra space
63603 required increases with larger limits.
63604 </para>
63605 <para>
63606 The uniqueification is not perfect: there is a small probability that Exim
63607 will think a new event has happened before. If the sender&#x2019;s rate is less than
63608 the limit, Exim should be more than 99.9% correct. However in <option>strict</option> mode
63609 the measured rate can go above the limit, in which case Exim may under-count
63610 events by a significant margin. Fortunately, if the rate is high enough (2.7
63611 times the limit) that the false positive rate goes above 9%, then Exim will
63612 throw away the over-full event set before the measured rate falls below the
63613 limit. Therefore the only harm should be that exceptionally high sending rates
63614 are logged incorrectly; any countermeasures you configure will be as effective
63615 as intended.
63616 </para>
63617 </section>
63618 <section id="useratlim">
63619 <title>Using rate limiting</title>
63620 <para>
63621 Exim&#x2019;s other ACL facilities are used to define what counter-measures are taken
63622 when the rate limit is exceeded. This might be anything from logging a warning
63623 (for example, while measuring existing sending rates in order to define
63624 policy), through time delays to slow down fast senders, up to rejecting the
63625 message. For example:
63626 </para>
63627 <literallayout class="monospaced">
63628 # Log all senders' rates
63629 warn ratelimit = 0 / 1h / strict
63630      log_message = Sender rate $sender_rate / $sender_rate_period
63631
63632 # Slow down fast senders; note the need to truncate $sender_rate
63633 # at the decimal point.
63634 warn ratelimit = 100 / 1h / per_rcpt / strict
63635      delay     = ${eval: ${sg{$sender_rate}{[.].*}{}} - \
63636                    $sender_rate_limit }s
63637
63638 # Keep authenticated users under control
63639 deny authenticated = *
63640      ratelimit = 100 / 1d / strict / $authenticated_id
63641
63642 # System-wide rate limit
63643 defer ratelimit = 10 / 1s / $primary_hostname
63644       message = Sorry, too busy. Try again later.
63645
63646 # Restrict incoming rate from each host, with a default
63647 # set using a macro and special cases looked up in a table.
63648 defer ratelimit = ${lookup {$sender_host_address} \
63649                    cdb {DB/ratelimits.cdb} \
63650                    {$value} {RATELIMIT} }
63651       message = Sender rate exceeds $sender_rate_limit \
63652                messages per $sender_rate_period
63653 </literallayout>
63654 <para>
63655 <emphasis role="bold">Warning</emphasis>: If you have a busy server with a lot of <option>ratelimit</option> tests,
63656 especially with the <option>per_rcpt</option> option, you may suffer from a performance
63657 bottleneck caused by locking on the ratelimit hints database. Apart from
63658 making your ACLs less complicated, you can reduce the problem by using a
63659 RAM disk for Exim&#x2019;s hints directory (usually <filename>/var/spool/exim/db/</filename>). However
63660 this means that Exim will lose its hints data after a reboot (including retry
63661 hints, the callout cache, and ratelimit data).
63662 </para>
63663 </section>
63664 <section id="SECTaddressverification">
63665 <title>Address verification</title>
63666 <para>
63667 <indexterm role="concept">
63668 <primary>verifying address</primary>
63669 <secondary>options for</secondary>
63670 </indexterm>
63671 <indexterm role="concept">
63672 <primary>policy control</primary>
63673 <secondary>address verification</secondary>
63674 </indexterm>
63675 Several of the <option>verify</option> conditions described in section
63676 <xref linkend="SECTaclconditions"/> cause addresses to be verified. Section
63677 <xref linkend="SECTsenaddver"/> discusses the reporting of sender verification failures.
63678 The verification conditions can be followed by options that modify the
63679 verification process. The options are separated from the keyword and from each
63680 other by slashes, and some of them contain parameters. For example:
63681 </para>
63682 <literallayout class="monospaced">
63683 verify = sender/callout
63684 verify = recipient/defer_ok/callout=10s,defer_ok
63685 </literallayout>
63686 <para>
63687 The first stage of address verification, which always happens, is to run the
63688 address through the routers, in <quote>verify mode</quote>. Routers can detect the
63689 difference between verification and routing for delivery, and their actions can
63690 be varied by a number of generic options such as <option>verify</option> and <option>verify_only</option>
63691 (see chapter <xref linkend="CHAProutergeneric"/>). If routing fails, verification fails.
63692 The available options are as follows:
63693 </para>
63694 <itemizedlist>
63695 <listitem>
63696 <para>
63697 If the <option>callout</option> option is specified, successful routing to one or more
63698 remote hosts is followed by a <quote>callout</quote> to those hosts as an additional
63699 check. Callouts and their sub-options are discussed in the next section.
63700 </para>
63701 </listitem>
63702 <listitem>
63703 <para>
63704 If there is a defer error while doing verification routing, the ACL
63705 normally returns <quote>defer</quote>. However, if you include <option>defer_ok</option> in the
63706 options, the condition is forced to be true instead. Note that this is a main
63707 verification option as well as a suboption for callouts.
63708 </para>
63709 </listitem>
63710 <listitem>
63711 <para>
63712 The <option>no_details</option> option is covered in section <xref linkend="SECTsenaddver"/>, which
63713 discusses the reporting of sender address verification failures.
63714 </para>
63715 </listitem>
63716 <listitem>
63717 <para>
63718 The <option>success_on_redirect</option> option causes verification always to succeed
63719 immediately after a successful redirection. By default, if a redirection
63720 generates just one address, that address is also verified. See further
63721 discussion in section <xref linkend="SECTredirwhilveri"/>.
63722 </para>
63723 </listitem>
63724 <listitem>
63725 <para>
63726 If the <option>quota</option> option is specified for recipient verify,
63727 successful routing to an appendfile transport is followed by a call into
63728 the transport to evaluate the quota status for the recipient.
63729 No actual delivery is done, but verification will succeed if the quota
63730 is sufficient for the message (if the sender gave a message size) or
63731 not already exceeded (otherwise).
63732 </para>
63733 </listitem>
63734 </itemizedlist>
63735 <para>
63736 <indexterm role="concept">
63737 <primary>verifying address</primary>
63738 <secondary>differentiating failures</secondary>
63739 </indexterm>
63740 <indexterm role="variable">
63741 <primary><varname>$recipient_verify_failure</varname></primary>
63742 </indexterm>
63743 <indexterm role="variable">
63744 <primary><varname>$sender_verify_failure</varname></primary>
63745 </indexterm>
63746 <indexterm role="variable">
63747 <primary><varname>$acl_verify_message</varname></primary>
63748 </indexterm>
63749 After an address verification failure, <varname>$acl_verify_message</varname> contains the
63750 error message that is associated with the failure. It can be preserved by
63751 coding like this:
63752 </para>
63753 <literallayout class="monospaced">
63754 warn  !verify = sender
63755        set acl_m0 = $acl_verify_message
63756 </literallayout>
63757 <para>
63758 If you are writing your own custom rejection message or log message when
63759 denying access, you can use this variable to include information about the
63760 verification failure.
63761 This variable is cleared at the end of processing the ACL verb.
63762 </para>
63763 <para>
63764 In addition, <varname>$sender_verify_failure</varname> or <varname>$recipient_verify_failure</varname> (as
63765 appropriate) contains one of the following words:
63766 </para>
63767 <itemizedlist>
63768 <listitem>
63769 <para>
63770 <option>qualify</option>: The address was unqualified (no domain), and the message
63771 was neither local nor came from an exempted host.
63772 </para>
63773 </listitem>
63774 <listitem>
63775 <para>
63776 <option>route</option>: Routing failed.
63777 </para>
63778 </listitem>
63779 <listitem>
63780 <para>
63781 <option>mail</option>: Routing succeeded, and a callout was attempted; rejection
63782 occurred at or before the MAIL command (that is, on initial
63783 connection, HELO, or MAIL).
63784 </para>
63785 </listitem>
63786 <listitem>
63787 <para>
63788 <option>recipient</option>: The RCPT command in a callout was rejected.
63789 </para>
63790 </listitem>
63791 <listitem>
63792 <para>
63793 <option>postmaster</option>: The postmaster check in a callout was rejected.
63794 </para>
63795 </listitem>
63796 <listitem>
63797 <para>
63798 <option>quota</option>: The quota check for a local recipient did non pass.
63799 </para>
63800 </listitem>
63801 </itemizedlist>
63802 <para>
63803 The main use of these variables is expected to be to distinguish between
63804 rejections of MAIL and rejections of RCPT in callouts.
63805 </para>
63806 <para>
63807 The above variables may also be set after a <emphasis role="bold">successful</emphasis>
63808 address verification to:
63809 </para>
63810 <itemizedlist>
63811 <listitem>
63812 <para>
63813 <option>random</option>: A random local-part callout succeeded
63814 </para>
63815 </listitem>
63816 </itemizedlist>
63817 </section>
63818 <section id="SECTcallver">
63819 <title>Callout verification</title>
63820 <para>
63821 <indexterm role="concept">
63822 <primary>verifying address</primary>
63823 <secondary>by callout</secondary>
63824 </indexterm>
63825 <indexterm role="concept">
63826 <primary>callout</primary>
63827 <secondary>verification</secondary>
63828 </indexterm>
63829 <indexterm role="concept">
63830 <primary>SMTP</primary>
63831 <secondary>callout verification</secondary>
63832 </indexterm>
63833 For non-local addresses, routing verifies the domain, but is unable to do any
63834 checking of the local part. There are situations where some means of verifying
63835 the local part is desirable. One way this can be done is to make an SMTP
63836 <emphasis>callback</emphasis> to a delivery host for the sender address or a <emphasis>callforward</emphasis> to
63837 a subsequent host for a recipient address, to see if the host accepts the
63838 address. We use the term <emphasis>callout</emphasis> to cover both cases. Note that for a
63839 sender address, the callback is not to the client host that is trying to
63840 deliver the message, but to one of the hosts that accepts incoming mail for the
63841 sender&#x2019;s domain.
63842 </para>
63843 <para>
63844 Exim does not do callouts by default. If you want them to happen, you must
63845 request them by setting appropriate options on the <option>verify</option> condition, as
63846 described below. This facility should be used with care, because it can add a
63847 lot of resource usage to the cost of verifying an address. However, Exim does
63848 cache the results of callouts, which helps to reduce the cost. Details of
63849 caching are in section <xref linkend="SECTcallvercache"/>.
63850 </para>
63851 <para>
63852 Recipient callouts are usually used only between hosts that are controlled by
63853 the same administration. For example, a corporate gateway host could use
63854 callouts to check for valid recipients on an internal mailserver. A successful
63855 callout does not guarantee that a real delivery to the address would succeed;
63856 on the other hand, a failing callout does guarantee that a delivery would fail.
63857 </para>
63858 <para>
63859 If the <option>callout</option> option is present on a condition that verifies an address, a
63860 second stage of verification occurs if the address is successfully routed to
63861 one or more remote hosts. The usual case is routing by a <command>dnslookup</command> or a
63862 <command>manualroute</command> router, where the router specifies the hosts. However, if a
63863 router that does not set up hosts routes to an <command>smtp</command> transport with a
63864 <option>hosts</option> setting, the transport&#x2019;s hosts are used. If an <command>smtp</command> transport has
63865 <option>hosts_override</option> set, its hosts are always used, whether or not the router
63866 supplies a host list.
63867 Callouts are only supported on <command>smtp</command> transports.
63868 </para>
63869 <para>
63870 The port that is used is taken from the transport, if it is specified and is a
63871 remote transport. (For routers that do verification only, no transport need be
63872 specified.) Otherwise, the default SMTP port is used. If a remote transport
63873 specifies an outgoing interface, this is used; otherwise the interface is not
63874 specified. Likewise, the text that is used for the HELO command is taken from
63875 the transport&#x2019;s <option>helo_data</option> option; if there is no transport, the value of
63876 <varname>$smtp_active_hostname</varname> is used.
63877 </para>
63878 <para>
63879 For a sender callout check, Exim makes SMTP connections to the remote hosts, to
63880 test whether a bounce message could be delivered to the sender address. The
63881 following SMTP commands are sent:
63882 </para>
63883 <literallayout>
63884 <literal>HELO </literal>&lt;<emphasis>local host name</emphasis>&gt;
63885 <literal>MAIL FROM:&lt;&gt;</literal>
63886 <literal>RCPT TO:</literal>&lt;<emphasis>the address to be tested</emphasis>&gt;
63887 <literal>QUIT</literal>
63888 </literallayout>
63889 <para>
63890 LHLO is used instead of HELO if the transport&#x2019;s <option>protocol</option> option is
63891 set to <quote>lmtp</quote>.
63892 </para>
63893 <para>
63894 The callout may use EHLO, AUTH and/or STARTTLS given appropriate option
63895 settings.
63896 </para>
63897 <para>
63898 A recipient callout check is similar. By default, it also uses an empty address
63899 for the sender. This default is chosen because most hosts do not make use of
63900 the sender address when verifying a recipient. Using the same address means
63901 that a single cache entry can be used for each recipient. Some sites, however,
63902 do make use of the sender address when verifying. These are catered for by the
63903 <option>use_sender</option> and <option>use_postmaster</option> options, described in the next section.
63904 </para>
63905 <para>
63906 If the response to the RCPT command is a 2<emphasis>xx</emphasis> code, the verification
63907 succeeds. If it is 5<emphasis>xx</emphasis>, the verification fails. For any other condition,
63908 Exim tries the next host, if any. If there is a problem with all the remote
63909 hosts, the ACL yields <quote>defer</quote>, unless the <option>defer_ok</option> parameter of the
63910 <option>callout</option> option is given, in which case the condition is forced to succeed.
63911 </para>
63912 <para>
63913 <indexterm role="concept">
63914 <primary>SMTP</primary>
63915 <secondary>output flushing, disabling for callout</secondary>
63916 </indexterm>
63917 A callout may take a little time. For this reason, Exim normally flushes SMTP
63918 output before performing a callout in an ACL, to avoid unexpected timeouts in
63919 clients when the SMTP PIPELINING extension is in use. The flushing can be
63920 disabled by using a <option>control</option> modifier to set <option>no_callout_flush</option>.
63921 </para>
63922 <para revisionflag="changed">
63923 <indexterm role="concept">
63924 <primary>tainted data</primary>
63925 <secondary>de-tainting</secondary>
63926 </indexterm>
63927 <indexterm role="concept">
63928 <primary>de-tainting</primary>
63929 <secondary>using receipient verify</secondary>
63930 </indexterm>
63931 A recipient callout which gets a 2<emphasis>xx</emphasis> code
63932 will assign untainted values to the
63933 <varname>$domain_data</varname> and <varname>$local_part_data</varname> variables,
63934 corresponding to the domain and local parts of the recipient address.
63935 </para>
63936 </section>
63937 <section id="CALLaddparcall">
63938 <title>Additional parameters for callouts</title>
63939 <para>
63940 <indexterm role="concept">
63941 <primary>callout</primary>
63942 <secondary>additional parameters for</secondary>
63943 </indexterm>
63944 The <option>callout</option> option can be followed by an equals sign and a number of
63945 optional parameters, separated by commas. For example:
63946 </para>
63947 <literallayout class="monospaced">
63948 verify = recipient/callout=10s,defer_ok
63949 </literallayout>
63950 <para>
63951 The old syntax, which had <option>callout_defer_ok</option> and <option>check_postmaster</option> as
63952 separate verify options, is retained for backwards compatibility, but is now
63953 deprecated. The additional parameters for <option>callout</option> are as follows:
63954 </para>
63955 <variablelist>
63956 <varlistentry>
63957 <term>&lt;<emphasis>a&nbsp;time&nbsp;interval</emphasis>&gt;</term>
63958 <listitem>
63959 <para>
63960 <indexterm role="concept">
63961 <primary>callout</primary>
63962 <secondary>timeout, specifying</secondary>
63963 </indexterm>
63964 This specifies the timeout that applies for the callout attempt to each host.
63965 For example:
63966 </para>
63967 <literallayout class="monospaced">
63968 verify = sender/callout=5s
63969 </literallayout>
63970 <para>
63971 The default is 30 seconds. The timeout is used for each response from the
63972 remote host. It is also used for the initial connection, unless overridden by
63973 the <option>connect</option> parameter.
63974 </para>
63975 </listitem></varlistentry>
63976 <varlistentry>
63977 <term><emphasis role="bold">connect&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
63978 <listitem>
63979 <para>
63980 <indexterm role="concept">
63981 <primary>callout</primary>
63982 <secondary>connection timeout, specifying</secondary>
63983 </indexterm>
63984 This parameter makes it possible to set a different (usually smaller) timeout
63985 for making the SMTP connection. For example:
63986 </para>
63987 <literallayout class="monospaced">
63988 verify = sender/callout=5s,connect=1s
63989 </literallayout>
63990 <para>
63991 If not specified, this timeout defaults to the general timeout value.
63992 </para>
63993 </listitem></varlistentry>
63994 <varlistentry>
63995 <term><emphasis role="bold">defer_ok</emphasis></term>
63996 <listitem>
63997 <para>
63998 <indexterm role="concept">
63999 <primary>callout</primary>
64000 <secondary>defer, action on</secondary>
64001 </indexterm>
64002 When this parameter is present, failure to contact any host, or any other kind
64003 of temporary error, is treated as success by the ACL. However, the cache is not
64004 updated in this circumstance.
64005 </para>
64006 </listitem></varlistentry>
64007 <varlistentry>
64008 <term><emphasis role="bold">fullpostmaster</emphasis></term>
64009 <listitem>
64010 <para>
64011 <indexterm role="concept">
64012 <primary>callout</primary>
64013 <secondary>full postmaster check</secondary>
64014 </indexterm>
64015 This operates like the <option>postmaster</option> option (see below), but if the check for
64016 <emphasis>postmaster@domain</emphasis> fails, it tries just <emphasis>postmaster</emphasis>, without a domain, in
64017 accordance with the specification in RFC 2821. The RFC states that the
64018 unqualified address <emphasis>postmaster</emphasis> should be accepted.
64019 </para>
64020 </listitem></varlistentry>
64021 <varlistentry>
64022 <term><emphasis role="bold">mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
64023 <listitem>
64024 <para>
64025 <indexterm role="concept">
64026 <primary>callout</primary>
64027 <secondary>sender when verifying header</secondary>
64028 </indexterm>
64029 When verifying addresses in header lines using the <option>header_sender</option>
64030 verification option, Exim behaves by default as if the addresses are envelope
64031 sender addresses from a message. Callout verification therefore tests to see
64032 whether a bounce message could be delivered, by using an empty address in the
64033 MAIL command. However, it is arguable that these addresses might never be used
64034 as envelope senders, and could therefore justifiably reject bounce messages
64035 (empty senders). The <option>mailfrom</option> callout parameter allows you to specify what
64036 address to use in the MAIL command. For example:
64037 </para>
64038 <literallayout class="monospaced">
64039 require  verify = header_sender/callout=mailfrom=abcd@x.y.z
64040 </literallayout>
64041 <para>
64042 This parameter is available only for the <option>header_sender</option> verification option.
64043 </para>
64044 </listitem></varlistentry>
64045 <varlistentry>
64046 <term><emphasis role="bold">maxwait&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
64047 <listitem>
64048 <para>
64049 <indexterm role="concept">
64050 <primary>callout</primary>
64051 <secondary>overall timeout, specifying</secondary>
64052 </indexterm>
64053 This parameter sets an overall timeout for performing a callout verification.
64054 For example:
64055 </para>
64056 <literallayout class="monospaced">
64057 verify = sender/callout=5s,maxwait=30s
64058 </literallayout>
64059 <para>
64060 This timeout defaults to four times the callout timeout for individual SMTP
64061 commands. The overall timeout applies when there is more than one host that can
64062 be tried. The timeout is checked before trying the next host. This prevents
64063 very long delays if there are a large number of hosts and all are timing out
64064 (for example, when network connections are timing out).
64065 </para>
64066 </listitem></varlistentry>
64067 <varlistentry>
64068 <term><emphasis role="bold">no_cache</emphasis></term>
64069 <listitem>
64070 <para>
64071 <indexterm role="concept">
64072 <primary>callout</primary>
64073 <secondary>cache, suppressing</secondary>
64074 </indexterm>
64075 <indexterm role="concept">
64076 <primary>caching callout, suppressing</primary>
64077 </indexterm>
64078 When this parameter is given, the callout cache is neither read nor updated.
64079 </para>
64080 </listitem></varlistentry>
64081 <varlistentry>
64082 <term><emphasis role="bold">postmaster</emphasis></term>
64083 <listitem>
64084 <para>
64085 <indexterm role="concept">
64086 <primary>callout</primary>
64087 <secondary>postmaster; checking</secondary>
64088 </indexterm>
64089 When this parameter is set, a successful callout check is followed by a similar
64090 check for the local part <emphasis>postmaster</emphasis> at the same domain. If this address is
64091 rejected, the callout fails (but see <option>fullpostmaster</option> above). The result of
64092 the postmaster check is recorded in a cache record; if it is a failure, this is
64093 used to fail subsequent callouts for the domain without a connection being
64094 made, until the cache record expires.
64095 </para>
64096 </listitem></varlistentry>
64097 <varlistentry>
64098 <term><emphasis role="bold">postmaster_mailfrom&nbsp;=&nbsp;</emphasis>&lt;<emphasis>email&nbsp;address</emphasis>&gt;</term>
64099 <listitem>
64100 <para>
64101 The postmaster check uses an empty sender in the MAIL command by default.
64102 You can use this parameter to do a postmaster check using a different address.
64103 For example:
64104 </para>
64105 <literallayout class="monospaced">
64106 require  verify = sender/callout=postmaster_mailfrom=abc@x.y.z
64107 </literallayout>
64108 <para>
64109 If both <option>postmaster</option> and <option>postmaster_mailfrom</option> are present, the rightmost
64110 one overrides. The <option>postmaster</option> parameter is equivalent to this example:
64111 </para>
64112 <literallayout class="monospaced">
64113 require  verify = sender/callout=postmaster_mailfrom=
64114 </literallayout>
64115 <para>
64116 <emphasis role="bold">Warning</emphasis>: The caching arrangements for postmaster checking do not take
64117 account of the sender address. It is assumed that either the empty address or
64118 a fixed non-empty address will be used. All that Exim remembers is that the
64119 postmaster check for the domain succeeded or failed.
64120 </para>
64121 </listitem></varlistentry>
64122 <varlistentry>
64123 <term><emphasis role="bold">random</emphasis></term>
64124 <listitem>
64125 <para>
64126 <indexterm role="concept">
64127 <primary>callout</primary>
64128 <secondary><quote>random</quote> check</secondary>
64129 </indexterm>
64130 When this parameter is set, before doing the normal callout check, Exim does a
64131 check for a <quote>random</quote> local part at the same domain. The local part is not
64132 really random &ndash; it is defined by the expansion of the option
64133 <option>callout_random_local_part</option>, which defaults to
64134 </para>
64135 <literallayout class="monospaced">
64136 $primary_hostname-$tod_epoch-testing
64137 </literallayout>
64138 <para>
64139 The idea here is to try to determine whether the remote host accepts all local
64140 parts without checking. If it does, there is no point in doing callouts for
64141 specific local parts. If the <quote>random</quote> check succeeds, the result is saved in
64142 a cache record, and used to force the current and subsequent callout checks to
64143 succeed without a connection being made, until the cache record expires.
64144 </para>
64145 </listitem></varlistentry>
64146 <varlistentry>
64147 <term><emphasis role="bold">use_postmaster</emphasis></term>
64148 <listitem>
64149 <para>
64150 <indexterm role="concept">
64151 <primary>callout</primary>
64152 <secondary>sender for recipient check</secondary>
64153 </indexterm>
64154 This parameter applies to recipient callouts only. For example:
64155 </para>
64156 <literallayout class="monospaced">
64157 deny  !verify = recipient/callout=use_postmaster
64158 </literallayout>
64159 <para>
64160 <indexterm role="variable">
64161 <primary><varname>$qualify_domain</varname></primary>
64162 </indexterm>
64163 It causes a non-empty postmaster address to be used in the MAIL command when
64164 performing the callout for the recipient, and also for a <quote>random</quote> check if
64165 that is configured. The local part of the address is <literal>postmaster</literal> and the
64166 domain is the contents of <varname>$qualify_domain</varname>.
64167 </para>
64168 </listitem></varlistentry>
64169 <varlistentry>
64170 <term><emphasis role="bold">use_sender</emphasis></term>
64171 <listitem>
64172 <para>
64173 This option applies to recipient callouts only. For example:
64174 </para>
64175 <literallayout class="monospaced">
64176 require  verify = recipient/callout=use_sender
64177 </literallayout>
64178 <para>
64179 It causes the message&#x2019;s actual sender address to be used in the MAIL
64180 command when performing the callout, instead of an empty address. There is no
64181 need to use this option unless you know that the called hosts make use of the
64182 sender when checking recipients. If used indiscriminately, it reduces the
64183 usefulness of callout caching.
64184 </para>
64185 </listitem></varlistentry>
64186 <varlistentry>
64187 <term><emphasis role="bold">hold</emphasis></term>
64188 <listitem>
64189 <para>
64190 This option applies to recipient callouts only. For example:
64191 </para>
64192 <literallayout class="monospaced">
64193 require  verify = recipient/callout=use_sender,hold
64194 </literallayout>
64195 <para>
64196 It causes the connection to be held open and used for any further recipients
64197 and for eventual delivery (should that be done quickly).
64198 Doing this saves on TCP and SMTP startup costs, and TLS costs also
64199 when that is used for the connections.
64200 The advantage is only gained if there are no callout cache hits
64201 (which could be enforced by the no_cache option),
64202 if the use_sender option is used,
64203 if neither the random nor the use_postmaster option is used,
64204 and if no other callouts intervene.
64205 </para>
64206 </listitem></varlistentry>
64207 </variablelist>
64208 <para>
64209 If you use any of the parameters that set a non-empty sender for the MAIL
64210 command (<option>mailfrom</option>, <option>postmaster_mailfrom</option>, <option>use_postmaster</option>, or
64211 <option>use_sender</option>), you should think about possible loops. Recipient checking is
64212 usually done between two hosts that are under the same management, and the host
64213 that receives the callouts is not normally configured to do callouts itself.
64214 Therefore, it is normally safe to use <option>use_postmaster</option> or <option>use_sender</option> in
64215 these circumstances.
64216 </para>
64217 <para>
64218 However, if you use a non-empty sender address for a callout to an arbitrary
64219 host, there is the likelihood that the remote host will itself initiate a
64220 callout check back to your host. As it is checking what appears to be a message
64221 sender, it is likely to use an empty address in MAIL, thus avoiding a
64222 callout loop. However, to be on the safe side it would be best to set up your
64223 own ACLs so that they do not do sender verification checks when the recipient
64224 is the address you use for header sender or postmaster callout checking.
64225 </para>
64226 <para>
64227 Another issue to think about when using non-empty senders for callouts is
64228 caching. When you set <option>mailfrom</option> or <option>use_sender</option>, the cache record is keyed
64229 by the sender/recipient combination; thus, for any given recipient, many more
64230 actual callouts are performed than when an empty sender or postmaster is used.
64231 </para>
64232 </section>
64233 <section id="SECTcallvercache">
64234 <title>Callout caching</title>
64235 <para>
64236 <indexterm role="concept">
64237 <primary>hints database</primary>
64238 <secondary>callout cache</secondary>
64239 </indexterm>
64240 <indexterm role="concept">
64241 <primary>callout</primary>
64242 <secondary>cache, description of</secondary>
64243 </indexterm>
64244 <indexterm role="concept">
64245 <primary>caching</primary>
64246 <secondary>callout</secondary>
64247 </indexterm>
64248 Exim caches the results of callouts in order to reduce the amount of resources
64249 used, unless you specify the <option>no_cache</option> parameter with the <option>callout</option>
64250 option. A hints database called <quote>callout</quote> is used for the cache. Two
64251 different record types are used: one records the result of a callout check for
64252 a specific address, and the other records information that applies to the
64253 entire domain (for example, that it accepts the local part <emphasis>postmaster</emphasis>).
64254 </para>
64255 <para>
64256 When an original callout fails, a detailed SMTP error message is given about
64257 the failure. However, for subsequent failures use the cache data, this message
64258 is not available.
64259 </para>
64260 <para>
64261 The expiry times for negative and positive address cache records are
64262 independent, and can be set by the global options <option>callout_negative_expire</option>
64263 (default 2h) and <option>callout_positive_expire</option> (default 24h), respectively.
64264 </para>
64265 <para>
64266 If a host gives a negative response to an SMTP connection, or rejects any
64267 commands up to and including
64268 </para>
64269 <literallayout class="monospaced">
64270 MAIL FROM:&lt;&gt;
64271 </literallayout>
64272 <para>
64273 (but not including the MAIL command with a non-empty address),
64274 any callout attempt is bound to fail. Exim remembers such failures in a
64275 domain cache record, which it uses to fail callouts for the domain without
64276 making new connections, until the domain record times out. There are two
64277 separate expiry times for domain cache records:
64278 <option>callout_domain_negative_expire</option> (default 3h) and
64279 <option>callout_domain_positive_expire</option> (default 7d).
64280 </para>
64281 <para>
64282 Domain records expire when the negative expiry time is reached if callouts
64283 cannot be made for the domain, or if the postmaster check failed.
64284 Otherwise, they expire when the positive expiry time is reached. This
64285 ensures that, for example, a host that stops accepting <quote>random</quote> local parts
64286 will eventually be noticed.
64287 </para>
64288 <para>
64289 The callout caching mechanism is based on the domain of the address that is
64290 being tested. If the domain routes to several hosts, it is assumed that their
64291 behaviour will be the same.
64292 </para>
64293 </section>
64294 <section id="SECTquotacache">
64295 <title>Quota caching</title>
64296 <para>
64297 <indexterm role="concept">
64298 <primary>hints database</primary>
64299 <secondary>quota cache</secondary>
64300 </indexterm>
64301 <indexterm role="concept">
64302 <primary>quota</primary>
64303 <secondary>cache, description of</secondary>
64304 </indexterm>
64305 <indexterm role="concept">
64306 <primary>caching</primary>
64307 <secondary>quota</secondary>
64308 </indexterm>
64309 Exim caches the results of quota verification
64310 in order to reduce the amount of resources used.
64311 The <quote>callout</quote> hints database is used.
64312 </para>
64313 <para>
64314 The default cache periods are five minutes for a positive (good) result
64315 and one hour for a negative result.
64316 To change the periods the <option>quota</option> option can be followed by an equals sign
64317 and a number of optional paramemters, separated by commas.
64318 For example:
64319 </para>
64320 <literallayout class="monospaced">
64321 verify = recipient/quota=cachepos=1h,cacheneg=1d
64322 </literallayout>
64323 <para>
64324 Possible parameters are:
64325 </para>
64326 <variablelist>
64327 <varlistentry>
64328 <term><emphasis role="bold">cachepos&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
64329 <listitem>
64330 <para>
64331 <indexterm role="concept">
64332 <primary>quota cache</primary>
64333 <secondary>positive entry expiry, specifying</secondary>
64334 </indexterm>
64335 Set the lifetime for a positive cache entry.
64336 A value of zero seconds is legitimate.
64337 </para>
64338 </listitem></varlistentry>
64339 <varlistentry>
64340 <term><emphasis role="bold">cacheneg&nbsp;=&nbsp;</emphasis>&lt;<emphasis>time&nbsp;interval</emphasis>&gt;</term>
64341 <listitem>
64342 <para>
64343 <indexterm role="concept">
64344 <primary>quota cache</primary>
64345 <secondary>negative entry expiry, specifying</secondary>
64346 </indexterm>
64347 As above, for a negative entry.
64348 </para>
64349 </listitem></varlistentry>
64350 <varlistentry>
64351 <term><emphasis role="bold">no_cache</emphasis></term>
64352 <listitem>
64353 <para>
64354 Set both positive and negative lifetimes to zero.
64355 </para>
64356 </listitem></varlistentry>
64357 </variablelist>
64358 </section>
64359 <section id="SECTsenaddver">
64360 <title>Sender address verification reporting</title>
64361 <para>
64362 <indexterm role="concept">
64363 <primary>verifying</primary>
64364 <secondary>suppressing error details</secondary>
64365 </indexterm>
64366 See section <xref linkend="SECTaddressverification"/> for a general discussion of
64367 verification. When sender verification fails in an ACL, the details of the
64368 failure are given as additional output lines before the 550 response to the
64369 relevant SMTP command (RCPT or DATA). For example, if sender callout is in use,
64370 you might see:
64371 </para>
64372 <literallayout class="monospaced">
64373 MAIL FROM:&lt;xyz@abc.example&gt;
64374 250 OK
64375 RCPT TO:&lt;pqr@def.example&gt;
64376 550-Verification failed for &lt;xyz@abc.example&gt;
64377 550-Called:   192.168.34.43
64378 550-Sent:     RCPT TO:&lt;xyz@abc.example&gt;
64379 550-Response: 550 Unknown local part xyz in &lt;xyz@abc.example&gt;
64380 550 Sender verification failed
64381 </literallayout>
64382 <para>
64383 If more than one RCPT command fails in the same way, the details are given
64384 only for the first of them. However, some administrators do not want to send
64385 out this much information. You can suppress the details by adding
64386 <literal>/no_details</literal> to the ACL statement that requests sender verification. For
64387 example:
64388 </para>
64389 <literallayout class="monospaced">
64390 verify = sender/no_details
64391 </literallayout>
64392 </section>
64393 <section id="SECTredirwhilveri">
64394 <title>Redirection while verifying</title>
64395 <para>
64396 <indexterm role="concept">
64397 <primary>verifying</primary>
64398 <secondary>redirection while</secondary>
64399 </indexterm>
64400 <indexterm role="concept">
64401 <primary>address redirection</primary>
64402 <secondary>while verifying</secondary>
64403 </indexterm>
64404 A dilemma arises when a local address is redirected by aliasing or forwarding
64405 during verification: should the generated addresses themselves be verified,
64406 or should the successful expansion of the original address be enough to verify
64407 it? By default, Exim takes the following pragmatic approach:
64408 </para>
64409 <itemizedlist>
64410 <listitem>
64411 <para>
64412 When an incoming address is redirected to just one child address, verification
64413 continues with the child address, and if that fails to verify, the original
64414 verification also fails.
64415 </para>
64416 </listitem>
64417 <listitem>
64418 <para>
64419 When an incoming address is redirected to more than one child address,
64420 verification does not continue. A success result is returned.
64421 </para>
64422 </listitem>
64423 </itemizedlist>
64424 <para>
64425 This seems the most reasonable behaviour for the common use of aliasing as a
64426 way of redirecting different local parts to the same mailbox. It means, for
64427 example, that a pair of alias entries of the form
64428 </para>
64429 <literallayout class="monospaced">
64430 A.Wol:   aw123
64431 aw123:   :fail: Gone away, no forwarding address
64432 </literallayout>
64433 <para>
64434 work as expected, with both local parts causing verification failure. When a
64435 redirection generates more than one address, the behaviour is more like a
64436 mailing list, where the existence of the alias itself is sufficient for
64437 verification to succeed.
64438 </para>
64439 <para>
64440 It is possible, however, to change the default behaviour so that all successful
64441 redirections count as successful verifications, however many new addresses are
64442 generated. This is specified by the <option>success_on_redirect</option> verification
64443 option. For example:
64444 </para>
64445 <literallayout class="monospaced">
64446 require verify = recipient/success_on_redirect/callout=10s
64447 </literallayout>
64448 <para>
64449 In this example, verification succeeds if a router generates a new address, and
64450 the callout does not occur, because no address was routed to a remote host.
64451 </para>
64452 <para>
64453 When verification is being tested via the <option>-bv</option> option, the treatment of
64454 redirections is as just described, unless the <option>-v</option> or any debugging option is
64455 also specified. In that case, full verification is done for every generated
64456 address and a report is output for each of them.
64457 </para>
64458 </section>
64459 <section id="SECTverifyCSA">
64460 <title>Client SMTP authorization (CSA)</title>
64461 <para>
64462 <indexterm role="concept">
64463 <primary>CSA</primary>
64464 <secondary>verifying</secondary>
64465 </indexterm>
64466 Client SMTP Authorization is a system that allows a site to advertise
64467 which machines are and are not permitted to send email. This is done by placing
64468 special SRV records in the DNS; these are looked up using the client&#x2019;s HELO
64469 domain. At the time of writing, CSA is still an Internet Draft. Client SMTP
64470 Authorization checks in Exim are performed by the ACL condition:
64471 </para>
64472 <literallayout class="monospaced">
64473 verify = csa
64474 </literallayout>
64475 <para>
64476 This fails if the client is not authorized. If there is a DNS problem, or if no
64477 valid CSA SRV record is found, or if the client is authorized, the condition
64478 succeeds. These three cases can be distinguished using the expansion variable
64479 <varname>$csa_status</varname>, which can take one of the values <quote>fail</quote>, <quote>defer</quote>,
64480 <quote>unknown</quote>, or <quote>ok</quote>. The condition does not itself defer because that would
64481 be likely to cause problems for legitimate email.
64482 </para>
64483 <para>
64484 The error messages produced by the CSA code include slightly more
64485 detail. If <varname>$csa_status</varname> is <quote>defer</quote>, this may be because of problems
64486 looking up the CSA SRV record, or problems looking up the CSA target
64487 address record. There are four reasons for <varname>$csa_status</varname> being <quote>fail</quote>:
64488 </para>
64489 <itemizedlist>
64490 <listitem>
64491 <para>
64492 The client&#x2019;s host name is explicitly not authorized.
64493 </para>
64494 </listitem>
64495 <listitem>
64496 <para>
64497 The client&#x2019;s IP address does not match any of the CSA target IP addresses.
64498 </para>
64499 </listitem>
64500 <listitem>
64501 <para>
64502 The client&#x2019;s host name is authorized but it has no valid target IP addresses
64503 (for example, the target&#x2019;s addresses are IPv6 and the client is using IPv4).
64504 </para>
64505 </listitem>
64506 <listitem>
64507 <para>
64508 The client&#x2019;s host name has no CSA SRV record but a parent domain has asserted
64509 that all subdomains must be explicitly authorized.
64510 </para>
64511 </listitem>
64512 </itemizedlist>
64513 <para>
64514 The <option>csa</option> verification condition can take an argument which is the domain to
64515 use for the DNS query. The default is:
64516 </para>
64517 <literallayout class="monospaced">
64518 verify = csa/$sender_helo_name
64519 </literallayout>
64520 <para>
64521 This implementation includes an extension to CSA. If the query domain
64522 is an address literal such as [192.0.2.95], or if it is a bare IP
64523 address, Exim searches for CSA SRV records in the reverse DNS as if
64524 the HELO domain was (for example) <emphasis>95.2.0.192.in-addr.arpa</emphasis>. Therefore it is
64525 meaningful to say:
64526 </para>
64527 <literallayout class="monospaced">
64528 verify = csa/$sender_host_address
64529 </literallayout>
64530 <para>
64531 In fact, this is the check that Exim performs if the client does not say HELO.
64532 This extension can be turned off by setting the main configuration option
64533 <option>dns_csa_use_reverse</option> to be false.
64534 </para>
64535 <para>
64536 If a CSA SRV record is not found for the domain itself, a search
64537 is performed through its parent domains for a record which might be
64538 making assertions about subdomains. The maximum depth of this search is limited
64539 using the main configuration option <option>dns_csa_search_limit</option>, which is 5 by
64540 default. Exim does not look for CSA SRV records in a top level domain, so the
64541 default settings handle HELO domains as long as seven
64542 (<emphasis>hostname.five.four.three.two.one.com</emphasis>). This encompasses the vast majority
64543 of legitimate HELO domains.
64544 </para>
64545 <para>
64546 The <emphasis>dnsdb</emphasis> lookup also has support for CSA. Although <emphasis>dnsdb</emphasis> also supports
64547 direct SRV lookups, this is not sufficient because of the extra parent domain
64548 search behaviour of CSA, and (as with PTR lookups) <emphasis>dnsdb</emphasis> also turns IP
64549 addresses into lookups in the reverse DNS space. The result of a successful
64550 lookup such as:
64551 </para>
64552 <literallayout class="monospaced">
64553 ${lookup dnsdb {csa=$sender_helo_name}}
64554 </literallayout>
64555 <para>
64556 has two space-separated fields: an authorization code and a target host name.
64557 The authorization code can be <quote>Y</quote> for yes, <quote>N</quote> for no, <quote>X</quote> for explicit
64558 authorization required but absent, or <quote>?</quote> for unknown.
64559 </para>
64560 </section>
64561 <section id="SECTverifyPRVS">
64562 <title>Bounce address tag validation</title>
64563 <para>
64564 <indexterm role="concept">
64565 <primary>BATV, verifying</primary>
64566 </indexterm>
64567 Bounce address tag validation (BATV) is a scheme whereby the envelope senders
64568 of outgoing messages have a cryptographic, timestamped <quote>tag</quote> added to them.
64569 Genuine incoming bounce messages should therefore always be addressed to
64570 recipients that have a valid tag. This scheme is a way of detecting unwanted
64571 bounce messages caused by sender address forgeries (often called <quote>collateral
64572 spam</quote>), because the recipients of such messages do not include valid tags.
64573 </para>
64574 <para>
64575 There are two expansion items to help with the implementation of the BATV
64576 <quote>prvs</quote> (private signature) scheme in an Exim configuration. This scheme signs
64577 the original envelope sender address by using a simple key to add a hash of the
64578 address and some time-based randomizing information. The <option>prvs</option> expansion
64579 item creates a signed address, and the <option>prvscheck</option> expansion item checks one.
64580 The syntax of these expansion items is described in section
64581 <xref linkend="SECTexpansionitems"/>.
64582 The validity period on signed addresses is seven days.
64583 </para>
64584 <para>
64585 As an example, suppose the secret per-address keys are stored in an MySQL
64586 database. A query to look up the key for an address could be defined as a macro
64587 like this:
64588 </para>
64589 <literallayout class="monospaced">
64590 PRVSCHECK_SQL = ${lookup mysql{SELECT secret FROM batv_prvs \
64591                 WHERE sender='${quote_mysql:$prvscheck_address}'\
64592                 }{$value}}
64593 </literallayout>
64594 <para>
64595 Suppose also that the senders who make use of BATV are defined by an address
64596 list called <option>batv_senders</option>. Then, in the ACL for RCPT commands, you could
64597 use this:
64598 </para>
64599 <literallayout class="monospaced">
64600 # Bounces: drop unsigned addresses for BATV senders
64601 deny senders = :
64602      recipients = +batv_senders
64603      message = This address does not send an unsigned reverse path
64604
64605 # Bounces: In case of prvs-signed address, check signature.
64606 deny senders = :
64607      condition  = ${prvscheck {$local_part@$domain}\
64608                   {PRVSCHECK_SQL}{1}}
64609      !condition = $prvscheck_result
64610      message = Invalid reverse path signature.
64611 </literallayout>
64612 <para>
64613 The first statement rejects recipients for bounce messages that are addressed
64614 to plain BATV sender addresses, because it is known that BATV senders do not
64615 send out messages with plain sender addresses. The second statement rejects
64616 recipients that are prvs-signed, but with invalid signatures (either because
64617 the key is wrong, or the signature has timed out).
64618 </para>
64619 <para>
64620 A non-prvs-signed address is not rejected by the second statement, because the
64621 <option>prvscheck</option> expansion yields an empty string if its first argument is not a
64622 prvs-signed address, thus causing the <option>condition</option> condition to be false. If
64623 the first argument is a syntactically valid prvs-signed address, the yield is
64624 the third string (in this case <quote>1</quote>), whether or not the cryptographic and
64625 timeout checks succeed. The <varname>$prvscheck_result</varname> variable contains the result
64626 of the checks (empty for failure, <quote>1</quote> for success).
64627 </para>
64628 <para>
64629 There is one more issue you must consider when implementing prvs-signing:
64630 you have to ensure that the routers accept prvs-signed addresses and
64631 deliver them correctly. The easiest way to handle this is to use a <command>redirect</command>
64632 router to remove the signature with a configuration along these lines:
64633 </para>
64634 <literallayout class="monospaced">
64635 batv_redirect:
64636   driver = redirect
64637   data = ${prvscheck {$local_part@$domain}{PRVSCHECK_SQL}}
64638 </literallayout>
64639 <para>
64640 This works because, if the third argument of <option>prvscheck</option> is empty, the result
64641 of the expansion of a prvs-signed address is the decoded value of the original
64642 address. This router should probably be the first of your routers that handles
64643 local addresses.
64644 </para>
64645 <para>
64646 To create BATV-signed addresses in the first place, a transport of this form
64647 can be used:
64648 </para>
64649 <literallayout class="monospaced">
64650 external_smtp_batv:
64651   driver = smtp
64652   return_path = ${prvs {$return_path} \
64653                        {${lookup mysql{SELECT \
64654                        secret FROM batv_prvs WHERE \
64655                        sender='${quote_mysql:$sender_address}'} \
64656                        {$value}fail}}}
64657 </literallayout>
64658 <para>
64659 If no key can be found for the existing return path, no signing takes place.
64660 </para>
64661 </section>
64662 <section id="SECTrelaycontrol">
64663 <title>Using an ACL to control relaying</title>
64664 <para>
64665 <indexterm role="concept">
64666 <primary>access control lists (ACLs)</primary>
64667 <secondary>relay control</secondary>
64668 </indexterm>
64669 <indexterm role="concept">
64670 <primary>relaying</primary>
64671 <secondary>control by ACL</secondary>
64672 </indexterm>
64673 <indexterm role="concept">
64674 <primary>policy control</primary>
64675 <secondary>relay control</secondary>
64676 </indexterm>
64677 An MTA is said to <emphasis>relay</emphasis> a message if it receives it from some host and
64678 delivers it directly to another host as a result of a remote address contained
64679 within it. Redirecting a local address via an alias or forward file and then
64680 passing the message on to another host is not relaying,
64681 <indexterm role="concept">
64682 <primary><quote>percent hack</quote></primary>
64683 </indexterm>
64684 but a redirection as a result of the <quote>percent hack</quote> is.
64685 </para>
64686 <para>
64687 Two kinds of relaying exist, which are termed <quote>incoming</quote> and <quote>outgoing</quote>.
64688 A host which is acting as a gateway or an MX backup is concerned with incoming
64689 relaying from arbitrary hosts to a specific set of domains. On the other hand,
64690 a host which is acting as a smart host for a number of clients is concerned
64691 with outgoing relaying from those clients to the Internet at large. Often the
64692 same host is fulfilling both functions,
64693 but in principle these two kinds of relaying are entirely independent. What is
64694 not wanted is the transmission of mail from arbitrary remote hosts through your
64695 system to arbitrary domains.
64696 </para>
64697 <para>
64698 You can implement relay control by means of suitable statements in the ACL that
64699 runs for each RCPT command. For convenience, it is often easiest to use
64700 Exim&#x2019;s named list facility to define the domains and hosts involved. For
64701 example, suppose you want to do the following:
64702 </para>
64703 <itemizedlist>
64704 <listitem>
64705 <para>
64706 Deliver a number of domains to mailboxes on the local host (or process them
64707 locally in some other way). Let&#x2019;s say these are <emphasis>my.dom1.example</emphasis> and
64708 <emphasis>my.dom2.example</emphasis>.
64709 </para>
64710 </listitem>
64711 <listitem>
64712 <para>
64713 Relay mail for a number of other domains for which you are the secondary MX.
64714 These might be <emphasis>friend1.example</emphasis> and <emphasis>friend2.example</emphasis>.
64715 </para>
64716 </listitem>
64717 <listitem>
64718 <para>
64719 Relay mail from the hosts on your local LAN, to whatever domains are involved.
64720 Suppose your LAN is 192.168.45.0/24.
64721 </para>
64722 </listitem>
64723 </itemizedlist>
64724 <para>
64725 In the main part of the configuration, you put the following definitions:
64726 </para>
64727 <literallayout class="monospaced">
64728 domainlist local_domains    = my.dom1.example : my.dom2.example
64729 domainlist relay_to_domains = friend1.example : friend2.example
64730 hostlist   relay_from_hosts = 192.168.45.0/24
64731 </literallayout>
64732 <para>
64733 Now you can use these definitions in the ACL that is run for every RCPT
64734 command:
64735 </para>
64736 <literallayout class="monospaced">
64737 acl_check_rcpt:
64738   accept domains = +local_domains : +relay_to_domains
64739   accept hosts   = +relay_from_hosts
64740 </literallayout>
64741 <para>
64742 The first statement accepts any RCPT command that contains an address in
64743 the local or relay domains. For any other domain, control passes to the second
64744 statement, which accepts the command only if it comes from one of the relay
64745 hosts. In practice, you will probably want to make your ACL more sophisticated
64746 than this, for example, by including sender and recipient verification. The
64747 default configuration includes a more comprehensive example, which is described
64748 in chapter <xref linkend="CHAPdefconfil"/>.
64749 </para>
64750 </section>
64751 <section id="SECTcheralcon">
64752 <title>Checking a relay configuration</title>
64753 <para>
64754 <indexterm role="concept">
64755 <primary>relaying</primary>
64756 <secondary>checking control of</secondary>
64757 </indexterm>
64758 You can check the relay characteristics of your configuration in the same way
64759 that you can test any ACL behaviour for an incoming SMTP connection, by using
64760 the <option>-bh</option> option to run a fake SMTP session with which you interact.
64761 <indexterm role="concept" startref="IIDacl" class="endofrange"/>
64762 </para>
64763 </section>
64764 </chapter>
64765
64766 <chapter id="CHAPexiscan">
64767 <title>Content scanning at ACL time</title>
64768 <para>
64769 <indexterm role="concept" id="IIDcosca" class="startofrange">
64770 <primary>content scanning</primary>
64771 <secondary>at ACL time</secondary>
64772 </indexterm>
64773 The extension of Exim to include content scanning at ACL time, formerly known
64774 as <quote>exiscan</quote>, was originally implemented as a patch by Tom Kistner. The code
64775 was integrated into the main source for Exim release 4.50, and Tom continues to
64776 maintain it. Most of the wording of this chapter is taken from Tom&#x2019;s
64777 specification.
64778 </para>
64779 <para>
64780 It is also possible to scan the content of messages at other times. The
64781 <function>local_scan()</function> function (see chapter <xref linkend="CHAPlocalscan"/>) allows for content
64782 scanning after all the ACLs have run. A transport filter can be used to scan
64783 messages at delivery time (see the <option>transport_filter</option> option, described in
64784 chapter <xref linkend="CHAPtransportgeneric"/>).
64785 </para>
64786 <para>
64787 If you want to include the ACL-time content-scanning features when you compile
64788 Exim, you need to arrange for WITH_CONTENT_SCAN to be defined in your
64789 <filename>Local/Makefile</filename>. When you do that, the Exim binary is built with:
64790 </para>
64791 <itemizedlist>
64792 <listitem>
64793 <para>
64794 Two additional ACLs (<option>acl_smtp_mime</option> and <option>acl_not_smtp_mime</option>) that are run
64795 for all MIME parts for SMTP and non-SMTP messages, respectively.
64796 </para>
64797 </listitem>
64798 <listitem>
64799 <para>
64800 Additional ACL conditions and modifiers: <option>decode</option>, <option>malware</option>,
64801 <option>mime_regex</option>, <option>regex</option>, and <option>spam</option>. These can be used in the ACL that is
64802 run at the end of message reception (the <option>acl_smtp_data</option> ACL).
64803 </para>
64804 </listitem>
64805 <listitem>
64806 <para>
64807 An additional control feature (<quote>no_mbox_unspool</quote>) that saves spooled copies
64808 of messages, or parts of messages, for debugging purposes.
64809 </para>
64810 </listitem>
64811 <listitem>
64812 <para>
64813 Additional expansion variables that are set in the new ACL and by the new
64814 conditions.
64815 </para>
64816 </listitem>
64817 <listitem>
64818 <para>
64819 Two new main configuration options: <option>av_scanner</option> and <option>spamd_address</option>.
64820 </para>
64821 </listitem>
64822 </itemizedlist>
64823 <para>
64824 Content-scanning is continually evolving, and new features are still being
64825 added. While such features are still unstable and liable to incompatible
64826 changes, they are made available in Exim by setting options whose names begin
64827 EXPERIMENTAL_ in <filename>Local/Makefile</filename>. Such features are not documented in
64828 this manual. You can find out about them by reading the file called
64829 <filename>doc/experimental.txt</filename>.
64830 </para>
64831 <para>
64832 All the content-scanning facilities work on a MBOX copy of the message that is
64833 temporarily created in a file called:
64834 </para>
64835 <literallayout>
64836 &lt;<emphasis>spool_directory</emphasis>&gt;<literal>/scan/</literal>&lt;<emphasis>message_id</emphasis>&gt;/&lt;<emphasis>message_id</emphasis>&gt;<literal>.eml</literal>
64837 </literallayout>
64838 <para>
64839 The <filename>.eml</filename> extension is a friendly hint to virus scanners that they can
64840 expect an MBOX-like structure inside that file. The file is created when the
64841 first content scanning facility is called. Subsequent calls to content
64842 scanning conditions open the same file again. The directory is recursively
64843 removed when the <option>acl_smtp_data</option> ACL has finished running, unless
64844 </para>
64845 <literallayout class="monospaced">
64846 control = no_mbox_unspool
64847 </literallayout>
64848 <para>
64849 has been encountered. When the MIME ACL decodes files, they are put into the
64850 same directory by default.
64851 </para>
64852 <section id="SECTscanvirus">
64853 <title>Scanning for viruses</title>
64854 <para>
64855 <indexterm role="concept">
64856 <primary>virus scanning</primary>
64857 </indexterm>
64858 <indexterm role="concept">
64859 <primary>content scanning</primary>
64860 <secondary>for viruses</secondary>
64861 </indexterm>
64862 <indexterm role="concept">
64863 <primary>content scanning</primary>
64864 <secondary>the <option>malware</option> condition</secondary>
64865 </indexterm>
64866 The <option>malware</option> ACL condition lets you connect virus scanner software to Exim.
64867 It supports a <quote>generic</quote> interface to scanners called via the shell, and
64868 specialized interfaces for <quote>daemon</quote> type virus scanners, which are resident
64869 in memory and thus are much faster.
64870 </para>
64871 <para>
64872 Since message data needs to have arrived,
64873 the condition may be only called in ACL defined by
64874 <option>acl_smtp_data</option>,
64875 <option>acl_smtp_data_prdr</option>,
64876 <option>acl_smtp_mime</option> or
64877 <option>acl_smtp_dkim</option>
64878 </para>
64879 <para>
64880 A timeout of 2 minutes is applied to a scanner call (by default);
64881 if it expires then a defer action is taken.
64882 </para>
64883 <para>
64884 <indexterm role="option">
64885 <primary><option>av_scanner</option></primary>
64886 </indexterm>
64887 You can set the <option>av_scanner</option> option in the main part of the configuration
64888 to specify which scanner to use, together with any additional options that
64889 are needed. The basic syntax is as follows:
64890 </para>
64891 <literallayout>
64892 <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>
64893 </literallayout>
64894 <para>
64895 If you do not set <option>av_scanner</option>, it defaults to
64896 </para>
64897 <literallayout class="monospaced">
64898 av_scanner = sophie:/var/run/sophie
64899 </literallayout>
64900 <para>
64901 If the value of <option>av_scanner</option> starts with a dollar character, it is expanded
64902 before use.
64903 The usual list-parsing of the content (see <xref linkend="SECTlistconstruct"/>) applies.
64904 The following scanner types are supported in this release,
64905 though individual ones can be included or not at build time:
64906 </para>
64907 <variablelist>
64908 <varlistentry>
64909 <term><option>avast</option></term>
64910 <listitem>
64911 <para>
64912 <indexterm role="concept">
64913 <primary>virus scanners</primary>
64914 <secondary>avast</secondary>
64915 </indexterm>
64916 This is the scanner daemon of Avast. It has been tested with Avast Core
64917 Security (currently at version 2.2.0).
64918 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
64919 at <emphasis role="bold"><ulink url="https://www.avast.com/linux-server-antivirus">https://www.avast.com/linux-server-antivirus</ulink></emphasis>.
64920 This scanner type takes one option,
64921 which can be either a full path to a UNIX socket,
64922 or host and port specifiers separated by white space.
64923 The host may be a name or an IP address; the port is either a
64924 single number or a pair of numbers with a dash between.
64925 A list of options may follow. These options are interpreted on the
64926 Exim&#x2019;s side of the malware scanner, or are given on separate lines to
64927 the daemon as options before the main scan command.
64928 </para>
64929 <para>
64930 <indexterm role="concept">
64931 <primary><literal>pass_unscanned</literal></primary>
64932 <secondary>avast</secondary>
64933 </indexterm>
64934 If <literal>pass_unscanned</literal>
64935 is set, any files the Avast scanner can&#x2019;t scan (e.g.
64936 decompression bombs, or invalid archives) are considered clean. Use with
64937 care.
64938 </para>
64939 <para>
64940 For example:
64941 </para>
64942 <literallayout class="monospaced">
64943 av_scanner = avast:/var/run/avast/scan.sock:FLAGS -fullfiles:SENSITIVITY -pup
64944 av_scanner = avast:/var/run/avast/scan.sock:pass_unscanned:FLAGS -fullfiles:SENSITIVITY -pup
64945 av_scanner = avast:192.168.2.22 5036
64946 </literallayout>
64947 <para>
64948 If you omit the argument, the default path
64949 <filename>/var/run/avast/scan.sock</filename>
64950 is used.
64951 If you use a remote host,
64952 you need to make Exim&#x2019;s spool directory available to it,
64953 as the scanner is passed a file path, not file contents.
64954 For information about available commands and their options you may use
64955 </para>
64956 <literallayout class="monospaced">
64957 $ socat UNIX:/var/run/avast/scan.sock STDIO:
64958     FLAGS
64959     SENSITIVITY
64960     PACK
64961 </literallayout>
64962 <para>
64963 If the scanner returns a temporary failure (e.g. license issues, or
64964 permission problems), the message is deferred and a paniclog entry is
64965 written.  The usual <literal>defer_ok</literal> option is available.
64966 </para>
64967 </listitem></varlistentry>
64968 <varlistentry>
64969 <term><option>aveserver</option></term>
64970 <listitem>
64971 <para>
64972 <indexterm role="concept">
64973 <primary>virus scanners</primary>
64974 <secondary>Kaspersky</secondary>
64975 </indexterm>
64976 This is the scanner daemon of Kaspersky Version 5. You can get a trial version
64977 at <emphasis role="bold"><ulink url="https://www.kaspersky.com/">https://www.kaspersky.com/</ulink></emphasis>. This scanner type takes one option,
64978 which is the path to the daemon&#x2019;s UNIX socket. The default is shown in this
64979 example:
64980 </para>
64981 <literallayout class="monospaced">
64982 av_scanner = aveserver:/var/run/aveserver
64983 </literallayout>
64984 </listitem></varlistentry>
64985 <varlistentry>
64986 <term><option>clamd</option></term>
64987 <listitem>
64988 <para>
64989 <indexterm role="concept">
64990 <primary>virus scanners</primary>
64991 <secondary>clamd</secondary>
64992 </indexterm>
64993 This daemon-type scanner is GPL and free. You can get it at
64994 <emphasis role="bold"><ulink url="https://www.clamav.net/">https://www.clamav.net/</ulink></emphasis>. Some older versions of clamd do not seem to
64995 unpack MIME containers, so it used to be recommended to unpack MIME attachments
64996 in the MIME ACL. This is no longer believed to be necessary.
64997 </para>
64998 <para>
64999 The options are a list of server specifiers, which may be
65000 a UNIX socket specification,
65001 a TCP socket specification,
65002 or a (global) option.
65003 </para>
65004 <para>
65005 A socket specification consists of a space-separated list.
65006 For a Unix socket the first element is a full path for the socket,
65007 for a TCP socket the first element is the IP address
65008 and the second a port number,
65009 Any further elements are per-server (non-global) options.
65010 These per-server options are supported:
65011 </para>
65012 <literallayout class="monospaced">
65013 retry=&lt;timespec&gt;  Retry on connect fail
65014 </literallayout>
65015 <para>
65016 The <literal>retry</literal> option specifies a time after which a single retry for
65017 a failed connect is made.  The default is to not retry.
65018 </para>
65019 <para>
65020 If a Unix socket file is specified, only one server is supported.
65021 </para>
65022 <para>
65023 Examples:
65024 </para>
65025 <literallayout class="monospaced">
65026 av_scanner = clamd:/opt/clamd/socket
65027 av_scanner = clamd:192.0.2.3 1234
65028 av_scanner = clamd:192.0.2.3 1234:local
65029 av_scanner = clamd:192.0.2.3 1234 retry=10s
65030 av_scanner = clamd:192.0.2.3 1234 : 192.0.2.4 1234
65031 </literallayout>
65032 <para>
65033 If the value of av_scanner points to a UNIX socket file or contains the
65034 <literal>local</literal>
65035 option, then the ClamAV interface will pass a filename containing the data
65036 to be scanned, which should normally result in less I/O happening and be
65037 more efficient.  Normally in the TCP case, the data is streamed to ClamAV as
65038 Exim does not assume that there is a common filesystem with the remote host.
65039 </para>
65040 <para>
65041 The final example shows that multiple TCP targets can be specified.  Exim will
65042 randomly use one for each incoming email (i.e. it load balances them).  Note
65043 that only TCP targets may be used if specifying a list of scanners; a UNIX
65044 socket cannot be mixed in with TCP targets.  If one of the servers becomes
65045 unavailable, Exim will try the remaining one(s) until it finds one that works.
65046 When a clamd server becomes unreachable, Exim will log a message.  Exim does
65047 not keep track of scanner state between multiple messages, and the scanner
65048 selection is random, so the message will get logged in the mainlog for each
65049 email that the down scanner gets chosen first (message wrapped to be readable):
65050 </para>
65051 <literallayout class="monospaced">
65052 2013-10-09 14:30:39 1VTumd-0000Y8-BQ malware acl condition:
65053    clamd: connection to localhost, port 3310 failed
65054    (Connection refused)
65055 </literallayout>
65056 <para>
65057 If the option is unset, the default is <filename>/tmp/clamd</filename>. Thanks to David Saez for
65058 contributing the code for this scanner.
65059 </para>
65060 </listitem></varlistentry>
65061 <varlistentry>
65062 <term><option>cmdline</option></term>
65063 <listitem>
65064 <para>
65065 <indexterm role="concept">
65066 <primary>virus scanners</primary>
65067 <secondary>command line interface</secondary>
65068 </indexterm>
65069 This is the keyword for the generic command line scanner interface. It can be
65070 used to attach virus scanners that are invoked from the shell. This scanner
65071 type takes 3 mandatory options:
65072 </para>
65073 <orderedlist numeration="arabic">
65074 <listitem>
65075 <para>
65076 The full path and name of the scanner binary, with all command line options,
65077 and a placeholder (<literal>%s</literal>) for the directory to scan.
65078 </para>
65079 </listitem>
65080 <listitem>
65081 <para>
65082 A regular expression to match against the STDOUT and STDERR output of the
65083 virus scanner. If the expression matches, a virus was found. You must make
65084 absolutely sure that this expression matches on <quote>virus found</quote>. This is called
65085 the <quote>trigger</quote> expression.
65086 </para>
65087 </listitem>
65088 <listitem>
65089 <para>
65090 Another regular expression, containing exactly one pair of parentheses, to
65091 match the name of the virus found in the scanners output. This is called the
65092 <quote>name</quote> expression.
65093 </para>
65094 </listitem>
65095 </orderedlist>
65096 <para>
65097 For example, Sophos Sweep reports a virus on a line like this:
65098 </para>
65099 <literallayout class="monospaced">
65100 Virus 'W32/Magistr-B' found in file ./those.bat
65101 </literallayout>
65102 <para>
65103 For the trigger expression, we can match the phrase <quote>found in file</quote>. For the
65104 name expression, we want to extract the W32/Magistr-B string, so we can match
65105 for the single quotes left and right of it. Altogether, this makes the
65106 configuration setting:
65107 </para>
65108 <literallayout class="monospaced">
65109 av_scanner = cmdline:\
65110              /path/to/sweep -ss -all -rec -archive %s:\
65111              found in file:'(.+)'
65112 </literallayout>
65113 </listitem></varlistentry>
65114 <varlistentry>
65115 <term><option>drweb</option></term>
65116 <listitem>
65117 <para>
65118 <indexterm role="concept">
65119 <primary>virus scanners</primary>
65120 <secondary>DrWeb</secondary>
65121 </indexterm>
65122 The DrWeb daemon scanner (<emphasis role="bold"><ulink url="https://www.sald.ru/">https://www.sald.ru/</ulink></emphasis>) interface
65123 takes one option,
65124 either a full path to a UNIX socket,
65125 or host and port specifiers separated by white space.
65126 The host may be a name or an IP address; the port is either a
65127 single number or a pair of numbers with a dash between.
65128 For example:
65129 </para>
65130 <literallayout class="monospaced">
65131 av_scanner = drweb:/var/run/drwebd.sock
65132 av_scanner = drweb:192.168.2.20 31337
65133 </literallayout>
65134 <para>
65135 If you omit the argument, the default path <filename>/usr/local/drweb/run/drwebd.sock</filename>
65136 is used. Thanks to Alex Miller for contributing the code for this scanner.
65137 </para>
65138 </listitem></varlistentry>
65139 <varlistentry>
65140 <term><option>f-protd</option></term>
65141 <listitem>
65142 <para>
65143 <indexterm role="concept">
65144 <primary>virus scanners</primary>
65145 <secondary>f-protd</secondary>
65146 </indexterm>
65147 The f-protd scanner is accessed via HTTP over TCP.
65148 One argument is taken, being a space-separated hostname and port number
65149 (or port-range).
65150 For example:
65151 </para>
65152 <literallayout class="monospaced">
65153 av_scanner = f-protd:localhost 10200-10204
65154 </literallayout>
65155 <para>
65156 If you omit the argument, the default values shown above are used.
65157 </para>
65158 </listitem></varlistentry>
65159 <varlistentry>
65160 <term><option>f-prot6d</option></term>
65161 <listitem>
65162 <para>
65163 <indexterm role="concept">
65164 <primary>virus scanners</primary>
65165 <secondary>f-prot6d</secondary>
65166 </indexterm>
65167 The f-prot6d scanner is accessed using the FPSCAND protocol over TCP.
65168 One argument is taken, being a space-separated hostname and port number.
65169 For example:
65170 </para>
65171 <literallayout class="monospaced">
65172 av_scanner = f-prot6d:localhost 10200
65173 </literallayout>
65174 <para>
65175 If you omit the argument, the default values show above are used.
65176 </para>
65177 </listitem></varlistentry>
65178 <varlistentry>
65179 <term><option>fsecure</option></term>
65180 <listitem>
65181 <para>
65182 <indexterm role="concept">
65183 <primary>virus scanners</primary>
65184 <secondary>F-Secure</secondary>
65185 </indexterm>
65186 The F-Secure daemon scanner (<emphasis role="bold"><ulink url="https://www.f-secure.com/">https://www.f-secure.com/</ulink></emphasis>) takes one
65187 argument which is the path to a UNIX socket. For example:
65188 </para>
65189 <literallayout class="monospaced">
65190 av_scanner = fsecure:/path/to/.fsav
65191 </literallayout>
65192 <para>
65193 If no argument is given, the default is <filename>/var/run/.fsav</filename>. Thanks to Johan
65194 Thelmen for contributing the code for this scanner.
65195 </para>
65196 </listitem></varlistentry>
65197 <varlistentry>
65198 <term><option>kavdaemon</option></term>
65199 <listitem>
65200 <para>
65201 <indexterm role="concept">
65202 <primary>virus scanners</primary>
65203 <secondary>Kaspersky</secondary>
65204 </indexterm>
65205 This is the scanner daemon of Kaspersky Version 4. This version of the
65206 Kaspersky scanner is outdated. Please upgrade (see <option>aveserver</option> above). This
65207 scanner type takes one option, which is the path to the daemon&#x2019;s UNIX socket.
65208 For example:
65209 </para>
65210 <literallayout class="monospaced">
65211 av_scanner = kavdaemon:/opt/AVP/AvpCtl
65212 </literallayout>
65213 <para>
65214 The default path is <filename>/var/run/AvpCtl</filename>.
65215 </para>
65216 </listitem></varlistentry>
65217 <varlistentry>
65218 <term><option>mksd</option></term>
65219 <listitem>
65220 <para>
65221 <indexterm role="concept">
65222 <primary>virus scanners</primary>
65223 <secondary>mksd</secondary>
65224 </indexterm>
65225 This was a daemon type scanner that is aimed mainly at Polish users,
65226 though some documentation was available in English.
65227 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>
65228 and this appears to be a candidate for removal from Exim, unless
65229 we are informed of other virus scanners which use the same protocol
65230 to integrate.
65231 The only option for this scanner type is
65232 the maximum number of processes used simultaneously to scan the attachments,
65233 provided that mksd has
65234 been run with at least the same number of child processes. For example:
65235 </para>
65236 <literallayout class="monospaced">
65237 av_scanner = mksd:2
65238 </literallayout>
65239 <para>
65240 You can safely omit this option (the default value is 1).
65241 </para>
65242 </listitem></varlistentry>
65243 <varlistentry>
65244 <term><option>sock</option></term>
65245 <listitem>
65246 <para>
65247 <indexterm role="concept">
65248 <primary>virus scanners</primary>
65249 <secondary>simple socket-connected</secondary>
65250 </indexterm>
65251 This is a general-purpose way of talking to simple scanner daemons
65252 running on the local machine.
65253 There are four options:
65254 an address (which may be an IP address and port, or the path of a Unix socket),
65255 a commandline to send (may include a single %s which will be replaced with
65256 the path to the mail file to be scanned),
65257 an RE to trigger on from the returned data,
65258 and an RE to extract malware_name from the returned data.
65259 For example:
65260 </para>
65261 <literallayout class="monospaced">
65262 av_scanner = sock:127.0.0.1 6001:%s:(SPAM|VIRUS):(.*)$
65263 </literallayout>
65264 <para>
65265 Note that surrounding whitespace is stripped from each option, meaning
65266 there is no way to specify a trailing newline.
65267 The socket specifier and both regular-expressions are required.
65268 Default for the commandline is <filename>%s\n</filename> (note this does have a trailing newline);
65269 specify an empty element to get this.
65270 </para>
65271 </listitem></varlistentry>
65272 <varlistentry>
65273 <term><option>sophie</option></term>
65274 <listitem>
65275 <para>
65276 <indexterm role="concept">
65277 <primary>virus scanners</primary>
65278 <secondary>Sophos and Sophie</secondary>
65279 </indexterm>
65280 Sophie is a daemon that uses Sophos&#x2019; <option>libsavi</option> library to scan for viruses.
65281 You can get Sophie at <emphasis role="bold"><ulink url="http://sophie.sourceforge.net/">http://sophie.sourceforge.net/</ulink></emphasis>. The only option
65282 for this scanner type is the path to the UNIX socket that Sophie uses for
65283 client communication. For example:
65284 </para>
65285 <literallayout class="monospaced">
65286 av_scanner = sophie:/tmp/sophie
65287 </literallayout>
65288 <para>
65289 The default path is <filename>/var/run/sophie</filename>, so if you are using this, you can omit
65290 the option.
65291 </para>
65292 </listitem></varlistentry>
65293 </variablelist>
65294 <para>
65295 When <option>av_scanner</option> is correctly set, you can use the <option>malware</option> condition in
65296 the DATA ACL. <emphasis role="bold">Note</emphasis>: You cannot use the <option>malware</option> condition in the MIME
65297 ACL.
65298 </para>
65299 <para>
65300 The <option>av_scanner</option> option is expanded each time <option>malware</option> is called. This
65301 makes it possible to use different scanners. See further below for an example.
65302 The <option>malware</option> condition caches its results, so when you use it multiple times
65303 for the same message, the actual scanning process is only carried out once.
65304 However, using expandable items in <option>av_scanner</option> disables this caching, in
65305 which case each use of the <option>malware</option> condition causes a new scan of the
65306 message.
65307 </para>
65308 <para>
65309 The <option>malware</option> condition takes a right-hand argument that is expanded before
65310 use and taken as a list, slash-separated by default.
65311 The first element can then be one of
65312 </para>
65313 <itemizedlist>
65314 <listitem>
65315 <para>
65316 <quote>true</quote>, <quote>*</quote>, or <quote>1</quote>, in which case the message is scanned for viruses.
65317 The condition succeeds if a virus was found, and fail otherwise. This is the
65318 recommended usage.
65319 </para>
65320 </listitem>
65321 <listitem>
65322 <para>
65323 <quote>false</quote> or <quote>0</quote> or an empty string, in which case no scanning is done and
65324 the condition fails immediately.
65325 </para>
65326 </listitem>
65327 <listitem>
65328 <para>
65329 A regular expression, in which case the message is scanned for viruses. The
65330 condition succeeds if a virus is found and its name matches the regular
65331 expression. This allows you to take special actions on certain types of virus.
65332 Note that <quote>/</quote> characters in the RE must be doubled due to the list-processing,
65333 unless the separator is changed (in the usual way <xref linkend="SECTlistsepchange"/>).
65334 </para>
65335 </listitem>
65336 </itemizedlist>
65337 <para>
65338 You can append a <literal>defer_ok</literal> element to the <option>malware</option> argument list to accept
65339 messages even if there is a problem with the virus scanner.
65340 Otherwise, such a problem causes the ACL to defer.
65341 </para>
65342 <para>
65343 You can append a <literal>tmo=&lt;val&gt;</literal> element to the <option>malware</option> argument list to
65344 specify a non-default timeout.  The default is two minutes.
65345 For example:
65346 </para>
65347 <literallayout class="monospaced">
65348 malware = * / defer_ok / tmo=10s
65349 </literallayout>
65350 <para>
65351 A timeout causes the ACL to defer.
65352 </para>
65353 <para>
65354 <indexterm role="variable">
65355 <primary><varname>$callout_address</varname></primary>
65356 </indexterm>
65357 When a connection is made to the scanner the expansion variable <varname>$callout_address</varname>
65358 is set to record the actual address used.
65359 </para>
65360 <para>
65361 <indexterm role="variable">
65362 <primary><varname>$malware_name</varname></primary>
65363 </indexterm>
65364 When a virus is found, the condition sets up an expansion variable called
65365 <varname>$malware_name</varname> that contains the name of the virus. You can use it in a
65366 <option>message</option> modifier that specifies the error returned to the sender, and/or in
65367 logging data.
65368 </para>
65369 <para>
65370 Beware the interaction of Exim&#x2019;s <option>message_size_limit</option> with any size limits
65371 imposed by your anti-virus scanner.
65372 </para>
65373 <para>
65374 Here is a very simple scanning example:
65375 </para>
65376 <literallayout class="monospaced">
65377 deny malware = *
65378      message = This message contains malware ($malware_name)
65379 </literallayout>
65380 <para>
65381 The next example accepts messages when there is a problem with the scanner:
65382 </para>
65383 <literallayout class="monospaced">
65384 deny malware = */defer_ok
65385      message = This message contains malware ($malware_name)
65386 </literallayout>
65387 <para>
65388 The next example shows how to use an ACL variable to scan with both sophie and
65389 aveserver. It assumes you have set:
65390 </para>
65391 <literallayout class="monospaced">
65392 av_scanner = $acl_m0
65393 </literallayout>
65394 <para>
65395 in the main Exim configuration.
65396 </para>
65397 <literallayout class="monospaced">
65398 deny set acl_m0 = sophie
65399      malware = *
65400      message = This message contains malware ($malware_name)
65401
65402 deny set acl_m0 = aveserver
65403      malware = *
65404      message = This message contains malware ($malware_name)
65405 </literallayout>
65406 </section>
65407 <section id="SECTscanspamass">
65408 <title>Scanning with SpamAssassin and Rspamd</title>
65409 <para>
65410 <indexterm role="concept">
65411 <primary>content scanning</primary>
65412 <secondary>for spam</secondary>
65413 </indexterm>
65414 <indexterm role="concept">
65415 <primary>spam scanning</primary>
65416 </indexterm>
65417 <indexterm role="concept">
65418 <primary>SpamAssassin</primary>
65419 </indexterm>
65420 <indexterm role="concept">
65421 <primary>Rspamd</primary>
65422 </indexterm>
65423 The <option>spam</option> ACL condition calls SpamAssassin&#x2019;s <option>spamd</option> daemon to get a spam
65424 score and a report for the message.
65425 Support is also provided for Rspamd.
65426 </para>
65427 <para>
65428 For more information about installation and configuration of SpamAssassin or
65429 Rspamd refer to their respective websites at
65430 <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>
65431 </para>
65432 <para>
65433 SpamAssassin can be installed with CPAN by running:
65434 </para>
65435 <literallayout class="monospaced">
65436 perl -MCPAN -e 'install Mail::SpamAssassin'
65437 </literallayout>
65438 <para>
65439 SpamAssassin has its own set of configuration files. Please review its
65440 documentation to see how you can tweak it. The default installation should work
65441 nicely, however.
65442 </para>
65443 <para>
65444 <indexterm role="option">
65445 <primary><option>spamd_address</option></primary>
65446 </indexterm>
65447 By default, SpamAssassin listens on 127.0.0.1, TCP port 783 and if you
65448 intend to use an instance running on the local host you do not need to set
65449 <option>spamd_address</option>. If you intend to use another host or port for SpamAssassin,
65450 you must set the <option>spamd_address</option> option in the global part of the Exim
65451 configuration as follows (example):
65452 </para>
65453 <literallayout class="monospaced">
65454 spamd_address = 192.168.99.45 783
65455 </literallayout>
65456 <para>
65457 The SpamAssassin protocol relies on a TCP half-close from the client.
65458 If your SpamAssassin client side is running a Linux system with an
65459 iptables firewall, consider setting
65460 <option>net.netfilter.nf_conntrack_tcp_timeout_close_wait</option> to at least the
65461 timeout, Exim uses when waiting for a response from the SpamAssassin
65462 server (currently defaulting to 120s).  With a lower value the Linux
65463 connection tracking may consider your half-closed connection as dead too
65464 soon.
65465 </para>
65466 <para>
65467 To use Rspamd (which by default listens on all local addresses
65468 on TCP port 11333)
65469 you should add <option>variant=rspamd</option> after the address/port pair, for example:
65470 </para>
65471 <literallayout class="monospaced">
65472 spamd_address = 127.0.0.1 11333 variant=rspamd
65473 </literallayout>
65474 <para>
65475 As of version 2.60, <option>SpamAssassin</option> also supports communication over UNIX
65476 sockets. If you want to us these, supply <option>spamd_address</option> with an absolute
65477 filename instead of an address/port pair:
65478 </para>
65479 <literallayout class="monospaced">
65480 spamd_address = /var/run/spamd_socket
65481 </literallayout>
65482 <para>
65483 You can have multiple <option>spamd</option> servers to improve scalability. These can
65484 reside on other hardware reachable over the network. To specify multiple
65485 <option>spamd</option> servers, put multiple address/port pairs in the <option>spamd_address</option>
65486 option, separated with colons (the separator can be changed in the usual way <xref linkend="SECTlistsepchange"/>):
65487 </para>
65488 <literallayout class="monospaced">
65489 spamd_address = 192.168.2.10 783 : \
65490                 192.168.2.11 783 : \
65491                 192.168.2.12 783
65492 </literallayout>
65493 <para>
65494 Up to 32 <option>spamd</option> servers are supported.
65495 When a server fails to respond to the connection attempt, all other
65496 servers are tried until one succeeds. If no server responds, the <option>spam</option>
65497 condition defers.
65498 </para>
65499 <para>
65500 Unix and TCP socket specifications may be mixed in any order.
65501 Each element of the list is a list itself, space-separated by default
65502 and changeable in the usual way (<xref linkend="SECTlistsepchange"/>);
65503 take care to not double the separator.
65504 </para>
65505 <para>
65506 For TCP socket specifications a host name or IP (v4 or v6, but
65507 subject to list-separator quoting rules) address can be used,
65508 and the port can be one or a dash-separated pair.
65509 In the latter case, the range is tried in strict order.
65510 </para>
65511 <para>
65512 Elements after the first for Unix sockets, or second for TCP socket,
65513 are options.
65514 The supported options are:
65515 </para>
65516 <literallayout class="monospaced">
65517 pri=&lt;priority&gt;      Selection priority
65518 weight=&lt;value&gt;      Selection bias
65519 time=&lt;start&gt;-&lt;end&gt;  Use only between these times of day
65520 retry=&lt;timespec&gt;    Retry on connect fail
65521 tmo=&lt;timespec&gt;      Connection time limit
65522 variant=rspamd      Use Rspamd rather than SpamAssassin protocol
65523 </literallayout>
65524 <para>
65525 The <literal>pri</literal> option specifies a priority for the server within the list,
65526 higher values being tried first.
65527 The default priority is 1.
65528 </para>
65529 <para>
65530 The <literal>weight</literal> option specifies a selection bias.
65531 Within a priority set
65532 servers are queried in a random fashion, weighted by this value.
65533 The default value for selection bias is 1.
65534 </para>
65535 <para>
65536 Time specifications for the <literal>time</literal> option are &lt;hour&gt;.&lt;minute&gt;.&lt;second&gt;
65537 in the local time zone; each element being one or more digits.
65538 Either the seconds or both minutes and seconds, plus the leading <literal>.</literal>
65539 characters, may be omitted and will be taken as zero.
65540 </para>
65541 <para>
65542 Timeout specifications for the <literal>retry</literal> and <literal>tmo</literal> options
65543 are the usual Exim time interval standard, e.g. <literal>20s</literal> or <literal>1m</literal>.
65544 </para>
65545 <para>
65546 The <literal>tmo</literal> option specifies an overall timeout for communication.
65547 The default value is two minutes.
65548 </para>
65549 <para>
65550 The <literal>retry</literal> option specifies a time after which a single retry for
65551 a failed connect is made.
65552 The default is to not retry.
65553 </para>
65554 <para>
65555 The <option>spamd_address</option> variable is expanded before use if it starts with
65556 a dollar sign. In this case, the expansion may return a string that is
65557 used as the list so that multiple spamd servers can be the result of an
65558 expansion.
65559 </para>
65560 <para>
65561 <indexterm role="variable">
65562 <primary><varname>$callout_address</varname></primary>
65563 </indexterm>
65564 When a connection is made to the server the expansion variable <varname>$callout_address</varname>
65565 is set to record the actual address used.
65566 </para>
65567 </section>
65568 <section id="SECID206">
65569 <title>Calling SpamAssassin from an Exim ACL</title>
65570 <para>
65571 Here is a simple example of the use of the <option>spam</option> condition in a DATA ACL:
65572 </para>
65573 <literallayout class="monospaced">
65574 deny spam = joe
65575      message = This message was classified as SPAM
65576 </literallayout>
65577 <para>
65578 The right-hand side of the <option>spam</option> condition specifies a name. This is
65579 relevant if you have set up multiple SpamAssassin profiles. If you do not want
65580 to scan using a specific profile, but rather use the SpamAssassin system-wide
65581 default profile, you can scan for an unknown name, or simply use <quote>nobody</quote>.
65582 Rspamd does not use this setting. However, you must put something on the
65583 right-hand side.
65584 </para>
65585 <para>
65586 The name allows you to use per-domain or per-user antispam profiles in
65587 principle, but this is not straightforward in practice, because a message may
65588 have multiple recipients, not necessarily all in the same domain. Because the
65589 <option>spam</option> condition has to be called from a DATA-time ACL in order to be able to
65590 read the contents of the message, the variables <varname>$local_part</varname> and <varname>$domain</varname>
65591 are not set.
65592 Careful enforcement of single-recipient messages
65593 (e.g. by responding with defer in the recipient ACL for all recipients
65594 after the first),
65595 or the use of PRDR,
65596 <indexterm role="concept">
65597 <primary>PRDR</primary>
65598 <secondary>use for per-user SpamAssassin profiles</secondary>
65599 </indexterm>
65600 are needed to use this feature.
65601 </para>
65602 <para>
65603 The right-hand side of the <option>spam</option> condition is expanded before being used, so
65604 you can put lookups or conditions there. When the right-hand side evaluates to
65605 <quote>0</quote> or <quote>false</quote>, no scanning is done and the condition fails immediately.
65606 </para>
65607 <para>
65608 Scanning with SpamAssassin uses a lot of resources. If you scan every message,
65609 large ones may cause significant performance degradation. As most spam messages
65610 are quite small, it is recommended that you do not scan the big ones. For
65611 example:
65612 </para>
65613 <literallayout class="monospaced">
65614 deny condition = ${if &lt; {$message_size}{10K}}
65615      spam = nobody
65616      message = This message was classified as SPAM
65617 </literallayout>
65618 <para>
65619 The <option>spam</option> condition returns true if the threshold specified in the user&#x2019;s
65620 SpamAssassin profile has been matched or exceeded. If you want to use the
65621 <option>spam</option> condition for its side effects (see the variables below), you can make
65622 it always return <quote>true</quote> by appending <literal>:true</literal> to the username.
65623 </para>
65624 <para>
65625 <indexterm role="concept">
65626 <primary>spam scanning</primary>
65627 <secondary>returned variables</secondary>
65628 </indexterm>
65629 When the <option>spam</option> condition is run, it sets up a number of expansion
65630 variables.
65631 Except for <varname>$spam_report</varname>,
65632 these variables are saved with the received message so are
65633 available for use at delivery time.
65634 </para>
65635 <variablelist>
65636 <varlistentry>
65637 <term><varname>$spam_score</varname></term>
65638 <listitem>
65639 <para>
65640 The spam score of the message, for example, <quote>3.4</quote> or <quote>30.5</quote>. This is useful
65641 for inclusion in log or reject messages.
65642 </para>
65643 </listitem></varlistentry>
65644 <varlistentry>
65645 <term><varname>$spam_score_int</varname></term>
65646 <listitem>
65647 <para>
65648 The spam score of the message, multiplied by ten, as an integer value. For
65649 example <quote>34</quote> or <quote>305</quote>. It may appear to disagree with <varname>$spam_score</varname>
65650 because <varname>$spam_score</varname> is rounded and <varname>$spam_score_int</varname> is truncated.
65651 The integer value is useful for numeric comparisons in conditions.
65652 </para>
65653 </listitem></varlistentry>
65654 <varlistentry>
65655 <term><varname>$spam_bar</varname></term>
65656 <listitem>
65657 <para>
65658 A string consisting of a number of <quote>+</quote> or <quote>-</quote> characters, representing the
65659 integer part of the spam score value. A spam score of 4.4 would have a
65660 <varname>$spam_bar</varname> value of <quote>++++</quote>. This is useful for inclusion in warning
65661 headers, since MUAs can match on such strings. The maximum length of the
65662 spam bar is 50 characters.
65663 </para>
65664 </listitem></varlistentry>
65665 <varlistentry>
65666 <term><varname>$spam_report</varname></term>
65667 <listitem>
65668 <para>
65669 A multiline text table, containing the full SpamAssassin report for the
65670 message. Useful for inclusion in headers or reject messages.
65671 This variable is only usable in a DATA-time ACL.
65672 Beware that SpamAssassin may return non-ASCII characters, especially
65673 when running in country-specific locales, which are not legal
65674 unencoded in headers.
65675 </para>
65676 </listitem></varlistentry>
65677 <varlistentry>
65678 <term><varname>$spam_action</varname></term>
65679 <listitem>
65680 <para>
65681 For SpamAssassin either &#x2019;reject&#x2019; or &#x2019;no action&#x2019; depending on the
65682 spam score versus threshold.
65683 For Rspamd, the recommended action.
65684 </para>
65685 </listitem></varlistentry>
65686 </variablelist>
65687 <para>
65688 The <option>spam</option> condition caches its results unless expansion in
65689 spamd_address was used. If you call it again with the same user name, it
65690 does not scan again, but rather returns the same values as before.
65691 </para>
65692 <para>
65693 The <option>spam</option> condition returns DEFER if there is any error while running
65694 the message through SpamAssassin or if the expansion of spamd_address
65695 failed. If you want to treat DEFER as FAIL (to pass on to the next ACL
65696 statement block), append <literal>/defer_ok</literal> to the right-hand side of the
65697 spam condition, like this:
65698 </para>
65699 <literallayout class="monospaced">
65700 deny spam    = joe/defer_ok
65701      message = This message was classified as SPAM
65702 </literallayout>
65703 <para>
65704 This causes messages to be accepted even if there is a problem with <option>spamd</option>.
65705 </para>
65706 <para>
65707 Here is a longer, commented example of the use of the <option>spam</option>
65708 condition:
65709 </para>
65710 <literallayout class="monospaced">
65711 # put headers in all messages (no matter if spam or not)
65712 warn  spam = nobody:true
65713       add_header = X-Spam-Score: $spam_score ($spam_bar)
65714       add_header = X-Spam-Report: $spam_report
65715
65716 # add second subject line with *SPAM* marker when message
65717 # is over threshold
65718 warn  spam = nobody
65719       add_header = Subject: *SPAM* $h_Subject:
65720
65721 # reject spam at high scores (&gt; 12)
65722 deny  spam = nobody:true
65723       condition = ${if &gt;{$spam_score_int}{120}{1}{0}}
65724       message = This message scored $spam_score spam points.
65725 </literallayout>
65726 </section>
65727 <section id="SECTscanmimepart">
65728 <title>Scanning MIME parts</title>
65729 <para>
65730 <indexterm role="concept">
65731 <primary>content scanning</primary>
65732 <secondary>MIME parts</secondary>
65733 </indexterm>
65734 <indexterm role="concept">
65735 <primary>MIME content scanning</primary>
65736 </indexterm>
65737 <indexterm role="option">
65738 <primary><option>acl_smtp_mime</option></primary>
65739 </indexterm>
65740 <indexterm role="option">
65741 <primary><option>acl_not_smtp_mime</option></primary>
65742 </indexterm>
65743 The <option>acl_smtp_mime</option> global option specifies an ACL that is called once for
65744 each MIME part of an SMTP message, including multipart types, in the sequence
65745 of their position in the message. Similarly, the <option>acl_not_smtp_mime</option> option
65746 specifies an ACL that is used for the MIME parts of non-SMTP messages. These
65747 options may both refer to the same ACL if you want the same processing in both
65748 cases.
65749 </para>
65750 <para>
65751 These ACLs are called (possibly many times) just before the <option>acl_smtp_data</option>
65752 ACL in the case of an SMTP message, or just before the <option>acl_not_smtp</option> ACL in
65753 the case of a non-SMTP message. However, a MIME ACL is called only if the
65754 message contains a <emphasis>Content-Type:</emphasis> header line. When a call to a MIME
65755 ACL does not yield <quote>accept</quote>, ACL processing is aborted and the appropriate
65756 result code is sent to the client. In the case of an SMTP message, the
65757 <option>acl_smtp_data</option> ACL is not called when this happens.
65758 </para>
65759 <para>
65760 You cannot use the <option>malware</option> or <option>spam</option> conditions in a MIME ACL; these can
65761 only be used in the DATA or non-SMTP ACLs. However, you can use the <option>regex</option>
65762 condition to match against the raw MIME part. You can also use the
65763 <option>mime_regex</option> condition to match against the decoded MIME part (see section
65764 <xref linkend="SECTscanregex"/>).
65765 </para>
65766 <para>
65767 At the start of a MIME ACL, a number of variables are set from the header
65768 information for the relevant MIME part. These are described below. The contents
65769 of the MIME part are not by default decoded into a disk file except for MIME
65770 parts whose content-type is <quote>message/rfc822</quote>. If you want to decode a MIME
65771 part into a disk file, you can use the <option>decode</option> condition. The general
65772 syntax is:
65773 </para>
65774 <literallayout>
65775 <literal>decode = [/</literal>&lt;<emphasis>path</emphasis>&gt;<literal>/]</literal>&lt;<emphasis>filename</emphasis>&gt;
65776 </literallayout>
65777 <para>
65778 The right hand side is expanded before use. After expansion,
65779 the value can be:
65780 </para>
65781 <orderedlist numeration="arabic">
65782 <listitem>
65783 <para>
65784 <quote>0</quote> or <quote>false</quote>, in which case no decoding is done.
65785 </para>
65786 </listitem>
65787 <listitem>
65788 <para>
65789 The string <quote>default</quote>. In that case, the file is put in the temporary
65790 <quote>default</quote> directory &lt;<emphasis>spool_directory</emphasis>&gt;<filename>/scan/</filename>&lt;<emphasis>message_id</emphasis>&gt;<filename>/</filename> with
65791 a sequential filename consisting of the message id and a sequence number. The
65792 full path and name is available in <varname>$mime_decoded_filename</varname> after decoding.
65793 </para>
65794 </listitem>
65795 <listitem>
65796 <para>
65797 A full path name starting with a slash. If the full name is an existing
65798 directory, it is used as a replacement for the default directory. The filename
65799 is then sequentially assigned. If the path does not exist, it is used as
65800 the full path and filename.
65801 </para>
65802 </listitem>
65803 <listitem>
65804 <para>
65805 If the string does not start with a slash, it is used as the
65806 filename, and the default path is then used.
65807 </para>
65808 </listitem>
65809 </orderedlist>
65810 <para>
65811 The <option>decode</option> condition normally succeeds. It is only false for syntax
65812 errors or unusual circumstances such as memory shortages. You can easily decode
65813 a file with its original, proposed filename using
65814 </para>
65815 <literallayout class="monospaced">
65816 decode = $mime_filename
65817 </literallayout>
65818 <para>
65819 However, you should keep in mind that <varname>$mime_filename</varname> might contain
65820 anything. If you place files outside of the default path, they are not
65821 automatically unlinked.
65822 </para>
65823 <para>
65824 For RFC822 attachments (these are messages attached to messages, with a
65825 content-type of <quote>message/rfc822</quote>), the ACL is called again in the same manner
65826 as for the primary message, only that the <varname>$mime_is_rfc822</varname> expansion
65827 variable is set (see below). Attached messages are always decoded to disk
65828 before being checked, and the files are unlinked once the check is done.
65829 </para>
65830 <para>
65831 The MIME ACL supports the <option>regex</option> and <option>mime_regex</option> conditions. These can be
65832 used to match regular expressions against raw and decoded MIME parts,
65833 respectively. They are described in section <xref linkend="SECTscanregex"/>.
65834 </para>
65835 <para>
65836 <indexterm role="concept">
65837 <primary>MIME content scanning</primary>
65838 <secondary>returned variables</secondary>
65839 </indexterm>
65840 The following list describes all expansion variables that are
65841 available in the MIME ACL:
65842 </para>
65843 <variablelist>
65844 <varlistentry>
65845 <term><varname>$mime_anomaly_level</varname></term>
65846 <term><varname>$mime_anomaly_text</varname></term>
65847 <listitem>
65848 <para>
65849 <indexterm role="variable">
65850 <primary><varname>$mime_anomaly_level</varname></primary>
65851 </indexterm>
65852 <indexterm role="variable">
65853 <primary><varname>$mime_anomaly_text</varname></primary>
65854 </indexterm>
65855 If there are problems decoding, these variables contain information on
65856 the detected issue.
65857 </para>
65858 </listitem></varlistentry>
65859 <varlistentry>
65860 <term><varname>$mime_boundary</varname></term>
65861 <listitem>
65862 <para>
65863 <indexterm role="variable">
65864 <primary><varname>$mime_boundary</varname></primary>
65865 </indexterm>
65866 If the current part is a multipart (see <varname>$mime_is_multipart</varname> below), it should
65867 have a boundary string, which is stored in this variable. If the current part
65868 has no boundary parameter in the <emphasis>Content-Type:</emphasis> header, this variable
65869 contains the empty string.
65870 </para>
65871 </listitem></varlistentry>
65872 <varlistentry>
65873 <term><varname>$mime_charset</varname></term>
65874 <listitem>
65875 <para>
65876 <indexterm role="variable">
65877 <primary><varname>$mime_charset</varname></primary>
65878 </indexterm>
65879 This variable contains the character set identifier, if one was found in the
65880 <emphasis>Content-Type:</emphasis> header. Examples for charset identifiers are:
65881 </para>
65882 <literallayout class="monospaced">
65883 us-ascii
65884 gb2312 (Chinese)
65885 iso-8859-1
65886 </literallayout>
65887 <para>
65888 Please note that this value is not normalized, so you should do matches
65889 case-insensitively.
65890 </para>
65891 </listitem></varlistentry>
65892 <varlistentry>
65893 <term><varname>$mime_content_description</varname></term>
65894 <listitem>
65895 <para>
65896 <indexterm role="variable">
65897 <primary><varname>$mime_content_description</varname></primary>
65898 </indexterm>
65899 This variable contains the normalized content of the <emphasis>Content-Description:</emphasis>
65900 header. It can contain a human-readable description of the parts content. Some
65901 implementations repeat the filename for attachments here, but they are usually
65902 only used for display purposes.
65903 </para>
65904 </listitem></varlistentry>
65905 <varlistentry>
65906 <term><varname>$mime_content_disposition</varname></term>
65907 <listitem>
65908 <para>
65909 <indexterm role="variable">
65910 <primary><varname>$mime_content_disposition</varname></primary>
65911 </indexterm>
65912 This variable contains the normalized content of the <emphasis>Content-Disposition:</emphasis>
65913 header. You can expect strings like <quote>attachment</quote> or <quote>inline</quote> here.
65914 </para>
65915 </listitem></varlistentry>
65916 <varlistentry>
65917 <term><varname>$mime_content_id</varname></term>
65918 <listitem>
65919 <para>
65920 <indexterm role="variable">
65921 <primary><varname>$mime_content_id</varname></primary>
65922 </indexterm>
65923 This variable contains the normalized content of the <emphasis>Content-ID:</emphasis> header.
65924 This is a unique ID that can be used to reference a part from another part.
65925 </para>
65926 </listitem></varlistentry>
65927 <varlistentry>
65928 <term><varname>$mime_content_size</varname></term>
65929 <listitem>
65930 <para>
65931 <indexterm role="variable">
65932 <primary><varname>$mime_content_size</varname></primary>
65933 </indexterm>
65934 This variable is set only after the <option>decode</option> modifier (see above) has been
65935 successfully run. It contains the size of the decoded part in kilobytes. The
65936 size is always rounded up to full kilobytes, so only a completely empty part
65937 has a <varname>$mime_content_size</varname> of zero.
65938 </para>
65939 </listitem></varlistentry>
65940 <varlistentry>
65941 <term><varname>$mime_content_transfer_encoding</varname></term>
65942 <listitem>
65943 <para>
65944 <indexterm role="variable">
65945 <primary><varname>$mime_content_transfer_encoding</varname></primary>
65946 </indexterm>
65947 This variable contains the normalized content of the
65948 <emphasis>Content-transfer-encoding:</emphasis> header. This is a symbolic name for an encoding
65949 type. Typical values are <quote>base64</quote> and <quote>quoted-printable</quote>.
65950 </para>
65951 </listitem></varlistentry>
65952 <varlistentry>
65953 <term><varname>$mime_content_type</varname></term>
65954 <listitem>
65955 <para>
65956 <indexterm role="variable">
65957 <primary><varname>$mime_content_type</varname></primary>
65958 </indexterm>
65959 If the MIME part has a <emphasis>Content-Type:</emphasis> header, this variable contains its
65960 value, lowercased, and without any options (like <quote>name</quote> or <quote>charset</quote>). Here
65961 are some examples of popular MIME types, as they may appear in this variable:
65962 </para>
65963 <literallayout class="monospaced">
65964 text/plain
65965 text/html
65966 application/octet-stream
65967 image/jpeg
65968 audio/midi
65969 </literallayout>
65970 <para>
65971 If the MIME part has no <emphasis>Content-Type:</emphasis> header, this variable contains the
65972 empty string.
65973 </para>
65974 </listitem></varlistentry>
65975 <varlistentry>
65976 <term><varname>$mime_decoded_filename</varname></term>
65977 <listitem>
65978 <para>
65979 <indexterm role="variable">
65980 <primary><varname>$mime_decoded_filename</varname></primary>
65981 </indexterm>
65982 This variable is set only after the <option>decode</option> modifier (see above) has been
65983 successfully run. It contains the full path and filename of the file
65984 containing the decoded data.
65985 </para>
65986 </listitem></varlistentry>
65987 </variablelist>
65988 <para>
65989 <indexterm role="concept">
65990 <primary>RFC 2047</primary>
65991 </indexterm>
65992 </para>
65993 <variablelist>
65994 <varlistentry>
65995 <term><varname>$mime_filename</varname></term>
65996 <listitem>
65997 <para>
65998 <indexterm role="variable">
65999 <primary><varname>$mime_filename</varname></primary>
66000 </indexterm>
66001 This is perhaps the most important of the MIME variables. It contains a
66002 proposed filename for an attachment, if one was found in either the
66003 <emphasis>Content-Type:</emphasis> or <emphasis>Content-Disposition:</emphasis> headers. The filename will be
66004 RFC2047
66005 or RFC2231
66006 decoded, but no additional sanity checks are done.
66007  If no filename was
66008 found, this variable contains the empty string.
66009 </para>
66010 </listitem></varlistentry>
66011 <varlistentry>
66012 <term><varname>$mime_is_coverletter</varname></term>
66013 <listitem>
66014 <para>
66015 <indexterm role="variable">
66016 <primary><varname>$mime_is_coverletter</varname></primary>
66017 </indexterm>
66018 This variable attempts to differentiate the <quote>cover letter</quote> of an e-mail from
66019 attached data. It can be used to clamp down on flashy or unnecessarily encoded
66020 content in the cover letter, while not restricting attachments at all.
66021 </para>
66022 <para>
66023 The variable contains 1 (true) for a MIME part believed to be part of the
66024 cover letter, and 0 (false) for an attachment. At present, the algorithm is as
66025 follows:
66026 </para>
66027 <orderedlist numeration="arabic">
66028 <listitem>
66029 <para>
66030 The outermost MIME part of a message is always a cover letter.
66031 </para>
66032 </listitem>
66033 <listitem>
66034 <para>
66035 If a multipart/alternative or multipart/related MIME part is a cover letter,
66036 so are all MIME subparts within that multipart.
66037 </para>
66038 </listitem>
66039 <listitem>
66040 <para>
66041 If any other multipart is a cover letter, the first subpart is a cover letter,
66042 and the rest are attachments.
66043 </para>
66044 </listitem>
66045 <listitem>
66046 <para>
66047 All parts contained within an attachment multipart are attachments.
66048 </para>
66049 </listitem>
66050 </orderedlist>
66051 <para>
66052 As an example, the following will ban <quote>HTML mail</quote> (including that sent with
66053 alternative plain text), while allowing HTML files to be attached. HTML
66054 coverletter mail attached to non-HTML coverletter mail will also be allowed:
66055 </para>
66056 <literallayout class="monospaced">
66057 deny !condition = $mime_is_rfc822
66058      condition = $mime_is_coverletter
66059      condition = ${if eq{$mime_content_type}{text/html}{1}{0}}
66060      message = HTML mail is not accepted here
66061 </literallayout>
66062 </listitem></varlistentry>
66063 <varlistentry>
66064 <term><varname>$mime_is_multipart</varname></term>
66065 <listitem>
66066 <para>
66067 <indexterm role="variable">
66068 <primary><varname>$mime_is_multipart</varname></primary>
66069 </indexterm>
66070 This variable has the value 1 (true) when the current part has the main type
66071 <quote>multipart</quote>, for example, <quote>multipart/alternative</quote> or <quote>multipart/mixed</quote>.
66072 Since multipart entities only serve as containers for other parts, you may not
66073 want to carry out specific actions on them.
66074 </para>
66075 </listitem></varlistentry>
66076 <varlistentry>
66077 <term><varname>$mime_is_rfc822</varname></term>
66078 <listitem>
66079 <para>
66080 <indexterm role="variable">
66081 <primary><varname>$mime_is_rfc822</varname></primary>
66082 </indexterm>
66083 This variable has the value 1 (true) if the current part is not a part of the
66084 checked message itself, but part of an attached message. Attached message
66085 decoding is fully recursive.
66086 </para>
66087 </listitem></varlistentry>
66088 <varlistentry>
66089 <term><varname>$mime_part_count</varname></term>
66090 <listitem>
66091 <para>
66092 <indexterm role="variable">
66093 <primary><varname>$mime_part_count</varname></primary>
66094 </indexterm>
66095 This variable is a counter that is raised for each processed MIME part. It
66096 starts at zero for the very first part (which is usually a multipart). The
66097 counter is per-message, so it is reset when processing RFC822 attachments (see
66098 <varname>$mime_is_rfc822</varname>). The counter stays set after <option>acl_smtp_mime</option> is
66099 complete, so you can use it in the DATA ACL to determine the number of MIME
66100 parts of a message. For non-MIME messages, this variable contains the value -1.
66101 </para>
66102 </listitem></varlistentry>
66103 </variablelist>
66104 </section>
66105 <section id="SECTscanregex">
66106 <title>Scanning with regular expressions</title>
66107 <para>
66108 <indexterm role="concept">
66109 <primary>content scanning</primary>
66110 <secondary>with regular expressions</secondary>
66111 </indexterm>
66112 <indexterm role="concept">
66113 <primary>regular expressions</primary>
66114 <secondary>content scanning with</secondary>
66115 </indexterm>
66116 You can specify your own custom regular expression matches on the full body of
66117 the message, or on individual MIME parts.
66118 </para>
66119 <para>
66120 The <option>regex</option> condition takes one or more regular expressions as arguments and
66121 matches them against the full message (when called in the DATA ACL) or a raw
66122 MIME part (when called in the MIME ACL). The <option>regex</option> condition matches
66123 linewise, with a maximum line length of 32K characters. That means you cannot
66124 have multiline matches with the <option>regex</option> condition.
66125 </para>
66126 <para>
66127 The <option>mime_regex</option> condition can be called only in the MIME ACL. It matches up
66128 to 32K of decoded content (the whole content at once, not linewise). If the
66129 part has not been decoded with the <option>decode</option> modifier earlier in the ACL, it
66130 is decoded automatically when <option>mime_regex</option> is executed (using default path
66131 and filename values). If the decoded data is larger than  32K, only the first
66132 32K characters are checked.
66133 </para>
66134 <para>
66135 The regular expressions are passed as a colon-separated list. To include a
66136 literal colon, you must double it. Since the whole right-hand side string is
66137 expanded before being used, you must also escape dollar signs and backslashes
66138 with more backslashes, or use the <literal>\N</literal> facility to disable expansion.
66139 Here is a simple example that contains two regular expressions:
66140 </para>
66141 <literallayout class="monospaced">
66142 deny regex = [Mm]ortgage : URGENT BUSINESS PROPOSAL
66143      message = contains blacklisted regex ($regex_match_string)
66144 </literallayout>
66145 <para>
66146 The conditions returns true if any one of the regular expressions matches. The
66147 <varname>$regex_match_string</varname> expansion variable is then set up and contains the
66148 matching regular expression.
66149 The expansion variables <varname>$regex1</varname> <varname>$regex2</varname> etc
66150 are set to any substrings captured by the regular expression.
66151 </para>
66152 <para>
66153 <emphasis role="bold">Warning</emphasis>: With large messages, these conditions can be fairly
66154 CPU-intensive.
66155 </para>
66156 <para>
66157 <indexterm role="concept" startref="IIDcosca" class="endofrange"/>
66158 </para>
66159 </section>
66160 </chapter>
66161
66162 <chapter id="CHAPlocalscan">
66163 <title>Adding a local scan function to Exim</title>
66164 <titleabbrev>Local scan function</titleabbrev>
66165 <para>
66166 <indexterm role="concept" id="IIDlosca" class="startofrange">
66167 <primary><function>local_scan()</function> function</primary>
66168 <secondary>description of</secondary>
66169 </indexterm>
66170 <indexterm role="concept">
66171 <primary>customizing</primary>
66172 <secondary>input scan using C function</secondary>
66173 </indexterm>
66174 <indexterm role="concept">
66175 <primary>policy control</primary>
66176 <secondary>by local scan function</secondary>
66177 </indexterm>
66178 In these days of email worms, viruses, and ever-increasing spam, some sites
66179 want to apply a lot of checking to messages before accepting them.
66180 </para>
66181 <para>
66182 The content scanning extension (chapter <xref linkend="CHAPexiscan"/>) has facilities for
66183 passing messages to external virus and spam scanning software. You can also do
66184 a certain amount in Exim itself through string expansions and the <option>condition</option>
66185 condition in the ACL that runs after the SMTP DATA command or the ACL for
66186 non-SMTP messages (see chapter <xref linkend="CHAPACL"/>), but this has its limitations.
66187 </para>
66188 <para>
66189 To allow for further customization to a site&#x2019;s own requirements, there is the
66190 possibility of linking Exim with a private message scanning function, written
66191 in C. If you want to run code that is written in something other than C, you
66192 can of course use a little C stub to call it.
66193 </para>
66194 <para>
66195 The local scan function is run once for every incoming message, at the point
66196 when Exim is just about to accept the message.
66197 It can therefore be used to control non-SMTP messages from local processes as
66198 well as messages arriving via SMTP.
66199 </para>
66200 <para>
66201 Exim applies a timeout to calls of the local scan function, and there is an
66202 option called <option>local_scan_timeout</option> for setting it. The default is 5 minutes.
66203 Zero means <quote>no timeout</quote>.
66204 Exim also sets up signal handlers for SIGSEGV, SIGILL, SIGFPE, and SIGBUS
66205 before calling the local scan function, so that the most common types of crash
66206 are caught. If the timeout is exceeded or one of those signals is caught, the
66207 incoming message is rejected with a temporary error if it is an SMTP message.
66208 For a non-SMTP message, the message is dropped and Exim ends with a non-zero
66209 code. The incident is logged on the main and reject logs.
66210 </para>
66211 <section id="SECID207">
66212 <title>Building Exim to use a local scan function</title>
66213 <para>
66214 <indexterm role="concept">
66215 <primary><function>local_scan()</function> function</primary>
66216 <secondary>building Exim to use</secondary>
66217 </indexterm>
66218 To make use of the local scan function feature, you must tell Exim where your
66219 function is before building Exim, by setting
66220 both HAVE_LOCAL_SCAN and
66221 LOCAL_SCAN_SOURCE in your
66222 <filename>Local/Makefile</filename>. A recommended place to put it is in the <filename>Local</filename>
66223 directory, so you might set
66224 </para>
66225 <literallayout class="monospaced">
66226 HAVE_LOCAL_SCAN=yes
66227 LOCAL_SCAN_SOURCE=Local/local_scan.c
66228 </literallayout>
66229 <para>
66230 for example. The function must be called <function>local_scan()</function>;
66231 the source file(s) for it should first #define LOCAL_SCAN
66232 and then #include "local_scan.h".
66233 It is called by
66234 Exim after it has received a message, when the success return code is about to
66235 be sent. This is after all the ACLs have been run. The return code from your
66236 function controls whether the message is actually accepted or not. There is a
66237 commented template function (that just accepts the message) in the file
66238 _src/local_scan.c_.
66239 </para>
66240 <para>
66241 If you want to make use of Exim&#x2019;s runtime configuration file to set options
66242 for your <function>local_scan()</function> function, you must also set
66243 </para>
66244 <literallayout class="monospaced">
66245 LOCAL_SCAN_HAS_OPTIONS=yes
66246 </literallayout>
66247 <para>
66248 in <filename>Local/Makefile</filename> (see section <xref linkend="SECTconoptloc"/> below).
66249 </para>
66250 </section>
66251 <section id="SECTapiforloc">
66252 <title>API for local_scan()</title>
66253 <para>
66254 <indexterm role="concept">
66255 <primary><function>local_scan()</function> function</primary>
66256 <secondary>API description</secondary>
66257 </indexterm>
66258 <indexterm role="concept">
66259 <primary><option>dlfunc</option></primary>
66260 <secondary>API description</secondary>
66261 </indexterm>
66262 You must include this line near the start of your code:
66263 </para>
66264 <literallayout class="monospaced">
66265 #define LOCAL_SCAN
66266 #include "local_scan.h"
66267 </literallayout>
66268 <para>
66269 This header file defines a number of variables and other values, and the
66270 prototype for the function itself. Exim is coded to use unsigned char values
66271 almost exclusively, and one of the things this header defines is a shorthand
66272 for <literal>unsigned char</literal> called <literal>uschar</literal>.
66273 It also makes available the following macro definitions, to simplify casting character
66274 strings and pointers to character strings:
66275 </para>
66276 <literallayout class="monospaced">
66277 #define CS   (char *)
66278 #define CCS  (const char *)
66279 #define CSS  (char **)
66280 #define US   (unsigned char *)
66281 #define CUS  (const unsigned char *)
66282 #define USS  (unsigned char **)
66283 </literallayout>
66284 <para>
66285 The function prototype for <function>local_scan()</function> is:
66286 </para>
66287 <literallayout class="monospaced">
66288 extern int local_scan(int fd, uschar **return_text);
66289 </literallayout>
66290 <para>
66291 The arguments are as follows:
66292 </para>
66293 <itemizedlist>
66294 <listitem>
66295 <para>
66296 <option>fd</option> is a file descriptor for the file that contains the body of the message
66297 (the -D file). The file is open for reading and writing, but updating it is not
66298 recommended. <emphasis role="bold">Warning</emphasis>: You must <emphasis>not</emphasis> close this file descriptor.
66299 </para>
66300 <para>
66301 The descriptor is positioned at character 19 of the file, which is the first
66302 character of the body itself, because the first 19 characters are the message
66303 id followed by <literal>-D</literal> and a newline. If you rewind the file, you should use the
66304 macro SPOOL_DATA_START_OFFSET to reset to the start of the data, just in
66305 case this changes in some future version.
66306 </para>
66307 </listitem>
66308 <listitem>
66309 <para>
66310 <option>return_text</option> is an address which you can use to return a pointer to a text
66311 string at the end of the function. The value it points to on entry is NULL.
66312 </para>
66313 </listitem>
66314 </itemizedlist>
66315 <para>
66316 The function must return an <option>int</option> value which is one of the following macros:
66317 </para>
66318 <variablelist>
66319 <varlistentry>
66320 <term><literal>LOCAL_SCAN_ACCEPT</literal></term>
66321 <listitem>
66322 <para>
66323 <indexterm role="variable">
66324 <primary><varname>$local_scan_data</varname></primary>
66325 </indexterm>
66326 The message is accepted. If you pass back a string of text, it is saved with
66327 the message, and made available in the variable <varname>$local_scan_data</varname>. No
66328 newlines are permitted (if there are any, they are turned into spaces) and the
66329 maximum length of text is 1000 characters.
66330 </para>
66331 </listitem></varlistentry>
66332 <varlistentry>
66333 <term><literal>LOCAL_SCAN_ACCEPT_FREEZE</literal></term>
66334 <listitem>
66335 <para>
66336 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
66337 queued without immediate delivery, and is frozen.
66338 </para>
66339 </listitem></varlistentry>
66340 <varlistentry>
66341 <term><literal>LOCAL_SCAN_ACCEPT_QUEUE</literal></term>
66342 <listitem>
66343 <para>
66344 This behaves as LOCAL_SCAN_ACCEPT, except that the accepted message is
66345 queued without immediate delivery.
66346 </para>
66347 </listitem></varlistentry>
66348 <varlistentry>
66349 <term><literal>LOCAL_SCAN_REJECT</literal></term>
66350 <listitem>
66351 <para>
66352 The message is rejected; the returned text is used as an error message which is
66353 passed back to the sender and which is also logged. Newlines are permitted &ndash;
66354 they cause a multiline response for SMTP rejections, but are converted to
66355 <literal>\n</literal> in log lines. If no message is given, <quote>Administrative prohibition</quote> is
66356 used.
66357 </para>
66358 </listitem></varlistentry>
66359 <varlistentry>
66360 <term><literal>LOCAL_SCAN_TEMPREJECT</literal></term>
66361 <listitem>
66362 <para>
66363 The message is temporarily rejected; the returned text is used as an error
66364 message as for LOCAL_SCAN_REJECT. If no message is given, <quote>Temporary local
66365 problem</quote> is used.
66366 </para>
66367 </listitem></varlistentry>
66368 <varlistentry>
66369 <term><literal>LOCAL_SCAN_REJECT_NOLOGHDR</literal></term>
66370 <listitem>
66371 <para>
66372 This behaves as LOCAL_SCAN_REJECT, except that the header of the rejected
66373 message is not written to the reject log. It has the effect of unsetting the
66374 <option>rejected_header</option> log selector for just this rejection. If
66375 <option>rejected_header</option> is already unset (see the discussion of the
66376 <option>log_selection</option> option in section <xref linkend="SECTlogselector"/>), this code is the
66377 same as LOCAL_SCAN_REJECT.
66378 </para>
66379 </listitem></varlistentry>
66380 <varlistentry>
66381 <term><literal>LOCAL_SCAN_TEMPREJECT_NOLOGHDR</literal></term>
66382 <listitem>
66383 <para>
66384 This code is a variation of LOCAL_SCAN_TEMPREJECT in the same way that
66385 LOCAL_SCAN_REJECT_NOLOGHDR is a variation of LOCAL_SCAN_REJECT.
66386 </para>
66387 </listitem></varlistentry>
66388 </variablelist>
66389 <para>
66390 If the message is not being received by interactive SMTP, rejections are
66391 reported by writing to <option>stderr</option> or by sending an email, as configured by the
66392 <option>-oe</option> command line options.
66393 </para>
66394 </section>
66395 <section id="SECTconoptloc">
66396 <title>Configuration options for local_scan()</title>
66397 <para>
66398 <indexterm role="concept">
66399 <primary><function>local_scan()</function> function</primary>
66400 <secondary>configuration options</secondary>
66401 </indexterm>
66402 It is possible to have option settings in the main configuration file
66403 that set values in static variables in the <function>local_scan()</function> module. If you
66404 want to do this, you must have the line
66405 </para>
66406 <literallayout class="monospaced">
66407 LOCAL_SCAN_HAS_OPTIONS=yes
66408 </literallayout>
66409 <para>
66410 in your <filename>Local/Makefile</filename> when you build Exim. (This line is in
66411 <filename>OS/Makefile-Default</filename>, commented out). Then, in the <function>local_scan()</function> source
66412 file, you must define static variables to hold the option values, and a table
66413 to define them.
66414 </para>
66415 <para>
66416 The table must be a vector called <option>local_scan_options</option>, of type
66417 <literal>optionlist</literal>. Each entry is a triplet, consisting of a name, an option type,
66418 and a pointer to the variable that holds the value. The entries must appear in
66419 alphabetical order. Following <option>local_scan_options</option> you must also define a
66420 variable called <option>local_scan_options_count</option> that contains the number of
66421 entries in the table. Here is a short example, showing two kinds of option:
66422 </para>
66423 <literallayout class="monospaced">
66424 static int my_integer_option = 42;
66425 static uschar *my_string_option = US"a default string";
66426
66427 optionlist local_scan_options[] = {
66428   { "my_integer", opt_int,       &amp;my_integer_option },
66429   { "my_string",  opt_stringptr, &amp;my_string_option }
66430 };
66431
66432 int local_scan_options_count =
66433   sizeof(local_scan_options)/sizeof(optionlist);
66434 </literallayout>
66435 <para>
66436 The values of the variables can now be changed from Exim&#x2019;s runtime
66437 configuration file by including a local scan section as in this example:
66438 </para>
66439 <literallayout class="monospaced">
66440 begin local_scan
66441 my_integer = 99
66442 my_string = some string of text...
66443 </literallayout>
66444 <para>
66445 The available types of option data are as follows:
66446 </para>
66447 <variablelist>
66448 <varlistentry>
66449 <term><emphasis role="bold">opt_bool</emphasis></term>
66450 <listitem>
66451 <para>
66452 This specifies a boolean (true/false) option. The address should point to a
66453 variable of type <literal>BOOL</literal>, which will be set to TRUE or FALSE, which are macros
66454 that are defined as <quote>1</quote> and <quote>0</quote>, respectively. If you want to detect
66455 whether such a variable has been set at all, you can initialize it to
66456 TRUE_UNSET. (BOOL variables are integers underneath, so can hold more than two
66457 values.)
66458 </para>
66459 </listitem></varlistentry>
66460 <varlistentry>
66461 <term><emphasis role="bold">opt_fixed</emphasis></term>
66462 <listitem>
66463 <para>
66464 This specifies a fixed point number, such as is used for load averages.
66465 The address should point to a variable of type <literal>int</literal>. The value is stored
66466 multiplied by 1000, so, for example, 1.4142 is truncated and stored as 1414.
66467 </para>
66468 </listitem></varlistentry>
66469 <varlistentry>
66470 <term><emphasis role="bold">opt_int</emphasis></term>
66471 <listitem>
66472 <para>
66473 This specifies an integer; the address should point to a variable of type
66474 <literal>int</literal>. The value may be specified in any of the integer formats accepted by
66475 Exim.
66476 </para>
66477 </listitem></varlistentry>
66478 <varlistentry>
66479 <term><emphasis role="bold">opt_mkint</emphasis></term>
66480 <listitem>
66481 <para>
66482 This is the same as <option>opt_int</option>, except that when such a value is output in a
66483 <option>-bP</option> listing, if it is an exact number of kilobytes or megabytes, it is
66484 printed with the suffix K or M.
66485 </para>
66486 </listitem></varlistentry>
66487 <varlistentry>
66488 <term><emphasis role="bold">opt_octint</emphasis></term>
66489 <listitem>
66490 <para>
66491 This also specifies an integer, but the value is always interpreted as an
66492 octal integer, whether or not it starts with the digit zero, and it is
66493 always output in octal.
66494 </para>
66495 </listitem></varlistentry>
66496 <varlistentry>
66497 <term><emphasis role="bold">opt_stringptr</emphasis></term>
66498 <listitem>
66499 <para>
66500 This specifies a string value; the address must be a pointer to a
66501 variable that points to a string (for example, of type <literal>uschar *</literal>).
66502 </para>
66503 </listitem></varlistentry>
66504 <varlistentry>
66505 <term><emphasis role="bold">opt_time</emphasis></term>
66506 <listitem>
66507 <para>
66508 This specifies a time interval value. The address must point to a variable of
66509 type <literal>int</literal>. The value that is placed there is a number of seconds.
66510 </para>
66511 </listitem></varlistentry>
66512 </variablelist>
66513 <para>
66514 If the <option>-bP</option> command line option is followed by <literal>local_scan</literal>, Exim prints
66515 out the values of all the <function>local_scan()</function> options.
66516 </para>
66517 </section>
66518 <section id="SECID208">
66519 <title>Available Exim variables</title>
66520 <para>
66521 <indexterm role="concept">
66522 <primary><function>local_scan()</function> function</primary>
66523 <secondary>available Exim variables</secondary>
66524 </indexterm>
66525 The header <filename>local_scan.h</filename> gives you access to a number of C variables. These
66526 are the only ones that are guaranteed to be maintained from release to release.
66527 Note, however, that you can obtain the value of any Exim expansion variable,
66528 including <varname>$recipients</varname>, by calling <emphasis>expand_string()</emphasis>. The exported
66529 C variables are as follows:
66530 </para>
66531 <variablelist>
66532 <varlistentry>
66533 <term><emphasis role="bold">int&nbsp;body_linecount</emphasis></term>
66534 <listitem>
66535 <para>
66536 This variable contains the number of lines in the message&#x2019;s body.
66537 It is not valid if the <option>spool_wireformat</option> option is used.
66538 </para>
66539 </listitem></varlistentry>
66540 <varlistentry>
66541 <term><emphasis role="bold">int&nbsp;body_zerocount</emphasis></term>
66542 <listitem>
66543 <para>
66544 This variable contains the number of binary zero bytes in the message&#x2019;s body.
66545 It is not valid if the <option>spool_wireformat</option> option is used.
66546 </para>
66547 </listitem></varlistentry>
66548 <varlistentry>
66549 <term><emphasis role="bold">unsigned&nbsp;int&nbsp;debug_selector</emphasis></term>
66550 <listitem>
66551 <para>
66552 This variable is set to zero when no debugging is taking place. Otherwise, it
66553 is a bitmap of debugging selectors. Two bits are identified for use in
66554 <function>local_scan()</function>; they are defined as macros:
66555 </para>
66556 <itemizedlist>
66557 <listitem>
66558 <para>
66559 The <literal>D_v</literal> bit is set when <option>-v</option> was present on the command line. This is a
66560 testing option that is not privileged &ndash; any caller may set it. All the
66561 other selector bits can be set only by admin users.
66562 </para>
66563 </listitem>
66564 <listitem>
66565 <para>
66566 The <literal>D_local_scan</literal> bit is provided for use by <function>local_scan()</function>; it is set
66567 by the <literal>+local_scan</literal> debug selector. It is not included in the default set
66568 of debugging bits.
66569 </para>
66570 </listitem>
66571 </itemizedlist>
66572 <para>
66573 Thus, to write to the debugging output only when <literal>+local_scan</literal> has been
66574 selected, you should use code like this:
66575 </para>
66576 <literallayout class="monospaced">
66577 if ((debug_selector &amp; D_local_scan) != 0)
66578   debug_printf("xxx", ...);
66579 </literallayout>
66580 </listitem></varlistentry>
66581 <varlistentry>
66582 <term><emphasis role="bold">uschar&nbsp;*expand_string_message</emphasis></term>
66583 <listitem>
66584 <para>
66585 After a failing call to <emphasis>expand_string()</emphasis> (returned value NULL), the
66586 variable <option>expand_string_message</option> contains the error message, zero-terminated.
66587 </para>
66588 </listitem></varlistentry>
66589 <varlistentry>
66590 <term><emphasis role="bold">header_line&nbsp;*header_list</emphasis></term>
66591 <listitem>
66592 <para>
66593 A pointer to a chain of header lines. The <option>header_line</option> structure is
66594 discussed below.
66595 </para>
66596 </listitem></varlistentry>
66597 <varlistentry>
66598 <term><emphasis role="bold">header_line&nbsp;*header_last</emphasis></term>
66599 <listitem>
66600 <para>
66601 A pointer to the last of the header lines.
66602 </para>
66603 </listitem></varlistentry>
66604 <varlistentry revisionflag="changed">
66605 <term><emphasis role="bold">const&nbsp;uschar&nbsp;*headers_charset</emphasis></term>
66606 <listitem>
66607 <para revisionflag="changed">
66608 The value of the <option>headers_charset</option> configuration option.
66609 </para>
66610 </listitem></varlistentry>
66611 <varlistentry>
66612 <term><emphasis role="bold">BOOL&nbsp;host_checking</emphasis></term>
66613 <listitem>
66614 <para>
66615 This variable is TRUE during a host checking session that is initiated by the
66616 <option>-bh</option> command line option.
66617 </para>
66618 </listitem></varlistentry>
66619 <varlistentry>
66620 <term><emphasis role="bold">uschar&nbsp;*interface_address</emphasis></term>
66621 <listitem>
66622 <para>
66623 The IP address of the interface that received the message, as a string. This
66624 is NULL for locally submitted messages.
66625 </para>
66626 </listitem></varlistentry>
66627 <varlistentry>
66628 <term><emphasis role="bold">int&nbsp;interface_port</emphasis></term>
66629 <listitem>
66630 <para>
66631 The port on which this message was received. When testing with the <option>-bh</option>
66632 command line option, the value of this variable is -1 unless a port has been
66633 specified via the <option>-oMi</option> option.
66634 </para>
66635 </listitem></varlistentry>
66636 <varlistentry>
66637 <term><emphasis role="bold">uschar&nbsp;*message_id</emphasis></term>
66638 <listitem>
66639 <para>
66640 This variable contains Exim&#x2019;s message id for the incoming message (the value of
66641 <varname>$message_exim_id</varname>) as a zero-terminated string.
66642 </para>
66643 </listitem></varlistentry>
66644 <varlistentry>
66645 <term><emphasis role="bold">uschar&nbsp;*received_protocol</emphasis></term>
66646 <listitem>
66647 <para>
66648 The name of the protocol by which the message was received.
66649 </para>
66650 </listitem></varlistentry>
66651 <varlistentry>
66652 <term><emphasis role="bold">int&nbsp;recipients_count</emphasis></term>
66653 <listitem>
66654 <para>
66655 The number of accepted recipients.
66656 </para>
66657 </listitem></varlistentry>
66658 <varlistentry>
66659 <term><emphasis role="bold">recipient_item&nbsp;*recipients_list</emphasis></term>
66660 <listitem>
66661 <para>
66662 <indexterm role="concept">
66663 <primary>recipient</primary>
66664 <secondary>adding in local scan</secondary>
66665 </indexterm>
66666 <indexterm role="concept">
66667 <primary>recipient</primary>
66668 <secondary>removing in local scan</secondary>
66669 </indexterm>
66670 The list of accepted recipients, held in a vector of length
66671 <option>recipients_count</option>. The <option>recipient_item</option> structure is discussed below. You
66672 can add additional recipients by calling <emphasis>receive_add_recipient()</emphasis> (see
66673 below). You can delete recipients by removing them from the vector and
66674 adjusting the value in <option>recipients_count</option>. In particular, by setting
66675 <option>recipients_count</option> to zero you remove all recipients. If you then return the
66676 value <literal>LOCAL_SCAN_ACCEPT</literal>, the message is accepted, but immediately
66677 blackholed. To replace the recipients, you can set <option>recipients_count</option> to zero
66678 and then call <emphasis>receive_add_recipient()</emphasis> as often as needed.
66679 </para>
66680 </listitem></varlistentry>
66681 <varlistentry>
66682 <term><emphasis role="bold">uschar&nbsp;*sender_address</emphasis></term>
66683 <listitem>
66684 <para>
66685 The envelope sender address. For bounce messages this is the empty string.
66686 </para>
66687 </listitem></varlistentry>
66688 <varlistentry>
66689 <term><emphasis role="bold">uschar&nbsp;*sender_host_address</emphasis></term>
66690 <listitem>
66691 <para>
66692 The IP address of the sending host, as a string. This is NULL for
66693 locally-submitted messages.
66694 </para>
66695 </listitem></varlistentry>
66696 <varlistentry>
66697 <term><emphasis role="bold">uschar&nbsp;*sender_host_authenticated</emphasis></term>
66698 <listitem>
66699 <para>
66700 The name of the authentication mechanism that was used, or NULL if the message
66701 was not received over an authenticated SMTP connection.
66702 </para>
66703 </listitem></varlistentry>
66704 <varlistentry>
66705 <term><emphasis role="bold">uschar&nbsp;*sender_host_name</emphasis></term>
66706 <listitem>
66707 <para>
66708 The name of the sending host, if known.
66709 </para>
66710 </listitem></varlistentry>
66711 <varlistentry>
66712 <term><emphasis role="bold">int&nbsp;sender_host_port</emphasis></term>
66713 <listitem>
66714 <para>
66715 The port on the sending host.
66716 </para>
66717 </listitem></varlistentry>
66718 <varlistentry>
66719 <term><emphasis role="bold">BOOL&nbsp;smtp_input</emphasis></term>
66720 <listitem>
66721 <para>
66722 This variable is TRUE for all SMTP input, including BSMTP.
66723 </para>
66724 </listitem></varlistentry>
66725 <varlistentry>
66726 <term><emphasis role="bold">BOOL&nbsp;smtp_batched_input</emphasis></term>
66727 <listitem>
66728 <para>
66729 This variable is TRUE for BSMTP input.
66730 </para>
66731 </listitem></varlistentry>
66732 <varlistentry>
66733 <term><emphasis role="bold">int&nbsp;store_pool</emphasis></term>
66734 <listitem>
66735 <para>
66736 The contents of this variable control which pool of memory is used for new
66737 requests. See section <xref linkend="SECTmemhanloc"/> for details.
66738 </para>
66739 </listitem></varlistentry>
66740 </variablelist>
66741 </section>
66742 <section id="SECID209">
66743 <title>Structure of header lines</title>
66744 <para>
66745 The <option>header_line</option> structure contains the members listed below.
66746 You can add additional header lines by calling the <emphasis>header_add()</emphasis> function
66747 (see below). You can cause header lines to be ignored (deleted) by setting
66748 their type to *.
66749 </para>
66750 <variablelist>
66751 <varlistentry>
66752 <term><emphasis role="bold">struct&nbsp;header_line&nbsp;*next</emphasis></term>
66753 <listitem>
66754 <para>
66755 A pointer to the next header line, or NULL for the last line.
66756 </para>
66757 </listitem></varlistentry>
66758 <varlistentry>
66759 <term><emphasis role="bold">int&nbsp;type</emphasis></term>
66760 <listitem>
66761 <para>
66762 A code identifying certain headers that Exim recognizes. The codes are printing
66763 characters, and are documented in chapter <xref linkend="CHAPspool"/> of this manual.
66764 Notice in particular that any header line whose type is * is not transmitted
66765 with the message. This flagging is used for header lines that have been
66766 rewritten, or are to be removed (for example, <emphasis>Envelope-sender:</emphasis> header
66767 lines.) Effectively, * means <quote>deleted</quote>.
66768 </para>
66769 </listitem></varlistentry>
66770 <varlistentry>
66771 <term><emphasis role="bold">int&nbsp;slen</emphasis></term>
66772 <listitem>
66773 <para>
66774 The number of characters in the header line, including the terminating and any
66775 internal newlines.
66776 </para>
66777 </listitem></varlistentry>
66778 <varlistentry>
66779 <term><emphasis role="bold">uschar&nbsp;*text</emphasis></term>
66780 <listitem>
66781 <para>
66782 A pointer to the text of the header. It always ends with a newline, followed by
66783 a zero byte. Internal newlines are preserved.
66784 </para>
66785 </listitem></varlistentry>
66786 </variablelist>
66787 </section>
66788 <section id="SECID210">
66789 <title>Structure of recipient items</title>
66790 <para>
66791 The <option>recipient_item</option> structure contains these members:
66792 </para>
66793 <variablelist>
66794 <varlistentry>
66795 <term><emphasis role="bold">uschar&nbsp;*address</emphasis></term>
66796 <listitem>
66797 <para>
66798 This is a pointer to the recipient address as it was received.
66799 </para>
66800 </listitem></varlistentry>
66801 <varlistentry>
66802 <term><emphasis role="bold">int&nbsp;pno</emphasis></term>
66803 <listitem>
66804 <para>
66805 This is used in later Exim processing when top level addresses are created by
66806 the <option>one_time</option> option. It is not relevant at the time <function>local_scan()</function> is run
66807 and must always contain -1 at this stage.
66808 </para>
66809 </listitem></varlistentry>
66810 <varlistentry>
66811 <term><emphasis role="bold">uschar&nbsp;*errors_to</emphasis></term>
66812 <listitem>
66813 <para>
66814 If this value is not NULL, bounce messages caused by failing to deliver to the
66815 recipient are sent to the address it contains. In other words, it overrides the
66816 envelope sender for this one recipient. (Compare the <option>errors_to</option> generic
66817 router option.) If a <function>local_scan()</function> function sets an <option>errors_to</option> field to
66818 an unqualified address, Exim qualifies it using the domain from
66819 <option>qualify_recipient</option>. When <function>local_scan()</function> is called, the <option>errors_to</option> field
66820 is NULL for all recipients.
66821 </para>
66822 </listitem></varlistentry>
66823 </variablelist>
66824 </section>
66825 <section id="SECID211">
66826 <title>Available Exim functions</title>
66827 <para>
66828 <indexterm role="concept">
66829 <primary><function>local_scan()</function> function</primary>
66830 <secondary>available Exim functions</secondary>
66831 </indexterm>
66832 The header <filename>local_scan.h</filename> gives you access to a number of Exim functions.
66833 These are the only ones that are guaranteed to be maintained from release to
66834 release:
66835 </para>
66836 <variablelist>
66837 <varlistentry>
66838 <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>
66839 <listitem>
66840 <para>
66841 This function creates a child process that runs the command specified by
66842 <option>argv</option>. The environment for the process is specified by <option>envp</option>, which can
66843 be NULL if no environment variables are to be passed. A new umask is supplied
66844 for the process in <option>newumask</option>.
66845 </para>
66846 <para>
66847 Pipes to the standard input and output of the new process are set up
66848 and returned to the caller via the <option>infdptr</option> and <option>outfdptr</option> arguments. The
66849 standard error is cloned to the standard output. If there are any file
66850 descriptors <quote>in the way</quote> in the new process, they are closed. If the final
66851 argument is TRUE, the new process is made into a process group leader.
66852 </para>
66853 <para>
66854 The function returns the pid of the new process, or -1 if things go wrong.
66855 </para>
66856 </listitem></varlistentry>
66857 <varlistentry>
66858 <term><emphasis role="bold">int&nbsp;child_close(pid_t&nbsp;pid,&nbsp;int&nbsp;timeout)</emphasis></term>
66859 <listitem>
66860 <para>
66861 This function waits for a child process to terminate, or for a timeout (in
66862 seconds) to expire. A timeout value of zero means wait as long as it takes. The
66863 return value is as follows:
66864 </para>
66865 <itemizedlist>
66866 <listitem>
66867 <para>
66868 &gt;= 0
66869 </para>
66870 <para>
66871 The process terminated by a normal exit and the value is the process
66872 ending status.
66873 </para>
66874 </listitem>
66875 <listitem>
66876 <para>
66877 &lt; 0 and &gt; &ndash;256
66878 </para>
66879 <para>
66880 The process was terminated by a signal and the value is the negation of the
66881 signal number.
66882 </para>
66883 </listitem>
66884 <listitem>
66885 <para>
66886 &ndash;256
66887 </para>
66888 <para>
66889 The process timed out.
66890 </para>
66891 </listitem>
66892 <listitem>
66893 <para>
66894 &ndash;257
66895 </para>
66896 <para>
66897 The was some other error in wait(); <option>errno</option> is still set.
66898 </para>
66899 </listitem>
66900 </itemizedlist>
66901 </listitem></varlistentry>
66902 <varlistentry>
66903 <term><emphasis role="bold">pid_t&nbsp;child_open_exim(int&nbsp;*fd)</emphasis></term>
66904 <listitem>
66905 <para>
66906 This function provide you with a means of submitting a new message to
66907 Exim. (Of course, you can also call <filename>/usr/sbin/sendmail</filename> yourself if you
66908 want, but this packages it all up for you.) The function creates a pipe,
66909 forks a subprocess that is running
66910 </para>
66911 <literallayout class="monospaced">
66912 exim -t -oem -oi -f &lt;&gt;
66913 </literallayout>
66914 <para>
66915 and returns to you (via the <literal>int *</literal> argument) a file descriptor for the pipe
66916 that is connected to the standard input. The yield of the function is the PID
66917 of the subprocess. You can then write a message to the file descriptor, with
66918 recipients in <emphasis>To:</emphasis>, <emphasis>Cc:</emphasis>, and/or <emphasis>Bcc:</emphasis> header lines.
66919 </para>
66920 <para>
66921 When you have finished, call <emphasis>child_close()</emphasis> to wait for the process to
66922 finish and to collect its ending status. A timeout value of zero is usually
66923 fine in this circumstance. Unless you have made a mistake with the recipient
66924 addresses, you should get a return code of zero.
66925 </para>
66926 </listitem></varlistentry>
66927 <varlistentry>
66928 <term><emphasis role="bold">pid_t&nbsp;child_open_exim2(int&nbsp;*fd,&nbsp;uschar&nbsp;*sender,&nbsp;uschar&nbsp;*sender_authentication)</emphasis></term>
66929 <listitem>
66930 <para>
66931 This function is a more sophisticated version of <emphasis>child_open()</emphasis>. The command
66932 that it runs is:
66933 </para>
66934 <literallayout>
66935 <literal>exim -t -oem -oi -f </literal><emphasis>sender</emphasis><literal> -oMas </literal><emphasis>sender_authentication</emphasis>
66936 </literallayout>
66937 <para>
66938 The third argument may be NULL, in which case the <option>-oMas</option> option is omitted.
66939 </para>
66940 </listitem></varlistentry>
66941 <varlistentry>
66942 <term><emphasis role="bold">void&nbsp;debug_printf(char&nbsp;*,&nbsp;...)</emphasis></term>
66943 <listitem>
66944 <para>
66945 This is Exim&#x2019;s debugging function, with arguments as for <emphasis>(printf()</emphasis>. The
66946 output is written to the standard error stream. If no debugging is selected,
66947 calls to <emphasis>debug_printf()</emphasis> have no effect. Normally, you should make calls
66948 conditional on the <literal>local_scan</literal> debug selector by coding like this:
66949 </para>
66950 <literallayout class="monospaced">
66951 if ((debug_selector &amp; D_local_scan) != 0)
66952   debug_printf("xxx", ...);
66953 </literallayout>
66954 </listitem></varlistentry>
66955 <varlistentry>
66956 <term><emphasis role="bold">uschar&nbsp;*expand_string(uschar&nbsp;*string)</emphasis></term>
66957 <listitem>
66958 <para>
66959 This is an interface to Exim&#x2019;s string expansion code. The return value is the
66960 expanded string, or NULL if there was an expansion failure.
66961 The C variable <option>expand_string_message</option> contains an error message after an
66962 expansion failure. If expansion does not change the string, the return value is
66963 the pointer to the input string. Otherwise, the return value points to a new
66964 block of memory that was obtained by a call to <emphasis>store_get()</emphasis>. See section
66965 <xref linkend="SECTmemhanloc"/> below for a discussion of memory handling.
66966 </para>
66967 </listitem></varlistentry>
66968 <varlistentry>
66969 <term><emphasis role="bold">void&nbsp;header_add(int&nbsp;type,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
66970 <listitem>
66971 <para>
66972 This function allows you to an add additional header line at the end of the
66973 existing ones. The first argument is the type, and should normally be a space
66974 character. The second argument is a format string and any number of
66975 substitution arguments as for <function>sprintf()</function>. You may include internal newlines
66976 if you want, and you must ensure that the string ends with a newline.
66977 </para>
66978 </listitem></varlistentry>
66979 <varlistentry>
66980 <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>
66981 <listitem>
66982 <para>
66983 This function adds a new header line at a specified point in the header
66984 chain. The header itself is specified as for <emphasis>header_add()</emphasis>.
66985 </para>
66986 <para>
66987 If <option>name</option> is NULL, the new header is added at the end of the chain if
66988 <option>after</option> is true, or at the start if <option>after</option> is false. If <option>name</option> is not
66989 NULL, the header lines are searched for the first non-deleted header that
66990 matches the name. If one is found, the new header is added before it if
66991 <option>after</option> is false. If <option>after</option> is true, the new header is added after the
66992 found header and any adjacent subsequent ones with the same name (even if
66993 marked <quote>deleted</quote>). If no matching non-deleted header is found, the <option>topnot</option>
66994 option controls where the header is added. If it is true, addition is at the
66995 top; otherwise at the bottom. Thus, to add a header after all the <emphasis>Received:</emphasis>
66996 headers, or at the top if there are no <emphasis>Received:</emphasis> headers, you could use
66997 </para>
66998 <literallayout class="monospaced">
66999 header_add_at_position(TRUE, US"Received", TRUE,
67000   ' ', "X-xxx: ...");
67001 </literallayout>
67002 <para>
67003 Normally, there is always at least one non-deleted <emphasis>Received:</emphasis> header, but
67004 there may not be if <option>received_header_text</option> expands to an empty string.
67005 </para>
67006 </listitem></varlistentry>
67007 <varlistentry>
67008 <term><emphasis role="bold">void&nbsp;header_remove(int&nbsp;occurrence,&nbsp;uschar&nbsp;*name)</emphasis></term>
67009 <listitem>
67010 <para>
67011 This function removes header lines. If <option>occurrence</option> is zero or negative, all
67012 occurrences of the header are removed. If occurrence is greater than zero, that
67013 particular instance of the header is removed. If no header(s) can be found that
67014 match the specification, the function does nothing.
67015 </para>
67016 </listitem></varlistentry>
67017 <varlistentry>
67018 <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>
67019 <listitem>
67020 <para>
67021 This function tests whether the given header has the given name. It is not just
67022 a string comparison, because white space is permitted between the name and the
67023 colon. If the <option>notdel</option> argument is true, a false return is forced for all
67024 <quote>deleted</quote> headers; otherwise they are not treated specially. For example:
67025 </para>
67026 <literallayout class="monospaced">
67027 if (header_testname(h, US"X-Spam", 6, TRUE)) ...
67028 </literallayout>
67029 </listitem></varlistentry>
67030 <varlistentry>
67031 <term><emphasis role="bold">uschar&nbsp;*lss_b64encode(uschar&nbsp;*cleartext,&nbsp;int&nbsp;length)</emphasis></term>
67032 <listitem>
67033 <para>
67034 <indexterm role="concept">
67035 <primary>base64 encoding</primary>
67036 <secondary>functions for <function>local_scan()</function> use</secondary>
67037 </indexterm>
67038 This function base64-encodes a string, which is passed by address and length.
67039 The text may contain bytes of any value, including zero. The result is passed
67040 back in dynamic memory that is obtained by calling <emphasis>store_get()</emphasis>. It is
67041 zero-terminated.
67042 </para>
67043 </listitem></varlistentry>
67044 <varlistentry>
67045 <term><emphasis role="bold">int&nbsp;lss_b64decode(uschar&nbsp;*codetext,&nbsp;uschar&nbsp;**cleartext)</emphasis></term>
67046 <listitem>
67047 <para>
67048 This function decodes a base64-encoded string. Its arguments are a
67049 zero-terminated base64-encoded string and the address of a variable that is set
67050 to point to the result, which is in dynamic memory. The length of the decoded
67051 string is the yield of the function. If the input is invalid base64 data, the
67052 yield is -1. A zero byte is added to the end of the output string to make it
67053 easy to interpret as a C string (assuming it contains no zeros of its own). The
67054 added zero byte is not included in the returned count.
67055 </para>
67056 </listitem></varlistentry>
67057 <varlistentry>
67058 <term><emphasis role="bold">int&nbsp;lss_match_domain(uschar&nbsp;*domain,&nbsp;uschar&nbsp;*list)</emphasis></term>
67059 <listitem>
67060 <para>
67061 This function checks for a match in a domain list. Domains are always
67062 matched caselessly. The return value is one of the following:
67063 </para>
67064 <informaltable frame="none">
67065 <tgroup cols="2" colsep="0" rowsep="0">
67066 <colspec colwidth="1pt" align="left"/>
67067 <colspec colwidth="1pt" align="left"/>
67068 <tbody>
67069 <row>
67070 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>OK</literal></entry>
67071 <entry>match succeeded</entry>
67072 </row>
67073 <row>
67074 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>FAIL</literal></entry>
67075 <entry>match failed</entry>
67076 </row>
67077 <row>
67078 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>DEFER</literal></entry>
67079 <entry>match deferred</entry>
67080 </row>
67081 </tbody>
67082 </tgroup>
67083 </informaltable>
67084 <para>
67085 DEFER is usually caused by some kind of lookup defer, such as the
67086 inability to contact a database.
67087 </para>
67088 </listitem></varlistentry>
67089 <varlistentry>
67090 <term><emphasis role="bold">int&nbsp;lss_match_local_part(uschar&nbsp;*localpart,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
67091 <listitem>
67092 <para>
67093 This function checks for a match in a local part list. The third argument
67094 controls case-sensitivity. The return values are as for
67095 <emphasis>lss_match_domain()</emphasis>.
67096 </para>
67097 </listitem></varlistentry>
67098 <varlistentry>
67099 <term><emphasis role="bold">int&nbsp;lss_match_address(uschar&nbsp;*address,&nbsp;uschar&nbsp;*list,&nbsp;BOOL&nbsp;caseless)</emphasis></term>
67100 <listitem>
67101 <para>
67102 This function checks for a match in an address list. The third argument
67103 controls the case-sensitivity of the local part match. The domain is always
67104 matched caselessly. The return values are as for <emphasis>lss_match_domain()</emphasis>.
67105 </para>
67106 </listitem></varlistentry>
67107 <varlistentry>
67108 <term><emphasis role="bold">int&nbsp;lss_match_host(uschar&nbsp;*host_name,&nbsp;uschar&nbsp;*host_address,&nbsp;uschar&nbsp;*list)</emphasis></term>
67109 <listitem>
67110 <para>
67111 This function checks for a match in a host list. The most common usage is
67112 expected to be
67113 </para>
67114 <literallayout class="monospaced">
67115 lss_match_host(sender_host_name, sender_host_address, ...)
67116 </literallayout>
67117 <para>
67118 <indexterm role="variable">
67119 <primary><varname>$sender_host_address</varname></primary>
67120 </indexterm>
67121 An empty address field matches an empty item in the host list. If the host name
67122 is NULL, the name corresponding to <varname>$sender_host_address</varname> is automatically
67123 looked up if a host name is required to match an item in the list. The return
67124 values are as for <emphasis>lss_match_domain()</emphasis>, but in addition, <emphasis>lss_match_host()</emphasis>
67125 returns ERROR in the case when it had to look up a host name, but the lookup
67126 failed.
67127 </para>
67128 </listitem></varlistentry>
67129 <varlistentry>
67130 <term><emphasis role="bold">void&nbsp;log_write(unsigned&nbsp;int&nbsp;selector,&nbsp;int&nbsp;which,&nbsp;char&nbsp;*format,&nbsp;...)</emphasis></term>
67131 <listitem>
67132 <para>
67133 This function writes to Exim&#x2019;s log files. The first argument should be zero (it
67134 is concerned with <option>log_selector</option>). The second argument can be <literal>LOG_MAIN</literal> or
67135 <literal>LOG_REJECT</literal> or <literal>LOG_PANIC</literal> or the inclusive <quote>or</quote> of any combination of
67136 them. It specifies to which log or logs the message is written. The remaining
67137 arguments are a format and relevant insertion arguments. The string should not
67138 contain any newlines, not even at the end.
67139 </para>
67140 </listitem></varlistentry>
67141 <varlistentry>
67142 <term><emphasis role="bold">void&nbsp;receive_add_recipient(uschar&nbsp;*address,&nbsp;int&nbsp;pno)</emphasis></term>
67143 <listitem>
67144 <para>
67145 This function adds an additional recipient to the message. The first argument
67146 is the recipient address. If it is unqualified (has no domain), it is qualified
67147 with the <option>qualify_recipient</option> domain. The second argument must always be -1.
67148 </para>
67149 <para>
67150 This function does not allow you to specify a private <option>errors_to</option> address (as
67151 described with the structure of <option>recipient_item</option> above), because it pre-dates
67152 the addition of that field to the structure. However, it is easy to add such a
67153 value afterwards. For example:
67154 </para>
67155 <literallayout class="monospaced">
67156  receive_add_recipient(US"monitor@mydom.example", -1);
67157  recipients_list[recipients_count-1].errors_to =
67158    US"postmaster@mydom.example";
67159 </literallayout>
67160 </listitem></varlistentry>
67161 <varlistentry>
67162 <term><emphasis role="bold">BOOL&nbsp;receive_remove_recipient(uschar&nbsp;*recipient)</emphasis></term>
67163 <listitem>
67164 <para>
67165 This is a convenience function to remove a named recipient from the list of
67166 recipients. It returns true if a recipient was removed, and false if no
67167 matching recipient could be found. The argument must be a complete email
67168 address.
67169 </para>
67170 </listitem></varlistentry>
67171 </variablelist>
67172 <para>
67173 <indexterm role="concept">
67174 <primary>RFC 2047</primary>
67175 </indexterm>
67176 </para>
67177 <variablelist>
67178 <varlistentry>
67179 <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>
67180 <listitem>
67181 <para>
67182 This function decodes strings that are encoded according to RFC 2047. Typically
67183 these are the contents of header lines. First, each <quote>encoded word</quote> is decoded
67184 from the Q or B encoding into a byte-string. Then, if provided with the name of
67185 a charset encoding, and if the <function>iconv()</function> function is available, an attempt is
67186 made  to translate the result to the named character set. If this fails, the
67187 binary string is returned with an error message.
67188 </para>
67189 <para>
67190 The first argument is the string to be decoded. If <option>lencheck</option> is TRUE, the
67191 maximum MIME word length is enforced. The third argument is the target
67192 encoding, or NULL if no translation is wanted.
67193 </para>
67194 <para>
67195 <indexterm role="concept">
67196 <primary>binary zero</primary>
67197 <secondary>in RFC 2047 decoding</secondary>
67198 </indexterm>
67199 <indexterm role="concept">
67200 <primary>RFC 2047</primary>
67201 <secondary>binary zero in</secondary>
67202 </indexterm>
67203 If a binary zero is encountered in the decoded string, it is replaced by the
67204 contents of the <option>zeroval</option> argument. For use with Exim headers, the value must
67205 not be 0 because header lines are handled as zero-terminated strings.
67206 </para>
67207 <para>
67208 The function returns the result of processing the string, zero-terminated; if
67209 <option>lenptr</option> is not NULL, the length of the result is set in the variable to
67210 which it points. When <option>zeroval</option> is 0, <option>lenptr</option> should not be NULL.
67211 </para>
67212 <para>
67213 If an error is encountered, the function returns NULL and uses the <option>error</option>
67214 argument to return an error message. The variable pointed to by <option>error</option> is
67215 set to NULL if there is no error; it may be set non-NULL even when the function
67216 returns a non-NULL value if decoding was successful, but there was a problem
67217 with translation.
67218 </para>
67219 </listitem></varlistentry>
67220 <varlistentry>
67221 <term><emphasis role="bold">int&nbsp;smtp_fflush(void)</emphasis></term>
67222 <listitem>
67223 <para>
67224 This function is used in conjunction with <emphasis>smtp_printf()</emphasis>, as described
67225 below.
67226 </para>
67227 </listitem></varlistentry>
67228 <varlistentry>
67229 <term><emphasis role="bold">void&nbsp;smtp_printf(char&nbsp;*,BOOL,&nbsp;...)</emphasis></term>
67230 <listitem>
67231 <para>
67232 The arguments of this function are almost like <function>printf()</function>; it writes to the SMTP
67233 output stream. You should use this function only when there is an SMTP output
67234 stream, that is, when the incoming message is being received via interactive
67235 SMTP. This is the case when <option>smtp_input</option> is TRUE and <option>smtp_batched_input</option>
67236 is FALSE. If you want to test for an incoming message from another host (as
67237 opposed to a local process that used the <option>-bs</option> command line option), you can
67238 test the value of <option>sender_host_address</option>, which is non-NULL when a remote host
67239 is involved.
67240 </para>
67241 <para>
67242 If an SMTP TLS connection is established, <emphasis>smtp_printf()</emphasis> uses the TLS
67243 output function, so it can be used for all forms of SMTP connection.
67244 </para>
67245 <para>
67246 The second argument is used to request that the data be buffered
67247 (when TRUE) or flushed (along with any previously buffered, when FALSE).
67248 This is advisory only, but likely to save on system-calls and packets
67249 sent when a sequence of calls to the function are made.
67250 </para>
67251 <para>
67252 The argument was added in Exim version 4.90 - changing the API/ABI.
67253 Nobody noticed until 4.93 was imminent, at which point the
67254 ABI version number was incremented.
67255 </para>
67256 <para>
67257 Strings that are written by <emphasis>smtp_printf()</emphasis> from within <function>local_scan()</function>
67258 must start with an appropriate response code: 550 if you are going to return
67259 LOCAL_SCAN_REJECT, 451 if you are going to return
67260 LOCAL_SCAN_TEMPREJECT, and 250 otherwise. Because you are writing the
67261 initial lines of a multi-line response, the code must be followed by a hyphen
67262 to indicate that the line is not the final response line. You must also ensure
67263 that the lines you write terminate with CRLF. For example:
67264 </para>
67265 <literallayout class="monospaced">
67266 smtp_printf("550-this is some extra info\r\n");
67267 return LOCAL_SCAN_REJECT;
67268 </literallayout>
67269 <para>
67270 Note that you can also create multi-line responses by including newlines in
67271 the data returned via the <option>return_text</option> argument. The added value of using
67272 <emphasis>smtp_printf()</emphasis> is that, for instance, you could introduce delays between
67273 multiple output lines.
67274 </para>
67275 <para>
67276 The <emphasis>smtp_printf()</emphasis> function does not return any error indication, because it
67277 does not
67278 guarantee a flush of
67279 pending output, and therefore does not test
67280 the state of the stream. (In the main code of Exim, flushing and error
67281 detection is done when Exim is ready for the next SMTP input command.) If
67282 you want to flush the output and check for an error (for example, the
67283 dropping of a TCP/IP connection), you can call <emphasis>smtp_fflush()</emphasis>, which has no
67284 arguments. It flushes the output stream, and returns a non-zero value if there
67285 is an error.
67286 </para>
67287 </listitem></varlistentry>
67288 <varlistentry>
67289 <term><emphasis role="bold">void&nbsp;*store_get(int,BOOL)</emphasis></term>
67290 <listitem>
67291 <para>
67292 This function accesses Exim&#x2019;s internal store (memory) manager. It gets a new
67293 chunk of memory whose size is given by the first argument.
67294 The second argument should be given as TRUE if the memory will be used for
67295 data possibly coming from an attacker (eg. the message content),
67296 FALSE if it is locally-sourced.
67297 Exim bombs out if it ever
67298 runs out of memory. See the next section for a discussion of memory handling.
67299 </para>
67300 </listitem></varlistentry>
67301 <varlistentry>
67302 <term><emphasis role="bold">void&nbsp;*store_get_perm(int,BOOL)</emphasis></term>
67303 <listitem>
67304 <para>
67305 This function is like <emphasis>store_get()</emphasis>, but it always gets memory from the
67306 permanent pool. See the next section for a discussion of memory handling.
67307 </para>
67308 </listitem></varlistentry>
67309 <varlistentry>
67310 <term><emphasis role="bold">uschar&nbsp;*string_copy(uschar&nbsp;*string)</emphasis></term>
67311 <listitem>
67312 <para>
67313 See below.
67314 </para>
67315 </listitem></varlistentry>
67316 <varlistentry>
67317 <term><emphasis role="bold">uschar&nbsp;*string_copyn(uschar&nbsp;*string,&nbsp;int&nbsp;length)</emphasis></term>
67318 <listitem>
67319 <para>
67320 See below.
67321 </para>
67322 </listitem></varlistentry>
67323 <varlistentry>
67324 <term><emphasis role="bold">uschar&nbsp;*string_sprintf(char&nbsp;*format,&nbsp;...)</emphasis></term>
67325 <listitem>
67326 <para>
67327 These three functions create strings using Exim&#x2019;s dynamic memory facilities.
67328 The first makes a copy of an entire string. The second copies up to a maximum
67329 number of characters, indicated by the second argument. The third uses a format
67330 and insertion arguments to create a new string. In each case, the result is a
67331 pointer to a new string in the current memory pool. See the next section for
67332 more discussion.
67333 </para>
67334 </listitem></varlistentry>
67335 </variablelist>
67336 </section>
67337 <section id="SECTmemhanloc">
67338 <title>More about Exim&#x2019;s memory handling</title>
67339 <para>
67340 <indexterm role="concept">
67341 <primary><function>local_scan()</function> function</primary>
67342 <secondary>memory handling</secondary>
67343 </indexterm>
67344 No function is provided for freeing memory, because that is never needed.
67345 The dynamic memory that Exim uses when receiving a message is automatically
67346 recycled if another message is received by the same process (this applies only
67347 to incoming SMTP connections &ndash; other input methods can supply only one
67348 message at a time). After receiving the last message, a reception process
67349 terminates.
67350 </para>
67351 <para>
67352 Because it is recycled, the normal dynamic memory cannot be used for holding
67353 data that must be preserved over a number of incoming messages on the same SMTP
67354 connection. However, Exim in fact uses two pools of dynamic memory; the second
67355 one is not recycled, and can be used for this purpose.
67356 </para>
67357 <para>
67358 If you want to allocate memory that remains available for subsequent messages
67359 in the same SMTP connection, you should set
67360 </para>
67361 <literallayout class="monospaced">
67362 store_pool = POOL_PERM
67363 </literallayout>
67364 <para>
67365 before calling the function that does the allocation. There is no need to
67366 restore the value if you do not need to; however, if you do want to revert to
67367 the normal pool, you can either restore the previous value of <option>store_pool</option> or
67368 set it explicitly to POOL_MAIN.
67369 </para>
67370 <para>
67371 The pool setting applies to all functions that get dynamic memory, including
67372 <emphasis>expand_string()</emphasis>, <emphasis>store_get()</emphasis>, and the <emphasis>string_xxx()</emphasis> functions.
67373 There is also a convenience function called <emphasis>store_get_perm()</emphasis> that gets a
67374 block of memory from the permanent pool while preserving the value of
67375 <option>store_pool</option>.
67376 <indexterm role="concept" startref="IIDlosca" class="endofrange"/>
67377 </para>
67378 </section>
67379 </chapter>
67380
67381 <chapter id="CHAPsystemfilter">
67382 <title>System-wide message filtering</title>
67383 <para>
67384 <indexterm role="concept" id="IIDsysfil1" class="startofrange">
67385 <primary>filter</primary>
67386 <secondary>system filter</secondary>
67387 </indexterm>
67388 <indexterm role="concept" id="IIDsysfil2" class="startofrange">
67389 <primary>filtering all mail</primary>
67390 </indexterm>
67391 <indexterm role="concept" id="IIDsysfil3" class="startofrange">
67392 <primary>system filter</primary>
67393 </indexterm>
67394 The previous chapters (on ACLs and the local scan function) describe checks
67395 that can be applied to messages before they are accepted by a host. There is
67396 also a mechanism for checking messages once they have been received, but before
67397 they are delivered. This is called the <emphasis>system filter</emphasis>.
67398 </para>
67399 <para>
67400 The system filter operates in a similar manner to users&#x2019; filter files, but it
67401 is run just once per message (however many recipients the message has).
67402 It should not normally be used as a substitute for routing, because <option>deliver</option>
67403 commands in a system router provide new envelope recipient addresses.
67404 The system filter must be an Exim filter. It cannot be a Sieve filter.
67405 </para>
67406 <para>
67407 The system filter is run at the start of a delivery attempt, before any routing
67408 is done. If a message fails to be completely delivered at the first attempt,
67409 the system filter is run again at the start of every retry.
67410 If you want your filter to do something only once per message, you can make use
67411 of the <option>first_delivery</option> condition in an <option>if</option> command in the filter to
67412 prevent it happening on retries.
67413 </para>
67414 <para>
67415 <indexterm role="variable">
67416 <primary><varname>$domain</varname></primary>
67417 </indexterm>
67418 <indexterm role="variable">
67419 <primary><varname>$local_part</varname></primary>
67420 </indexterm>
67421 <emphasis role="bold">Warning</emphasis>: Because the system filter runs just once, variables that are
67422 specific to individual recipient addresses, such as <varname>$local_part</varname> and
67423 <varname>$domain</varname>, are not set, and the <quote>personal</quote> condition is not meaningful. If
67424 you want to run a centrally-specified filter for each recipient address
67425 independently, you can do so by setting up a suitable <command>redirect</command> router, as
67426 described in section <xref linkend="SECTperaddfil"/> below.
67427 </para>
67428 <section id="SECID212">
67429 <title>Specifying a system filter</title>
67430 <para>
67431 <indexterm role="concept">
67432 <primary>uid (user id)</primary>
67433 <secondary>system filter</secondary>
67434 </indexterm>
67435 <indexterm role="concept">
67436 <primary>gid (group id)</primary>
67437 <secondary>system filter</secondary>
67438 </indexterm>
67439 The name of the file that contains the system filter must be specified by
67440 setting <option>system_filter</option>. If you want the filter to run under a uid and gid
67441 other than root, you must also set <option>system_filter_user</option> and
67442 <option>system_filter_group</option> as appropriate. For example:
67443 </para>
67444 <literallayout class="monospaced">
67445 system_filter = /etc/mail/exim.filter
67446 system_filter_user = exim
67447 </literallayout>
67448 <para>
67449 If a system filter generates any deliveries directly to files or pipes (via the
67450 <option>save</option> or <option>pipe</option> commands), transports to handle these deliveries must be
67451 specified by setting <option>system_filter_file_transport</option> and
67452 <option>system_filter_pipe_transport</option>, respectively. Similarly,
67453 <option>system_filter_reply_transport</option> must be set to handle any messages generated
67454 by the <option>reply</option> command.
67455 </para>
67456 </section>
67457 <section id="SECID213">
67458 <title>Testing a system filter</title>
67459 <para>
67460 You can run simple tests of a system filter in the same way as for a user
67461 filter, but you should use <option>-bF</option> rather than <option>-bf</option>, so that features that
67462 are permitted only in system filters are recognized.
67463 </para>
67464 <para>
67465 If you want to test the combined effect of a system filter and a user filter,
67466 you can use both <option>-bF</option> and <option>-bf</option> on the same command line.
67467 </para>
67468 </section>
67469 <section id="SECID214">
67470 <title>Contents of a system filter</title>
67471 <para>
67472 The language used to specify system filters is the same as for users&#x2019; filter
67473 files. It is described in the separate end-user document <emphasis>Exim&#x2019;s interface to
67474 mail filtering</emphasis>. However, there are some additional features that are
67475 available only in system filters; these are described in subsequent sections.
67476 If they are encountered in a user&#x2019;s filter file or when testing with <option>-bf</option>,
67477 they cause errors.
67478 </para>
67479 <para>
67480 <indexterm role="concept">
67481 <primary>frozen messages</primary>
67482 <secondary>manual thaw; testing in filter</secondary>
67483 </indexterm>
67484 There are two special conditions which, though available in users&#x2019; filter
67485 files, are designed for use in system filters. The condition <option>first_delivery</option>
67486 is true only for the first attempt at delivering a message, and
67487 <option>manually_thawed</option> is true only if the message has been frozen, and
67488 subsequently thawed by an admin user. An explicit forced delivery counts as a
67489 manual thaw, but thawing as a result of the <option>auto_thaw</option> setting does not.
67490 </para>
67491 <para>
67492 <emphasis role="bold">Warning</emphasis>: If a system filter uses the <option>first_delivery</option> condition to
67493 specify an <quote>unseen</quote> (non-significant) delivery, and that delivery does not
67494 succeed, it will not be tried again.
67495 If you want Exim to retry an unseen delivery until it succeeds, you should
67496 arrange to set it up every time the filter runs.
67497 </para>
67498 <para>
67499 When a system filter finishes running, the values of the variables <varname>$n0</varname> &ndash;
67500 <varname>$n9</varname> are copied into <varname>$sn0</varname> &ndash; <varname>$sn9</varname> and are thereby made available to
67501 users&#x2019; filter files. Thus a system filter can, for example, set up <quote>scores</quote>
67502 to which users&#x2019; filter files can refer.
67503 </para>
67504 </section>
67505 <section id="SECID215">
67506 <title>Additional variable for system filters</title>
67507 <para>
67508 <indexterm role="variable">
67509 <primary><varname>$recipients</varname></primary>
67510 </indexterm>
67511 The expansion variable <varname>$recipients</varname>, containing a list of all the recipients
67512 of the message (separated by commas and white space), is available in system
67513 filters. It is not available in users&#x2019; filters for privacy reasons.
67514 </para>
67515 </section>
67516 <section id="SECID216">
67517 <title>Defer, freeze, and fail commands for system filters</title>
67518 <para>
67519 <indexterm role="concept">
67520 <primary>freezing messages</primary>
67521 </indexterm>
67522 <indexterm role="concept">
67523 <primary>message</primary>
67524 <secondary>freezing</secondary>
67525 </indexterm>
67526 <indexterm role="concept">
67527 <primary>message</primary>
67528 <secondary>forced failure</secondary>
67529 </indexterm>
67530 <indexterm role="concept">
67531 <primary><option>fail</option></primary>
67532 <secondary>in system filter</secondary>
67533 </indexterm>
67534 <indexterm role="concept">
67535 <primary><option>freeze</option> in system filter</primary>
67536 </indexterm>
67537 <indexterm role="concept">
67538 <primary><option>defer</option> in system filter</primary>
67539 </indexterm>
67540 There are three extra commands (<option>defer</option>, <option>freeze</option> and <option>fail</option>) which are
67541 always available in system filters, but are not normally enabled in users&#x2019;
67542 filters. (See the <option>allow_defer</option>, <option>allow_freeze</option> and <option>allow_fail</option> options
67543 for the <command>redirect</command> router.) These commands can optionally be followed by the
67544 word <option>text</option> and a string containing an error message, for example:
67545 </para>
67546 <literallayout class="monospaced">
67547 fail text "this message looks like spam to me"
67548 </literallayout>
67549 <para>
67550 The keyword <option>text</option> is optional if the next character is a double quote.
67551 </para>
67552 <para>
67553 The <option>defer</option> command defers delivery of the original recipients of the
67554 message. The <option>fail</option> command causes all the original recipients to be failed,
67555 and a bounce message to be created. The <option>freeze</option> command suspends all
67556 delivery attempts for the original recipients. In all cases, any new deliveries
67557 that are specified by the filter are attempted as normal after the filter has
67558 run.
67559 </para>
67560 <para>
67561 The <option>freeze</option> command is ignored if the message has been manually unfrozen and
67562 not manually frozen since. This means that automatic freezing by a system
67563 filter can be used as a way of checking out suspicious messages. If a message
67564 is found to be all right, manually unfreezing it allows it to be delivered.
67565 </para>
67566 <para>
67567 <indexterm role="concept">
67568 <primary>log</primary>
67569 <secondary><option>fail</option> command log line</secondary>
67570 </indexterm>
67571 <indexterm role="concept">
67572 <primary><option>fail</option></primary>
67573 <secondary>log line; reducing</secondary>
67574 </indexterm>
67575 The text given with a fail command is used as part of the bounce message as
67576 well as being written to the log. If the message is quite long, this can fill
67577 up a lot of log space when such failures are common. To reduce the size of the
67578 log message, Exim interprets the text in a special way if it starts with the
67579 two characters <literal>&lt;&lt;</literal> and contains <literal>&gt;&gt;</literal> later. The text between these two
67580 strings is written to the log, and the rest of the text is used in the bounce
67581 message. For example:
67582 </para>
67583 <literallayout class="monospaced">
67584 fail "&lt;&lt;filter test 1&gt;&gt;Your message is rejected \
67585      because it contains attachments that we are \
67586      not prepared to receive."
67587 </literallayout>
67588 <para>
67589 <indexterm role="concept">
67590 <primary>loop</primary>
67591 <secondary>caused by <option>fail</option></secondary>
67592 </indexterm>
67593 Take great care with the <option>fail</option> command when basing the decision to fail on
67594 the contents of the message, because the bounce message will of course include
67595 the contents of the original message and will therefore trigger the <option>fail</option>
67596 command again (causing a mail loop) unless steps are taken to prevent this.
67597 Testing the <option>error_message</option> condition is one way to prevent this. You could
67598 use, for example
67599 </para>
67600 <literallayout class="monospaced">
67601 if $message_body contains "this is spam" and not error_message
67602 then fail text "spam is not wanted here" endif
67603 </literallayout>
67604 <para>
67605 though of course that might let through unwanted bounce messages. The
67606 alternative is clever checking of the body and/or headers to detect bounces
67607 generated by the filter.
67608 </para>
67609 <para>
67610 The interpretation of a system filter file ceases after a
67611 <option>defer</option>,
67612 <option>freeze</option>, or <option>fail</option> command is obeyed. However, any deliveries that were
67613 set up earlier in the filter file are honoured, so you can use a sequence such
67614 as
67615 </para>
67616 <literallayout class="monospaced">
67617 mail ...
67618 freeze
67619 </literallayout>
67620 <para>
67621 to send a specified message when the system filter is freezing (or deferring or
67622 failing) a message. The normal deliveries for the message do not, of course,
67623 take place.
67624 </para>
67625 </section>
67626 <section id="SECTaddremheasys">
67627 <title>Adding and removing headers in a system filter</title>
67628 <para>
67629 <indexterm role="concept">
67630 <primary>header lines</primary>
67631 <secondary>adding; in system filter</secondary>
67632 </indexterm>
67633 <indexterm role="concept">
67634 <primary>header lines</primary>
67635 <secondary>removing; in system filter</secondary>
67636 </indexterm>
67637 <indexterm role="concept">
67638 <primary>filter</primary>
67639 <secondary>header lines; adding/removing</secondary>
67640 </indexterm>
67641 Two filter commands that are available only in system filters are:
67642 </para>
67643 <literallayout class="monospaced">
67644 headers add &lt;string&gt;
67645 headers remove &lt;string&gt;
67646 </literallayout>
67647 <para>
67648 The argument for the <option>headers add</option> is a string that is expanded and then
67649 added to the end of the message&#x2019;s headers. It is the responsibility of the
67650 filter maintainer to make sure it conforms to RFC 2822 syntax. Leading white
67651 space is ignored, and if the string is otherwise empty, or if the expansion is
67652 forced to fail, the command has no effect.
67653 </para>
67654 <para>
67655 You can use <quote>\n</quote> within the string, followed by white space, to specify
67656 continued header lines. More than one header may be added in one command by
67657 including <quote>\n</quote> within the string without any following white space. For
67658 example:
67659 </para>
67660 <literallayout class="monospaced">
67661 headers add "X-header-1: ....\n  \
67662              continuation of X-header-1 ...\n\
67663              X-header-2: ...."
67664 </literallayout>
67665 <para>
67666 Note that the header line continuation white space after the first newline must
67667 be placed before the backslash that continues the input string, because white
67668 space after input continuations is ignored.
67669 </para>
67670 <para>
67671 The argument for <option>headers remove</option> is a colon-separated list of header names.
67672 This command applies only to those headers that are stored with the message;
67673 those that are added at delivery time (such as <emphasis>Envelope-To:</emphasis> and
67674 <emphasis>Return-Path:</emphasis>) cannot be removed by this means. If there is more than one
67675 header with the same name, they are all removed.
67676 </para>
67677 <para>
67678 The <option>headers</option> command in a system filter makes an immediate change to the set
67679 of header lines that was received with the message (with possible additions
67680 from ACL processing). Subsequent commands in the system filter operate on the
67681 modified set, which also forms the basis for subsequent message delivery.
67682 Unless further modified during routing or transporting, this set of headers is
67683 used for all recipients of the message.
67684 </para>
67685 <para>
67686 During routing and transporting, the variables that refer to the contents of
67687 header lines refer only to those lines that are in this set. Thus, header lines
67688 that are added by a system filter are visible to users&#x2019; filter files and to all
67689 routers and transports. This contrasts with the manipulation of header lines by
67690 routers and transports, which is not immediate, but which instead is saved up
67691 until the message is actually being written (see section
67692 <xref linkend="SECTheadersaddrem"/>).
67693 </para>
67694 <para>
67695 If the message is not delivered at the first attempt, header lines that were
67696 added by the system filter are stored with the message, and so are still
67697 present at the next delivery attempt. Header lines that were removed are still
67698 present, but marked <quote>deleted</quote> so that they are not transported with the
67699 message. For this reason, it is usual to make the <option>headers</option> command
67700 conditional on <option>first_delivery</option> so that the set of header lines is not
67701 modified more than once.
67702 </para>
67703 <para>
67704 Because header modification in a system filter acts immediately, you have to
67705 use an indirect approach if you want to modify the contents of a header line.
67706 For example:
67707 </para>
67708 <literallayout class="monospaced">
67709 headers add "Old-Subject: $h_subject:"
67710 headers remove "Subject"
67711 headers add "Subject: new subject (was: $h_old-subject:)"
67712 headers remove "Old-Subject"
67713 </literallayout>
67714 </section>
67715 <section id="SECID217">
67716 <title>Setting an errors address in a system filter</title>
67717 <para>
67718 <indexterm role="concept">
67719 <primary>envelope from</primary>
67720 </indexterm>
67721 <indexterm role="concept">
67722 <primary>envelope sender</primary>
67723 </indexterm>
67724 In a system filter, if a <option>deliver</option> command is followed by
67725 </para>
67726 <literallayout class="monospaced">
67727 errors_to &lt;some address&gt;
67728 </literallayout>
67729 <para>
67730 in order to change the envelope sender (and hence the error reporting) for that
67731 delivery, any address may be specified. (In a user filter, only the current
67732 user&#x2019;s address can be set.) For example, if some mail is being monitored, you
67733 might use
67734 </para>
67735 <literallayout class="monospaced">
67736 unseen deliver monitor@spying.example errors_to root@local.example
67737 </literallayout>
67738 <para>
67739 to take a copy which would not be sent back to the normal error reporting
67740 address if its delivery failed.
67741 </para>
67742 </section>
67743 <section id="SECTperaddfil">
67744 <title>Per-address filtering</title>
67745 <para>
67746 <indexterm role="variable">
67747 <primary><varname>$domain_data</varname></primary>
67748 </indexterm>
67749 <indexterm role="variable">
67750 <primary><varname>$local_part_data</varname></primary>
67751 </indexterm>
67752 In contrast to the system filter, which is run just once per message for each
67753 delivery attempt, it is also possible to set up a system-wide filtering
67754 operation that runs once for each recipient address. In this case, variables
67755 such as <varname>$local_part_data</varname> and <varname>$domain_data</varname> can be used,
67756 and indeed, the choice of filter file could be made dependent on them.
67757 This is an example of a router which implements such a filter:
67758 </para>
67759 <literallayout class="monospaced">
67760 central_filter:
67761   check_local_user
67762   driver = redirect
67763   domains = +local_domains
67764   file = /central/filters/$local_part_data
67765   no_verify
67766   allow_filter
67767   allow_freeze
67768 </literallayout>
67769 <para>
67770 The filter is run in a separate process under its own uid. Therefore, either
67771 <option>check_local_user</option> must be set (as above), in which case the filter is run as
67772 the local user, or the <option>user</option> option must be used to specify which user to
67773 use. If both are set, <option>user</option> overrides.
67774 </para>
67775 <para>
67776 Care should be taken to ensure that none of the commands in the filter file
67777 specify a significant delivery if the message is to go on to be delivered to
67778 its intended recipient. The router will not then claim to have dealt with the
67779 address, so it will be passed on to subsequent routers to be delivered in the
67780 normal way.
67781 <indexterm role="concept" startref="IIDsysfil1" class="endofrange"/>
67782 <indexterm role="concept" startref="IIDsysfil2" class="endofrange"/>
67783 <indexterm role="concept" startref="IIDsysfil3" class="endofrange"/>
67784 </para>
67785 </section>
67786 </chapter>
67787
67788 <chapter id="CHAPmsgproc">
67789 <title>Message processing</title>
67790 <para>
67791 <indexterm role="concept" id="IIDmesproc" class="startofrange">
67792 <primary>message</primary>
67793 <secondary>general processing</secondary>
67794 </indexterm>
67795 Exim performs various transformations on the sender and recipient addresses of
67796 all messages that it handles, and also on the messages&#x2019; header lines. Some of
67797 these are optional and configurable, while others always take place. All of
67798 this processing, except rewriting as a result of routing, and the addition or
67799 removal of header lines while delivering, happens when a message is received,
67800 before it is placed on Exim&#x2019;s queue.
67801 </para>
67802 <para>
67803 Some of the automatic processing takes place by default only for
67804 <quote>locally-originated</quote> messages. This adjective is used to describe messages
67805 that are not received over TCP/IP, but instead are passed to an Exim process on
67806 its standard input. This includes the interactive <quote>local SMTP</quote> case that is
67807 set up by the <option>-bs</option> command line option.
67808 </para>
67809 <para>
67810 <emphasis role="bold">Note</emphasis>: Messages received over TCP/IP on the loopback interface (127.0.0.1
67811 or ::1) are not considered to be locally-originated. Exim does not treat the
67812 loopback interface specially in any way.
67813 </para>
67814 <para>
67815 If you want the loopback interface to be treated specially, you must ensure
67816 that there are appropriate entries in your ACLs.
67817 </para>
67818 <section id="SECTsubmodnon">
67819 <title>Submission mode for non-local messages</title>
67820 <para>
67821 <indexterm role="concept">
67822 <primary>message</primary>
67823 <secondary>submission</secondary>
67824 </indexterm>
67825 <indexterm role="concept">
67826 <primary>submission mode</primary>
67827 </indexterm>
67828 Processing that happens automatically for locally-originated messages (unless
67829 <option>suppress_local_fixups</option> is set) can also be requested for messages that are
67830 received over TCP/IP. The term <quote>submission mode</quote> is used to describe this
67831 state. Submission mode is set by the modifier
67832 </para>
67833 <literallayout class="monospaced">
67834 control = submission
67835 </literallayout>
67836 <para>
67837 in a MAIL, RCPT, or pre-data ACL for an incoming message (see sections
67838 <xref linkend="SECTACLmodi"/> and <xref linkend="SECTcontrols"/>). This makes Exim treat the message as
67839 a local submission, and is normally used when the source of the message is
67840 known to be an MUA running on a client host (as opposed to an MTA). For
67841 example, to set submission mode for messages originating on the IPv4 loopback
67842 interface, you could include the following in the MAIL ACL:
67843 </para>
67844 <literallayout class="monospaced">
67845 warn  hosts = 127.0.0.1
67846       control = submission
67847 </literallayout>
67848 <para>
67849 <indexterm role="concept">
67850 <primary><option>sender_retain</option> submission option</primary>
67851 </indexterm>
67852 There are some options that can be used when setting submission mode. A slash
67853 is used to separate options. For example:
67854 </para>
67855 <literallayout class="monospaced">
67856 control = submission/sender_retain
67857 </literallayout>
67858 <para>
67859 Specifying <option>sender_retain</option> has the effect of setting <option>local_sender_retain</option>
67860 true and <option>local_from_check</option> false for the current incoming message. The first
67861 of these allows an existing <emphasis>Sender:</emphasis> header in the message to remain, and
67862 the second suppresses the check to ensure that <emphasis>From:</emphasis> matches the
67863 authenticated sender. With this setting, Exim still fixes up messages by adding
67864 <emphasis>Date:</emphasis> and <emphasis>Message-ID:</emphasis> header lines if they are missing, but makes no
67865 attempt to check sender authenticity in header lines.
67866 </para>
67867 <para>
67868 When <option>sender_retain</option> is not set, a submission mode setting may specify a
67869 domain to be used when generating a <emphasis>From:</emphasis> or <emphasis>Sender:</emphasis> header line. For
67870 example:
67871 </para>
67872 <literallayout class="monospaced">
67873 control = submission/domain=some.domain
67874 </literallayout>
67875 <para>
67876 The domain may be empty. How this value is used is described in sections
67877 <xref linkend="SECTthefrohea"/> and <xref linkend="SECTthesenhea"/>. There is also a <option>name</option> option
67878 that allows you to specify the user&#x2019;s full name for inclusion in a created
67879 <emphasis>Sender:</emphasis> or <emphasis>From:</emphasis> header line. For example:
67880 </para>
67881 <literallayout class="monospaced">
67882 accept authenticated = *
67883        control = submission/domain=wonderland.example/\
67884                             name=${lookup {$authenticated_id} \
67885                                    lsearch {/etc/exim/namelist}}
67886 </literallayout>
67887 <para>
67888 Because the name may contain any characters, including slashes, the <option>name</option>
67889 option must be given last. The remainder of the string is used as the name. For
67890 the example above, if <filename>/etc/exim/namelist</filename> contains:
67891 </para>
67892 <literallayout class="monospaced">
67893 bigegg:  Humpty Dumpty
67894 </literallayout>
67895 <para>
67896 then when the sender has authenticated as <emphasis>bigegg</emphasis>, the generated <emphasis>Sender:</emphasis>
67897 line would be:
67898 </para>
67899 <literallayout class="monospaced">
67900 Sender: Humpty Dumpty &lt;bigegg@wonderland.example&gt;
67901 </literallayout>
67902 <para>
67903 <indexterm role="concept">
67904 <primary>return path</primary>
67905 <secondary>in submission mode</secondary>
67906 </indexterm>
67907 By default, submission mode forces the return path to the same address as is
67908 used to create the <emphasis>Sender:</emphasis> header. However, if <option>sender_retain</option> is
67909 specified, the return path is also left unchanged.
67910 </para>
67911 <para>
67912 <emphasis role="bold">Note</emphasis>: The changes caused by submission mode take effect after the predata
67913 ACL. This means that any sender checks performed before the fix-ups use the
67914 untrusted sender address specified by the user, not the trusted sender address
67915 specified by submission mode. Although this might be slightly unexpected, it
67916 does mean that you can configure ACL checks to spot that a user is trying to
67917 spoof another&#x2019;s address.
67918 </para>
67919 </section>
67920 <section id="SECTlineendings">
67921 <title>Line endings</title>
67922 <para>
67923 <indexterm role="concept">
67924 <primary>line endings</primary>
67925 </indexterm>
67926 <indexterm role="concept">
67927 <primary>carriage return</primary>
67928 </indexterm>
67929 <indexterm role="concept">
67930 <primary>linefeed</primary>
67931 </indexterm>
67932 RFC 2821 specifies that CRLF (two characters: carriage-return, followed by
67933 linefeed) is the line ending for messages transmitted over the Internet using
67934 SMTP over TCP/IP. However, within individual operating systems, different
67935 conventions are used. For example, Unix-like systems use just LF, but others
67936 use CRLF or just CR.
67937 </para>
67938 <para>
67939 Exim was designed for Unix-like systems, and internally, it stores messages
67940 using the system&#x2019;s convention of a single LF as a line terminator. When
67941 receiving a message, all line endings are translated to this standard format.
67942 Originally, it was thought that programs that passed messages directly to an
67943 MTA within an operating system would use that system&#x2019;s convention. Experience
67944 has shown that this is not the case; for example, there are Unix applications
67945 that use CRLF in this circumstance. For this reason, and for compatibility with
67946 other MTAs, the way Exim handles line endings for all messages is now as
67947 follows:
67948 </para>
67949 <itemizedlist>
67950 <listitem>
67951 <para>
67952 LF not preceded by CR is treated as a line ending.
67953 </para>
67954 </listitem>
67955 <listitem>
67956 <para>
67957 CR is treated as a line ending; if it is immediately followed by LF, the LF
67958 is ignored.
67959 </para>
67960 </listitem>
67961 <listitem>
67962 <para>
67963 The sequence <quote>CR, dot, CR</quote> does not terminate an incoming SMTP message,
67964 nor a local message in the state where a line containing only a dot is a
67965 terminator.
67966 </para>
67967 </listitem>
67968 <listitem>
67969 <para>
67970 If a bare CR is encountered within a header line, an extra space is added after
67971 the line terminator so as not to end the header line. The reasoning behind this
67972 is that bare CRs in header lines are most likely either to be mistakes, or
67973 people trying to play silly games.
67974 </para>
67975 </listitem>
67976 <listitem>
67977 <para>
67978 If the first header line received in a message ends with CRLF, a subsequent
67979 bare LF in a header line is treated in the same way as a bare CR in a header
67980 line.
67981 </para>
67982 </listitem>
67983 </itemizedlist>
67984 </section>
67985 <section id="SECID218">
67986 <title>Unqualified addresses</title>
67987 <para>
67988 <indexterm role="concept">
67989 <primary>unqualified addresses</primary>
67990 </indexterm>
67991 <indexterm role="concept">
67992 <primary>address</primary>
67993 <secondary>qualification</secondary>
67994 </indexterm>
67995 By default, Exim expects every envelope address it receives from an external
67996 host to be fully qualified. Unqualified addresses cause negative responses to
67997 SMTP commands. However, because SMTP is used as a means of transporting
67998 messages from MUAs running on personal workstations, there is sometimes a
67999 requirement to accept unqualified addresses from specific hosts or IP networks.
68000 </para>
68001 <para>
68002 Exim has two options that separately control which hosts may send unqualified
68003 sender or recipient addresses in SMTP commands, namely
68004 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>. In both
68005 cases, if an unqualified address is accepted, it is qualified by adding the
68006 value of <option>qualify_domain</option> or <option>qualify_recipient</option>, as appropriate.
68007 </para>
68008 <para>
68009 <indexterm role="option">
68010 <primary><option>qualify_domain</option></primary>
68011 </indexterm>
68012 <indexterm role="option">
68013 <primary><option>qualify_recipient</option></primary>
68014 </indexterm>
68015 Unqualified addresses in header lines are automatically qualified for messages
68016 that are locally originated, unless the <option>-bnq</option> option is given on the command
68017 line. For messages received over SMTP, unqualified addresses in header lines
68018 are qualified only if unqualified addresses are permitted in SMTP commands. In
68019 other words, such qualification is also controlled by
68020 <option>sender_unqualified_hosts</option> and <option>recipient_unqualified_hosts</option>,
68021 </para>
68022 </section>
68023 <section id="SECID219">
68024 <title>The UUCP From line</title>
68025 <para>
68026 <indexterm role="concept">
68027 <primary><quote>From</quote> line</primary>
68028 </indexterm>
68029 <indexterm role="concept">
68030 <primary>UUCP</primary>
68031 <secondary><quote>From</quote> line</secondary>
68032 </indexterm>
68033 <indexterm role="concept">
68034 <primary>sender</primary>
68035 <secondary>address</secondary>
68036 </indexterm>
68037 <indexterm role="option">
68038 <primary><option>uucp_from_pattern</option></primary>
68039 </indexterm>
68040 <indexterm role="option">
68041 <primary><option>uucp_from_sender</option></primary>
68042 </indexterm>
68043 <indexterm role="concept">
68044 <primary>envelope from</primary>
68045 </indexterm>
68046 <indexterm role="concept">
68047 <primary>envelope sender</primary>
68048 </indexterm>
68049 <indexterm role="concept">
68050 <primary>Sendmail compatibility</primary>
68051 <secondary><quote>From</quote> line</secondary>
68052 </indexterm>
68053 Messages that have come from UUCP (and some other applications) often begin
68054 with a line containing the envelope sender and a timestamp, following the word
68055 <quote>From</quote>. Examples of two common formats are:
68056 </para>
68057 <literallayout class="monospaced">
68058 From a.oakley@berlin.mus Fri Jan  5 12:35 GMT 1996
68059 From f.butler@berlin.mus Fri, 7 Jan 97 14:00:00 GMT
68060 </literallayout>
68061 <para>
68062 This line precedes the RFC 2822 header lines. For compatibility with Sendmail,
68063 Exim recognizes such lines at the start of messages that are submitted to it
68064 via the command line (that is, on the standard input). It does not recognize
68065 such lines in incoming SMTP messages, unless the sending host matches
68066 <option>ignore_fromline_hosts</option> or the <option>-bs</option> option was used for a local message
68067 and <option>ignore_fromline_local</option> is set. The recognition is controlled by a
68068 regular expression that is defined by the <option>uucp_from_pattern</option> option, whose
68069 default value matches the two common cases shown above and puts the address
68070 that follows <quote>From</quote> into <varname>$1</varname>.
68071 </para>
68072 <para>
68073 <indexterm role="concept">
68074 <primary>numerical variables (<varname>$1</varname> <varname>$2</varname> etc)</primary>
68075 <secondary>in <quote>From </quote> line handling</secondary>
68076 </indexterm>
68077 When the caller of Exim for a non-SMTP message that contains a <quote>From</quote> line is
68078 a trusted user, the message&#x2019;s sender address is constructed by expanding the
68079 contents of <option>uucp_sender_address</option>, whose default value is <quote>$1</quote>. This is
68080 then parsed as an RFC 2822 address. If there is no domain, the local part is
68081 qualified with <option>qualify_domain</option> unless it is the empty string. However, if
68082 the command line <option>-f</option> option is used, it overrides the <quote>From</quote> line.
68083 </para>
68084 <para>
68085 If the caller of Exim is not trusted, the <quote>From</quote> line is recognized, but the
68086 sender address is not changed. This is also the case for incoming SMTP messages
68087 that are permitted to contain <quote>From</quote> lines.
68088 </para>
68089 <para>
68090 Only one <quote>From</quote> line is recognized. If there is more than one, the second is
68091 treated as a data line that starts the body of the message, as it is not valid
68092 as a header line. This also happens if a <quote>From</quote> line is present in an
68093 incoming SMTP message from a source that is not permitted to send them.
68094 </para>
68095 </section>
68096 <section id="SECID220">
68097 <title>Resent- header lines</title>
68098 <para>
68099 <indexterm role="concept">
68100 <primary><emphasis>Resent-</emphasis> header line</primary>
68101 </indexterm>
68102 <indexterm role="concept">
68103 <primary>header lines</primary>
68104 <secondary>Resent-</secondary>
68105 </indexterm>
68106 RFC 2822 makes provision for sets of header lines starting with the string
68107 <literal>Resent-</literal> to be added to a message when it is resent by the original
68108 recipient to somebody else. These headers are <emphasis>Resent-Date:</emphasis>,
68109 <emphasis>Resent-From:</emphasis>, <emphasis>Resent-Sender:</emphasis>, <emphasis>Resent-To:</emphasis>, <emphasis>Resent-Cc:</emphasis>,
68110 <emphasis>Resent-Bcc:</emphasis> and <emphasis>Resent-Message-ID:</emphasis>. The RFC says:
68111 </para>
68112 <blockquote>
68113 <para>
68114 <emphasis>Resent fields are strictly informational. They MUST NOT be used in the normal
68115 processing of replies or other such automatic actions on messages.</emphasis>
68116 </para>
68117 </blockquote>
68118 <para>
68119 This leaves things a bit vague as far as other processing actions such as
68120 address rewriting are concerned. Exim treats <option>Resent-</option> header lines as
68121 follows:
68122 </para>
68123 <itemizedlist>
68124 <listitem>
68125 <para>
68126 A <emphasis>Resent-From:</emphasis> line that just contains the login id of the submitting user
68127 is automatically rewritten in the same way as <emphasis>From:</emphasis> (see below).
68128 </para>
68129 </listitem>
68130 <listitem>
68131 <para>
68132 If there&#x2019;s a rewriting rule for a particular header line, it is also applied to
68133 <option>Resent-</option> header lines of the same type. For example, a rule that rewrites
68134 <emphasis>From:</emphasis> also rewrites <emphasis>Resent-From:</emphasis>.
68135 </para>
68136 </listitem>
68137 <listitem>
68138 <para>
68139 For local messages, if <emphasis>Sender:</emphasis> is removed on input, <emphasis>Resent-Sender:</emphasis> is
68140 also removed.
68141 </para>
68142 </listitem>
68143 <listitem>
68144 <para>
68145 For a locally-submitted message,
68146 if there are any <option>Resent-</option> header lines but no <emphasis>Resent-Date:</emphasis>,
68147 <emphasis>Resent-From:</emphasis>, or <emphasis>Resent-Message-Id:</emphasis>, they are added as necessary. It is
68148 the contents of <emphasis>Resent-Message-Id:</emphasis> (rather than <emphasis>Message-Id:</emphasis>) which are
68149 included in log lines in this case.
68150 </para>
68151 </listitem>
68152 <listitem>
68153 <para>
68154 The logic for adding <emphasis>Sender:</emphasis> is duplicated for <emphasis>Resent-Sender:</emphasis> when any
68155 <option>Resent-</option> header lines are present.
68156 </para>
68157 </listitem>
68158 </itemizedlist>
68159 </section>
68160 <section id="SECID221">
68161 <title>The Auto-Submitted: header line</title>
68162 <para>
68163 Whenever Exim generates an autoreply, a bounce, or a delay warning message, it
68164 includes the header line:
68165 </para>
68166 <literallayout class="monospaced">
68167 Auto-Submitted: auto-replied
68168 </literallayout>
68169 </section>
68170 <section id="SECID222">
68171 <title>The Bcc: header line</title>
68172 <para>
68173 <indexterm role="concept">
68174 <primary><emphasis>Bcc:</emphasis> header line</primary>
68175 </indexterm>
68176 If Exim is called with the <option>-t</option> option, to take recipient addresses from a
68177 message&#x2019;s header, it removes any <emphasis>Bcc:</emphasis> header line that may exist (after
68178 extracting its addresses). If <option>-t</option> is not present on the command line, any
68179 existing <emphasis>Bcc:</emphasis> is not removed.
68180 </para>
68181 </section>
68182 <section id="SECID223">
68183 <title>The Date: header line</title>
68184 <para>
68185 <indexterm role="concept">
68186 <primary>Date:</primary>
68187 </indexterm>
68188 If a locally-generated or submission-mode message has no <emphasis>Date:</emphasis> header line,
68189 Exim adds one, using the current date and time, unless the
68190 <option>suppress_local_fixups</option> control has been specified.
68191 </para>
68192 </section>
68193 <section id="SECID224">
68194 <title>The Delivery-date: header line</title>
68195 <para>
68196 <indexterm role="concept">
68197 <primary><emphasis>Delivery-date:</emphasis> header line</primary>
68198 </indexterm>
68199 <indexterm role="option">
68200 <primary><option>delivery_date_remove</option></primary>
68201 </indexterm>
68202 <emphasis>Delivery-date:</emphasis> header lines are not part of the standard RFC 2822 header
68203 set. Exim can be configured to add them to the final delivery of messages. (See
68204 the generic <option>delivery_date_add</option> transport option.) They should not be present
68205 in messages in transit. If the <option>delivery_date_remove</option> configuration option is
68206 set (the default), Exim removes <emphasis>Delivery-date:</emphasis> header lines from incoming
68207 messages.
68208 </para>
68209 </section>
68210 <section id="SECID225">
68211 <title>The Envelope-to: header line</title>
68212 <para>
68213 <indexterm role="concept">
68214 <primary><emphasis>Envelope-to:</emphasis> header line</primary>
68215 </indexterm>
68216 <indexterm role="concept">
68217 <primary>header lines</primary>
68218 <secondary>Envelope-to:</secondary>
68219 </indexterm>
68220 <indexterm role="option">
68221 <primary><option>envelope_to_remove</option></primary>
68222 </indexterm>
68223 <emphasis>Envelope-to:</emphasis> header lines are not part of the standard RFC 2822 header set.
68224 Exim can be configured to add them to the final delivery of messages. (See the
68225 generic <option>envelope_to_add</option> transport option.) They should not be present in
68226 messages in transit. If the <option>envelope_to_remove</option> configuration option is set
68227 (the default), Exim removes <emphasis>Envelope-to:</emphasis> header lines from incoming
68228 messages.
68229 </para>
68230 </section>
68231 <section id="SECTthefrohea">
68232 <title>The From: header line</title>
68233 <para>
68234 <indexterm role="concept">
68235 <primary><emphasis>From:</emphasis> header line</primary>
68236 </indexterm>
68237 <indexterm role="concept">
68238 <primary>header lines</primary>
68239 <secondary>From:</secondary>
68240 </indexterm>
68241 <indexterm role="concept">
68242 <primary>Sendmail compatibility</primary>
68243 <secondary><quote>From</quote> line</secondary>
68244 </indexterm>
68245 <indexterm role="concept">
68246 <primary>message</primary>
68247 <secondary>submission</secondary>
68248 </indexterm>
68249 <indexterm role="concept">
68250 <primary>submission mode</primary>
68251 </indexterm>
68252 If a submission-mode message does not contain a <emphasis>From:</emphasis> header line, Exim
68253 adds one if either of the following conditions is true:
68254 </para>
68255 <itemizedlist>
68256 <listitem>
68257 <para>
68258 The envelope sender address is not empty (that is, this is not a bounce
68259 message). The added header line copies the envelope sender address.
68260 </para>
68261 </listitem>
68262 <listitem>
68263 <para>
68264 <indexterm role="variable">
68265 <primary><varname>$authenticated_id</varname></primary>
68266 </indexterm>
68267 The SMTP session is authenticated and <varname>$authenticated_id</varname> is not empty.
68268 </para>
68269 <orderedlist numeration="arabic">
68270 <listitem>
68271 <para>
68272 <indexterm role="variable">
68273 <primary><varname>$qualify_domain</varname></primary>
68274 </indexterm>
68275 If no domain is specified by the submission control, the local part is
68276 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
68277 </para>
68278 </listitem>
68279 <listitem>
68280 <para>
68281 If a non-empty domain is specified by the submission control, the local
68282 part is <varname>$authenticated_id</varname>, and the domain is the specified domain.
68283 </para>
68284 </listitem>
68285 <listitem>
68286 <para>
68287 If an empty domain is specified by the submission control,
68288 <varname>$authenticated_id</varname> is assumed to be the complete address.
68289 </para>
68290 </listitem>
68291 </orderedlist>
68292 </listitem>
68293 </itemizedlist>
68294 <para>
68295 A non-empty envelope sender takes precedence.
68296 </para>
68297 <para>
68298 If a locally-generated incoming message does not contain a <emphasis>From:</emphasis> header
68299 line, and the <option>suppress_local_fixups</option> control is not set, Exim adds one
68300 containing the sender&#x2019;s address. The calling user&#x2019;s login name and full name
68301 are used to construct the address, as described in section <xref linkend="SECTconstr"/>.
68302 They are obtained from the password data by calling <function>getpwuid()</function> (but see the
68303 <option>unknown_login</option> configuration option). The address is qualified with
68304 <option>qualify_domain</option>.
68305 </para>
68306 <para>
68307 For compatibility with Sendmail, if an incoming, non-SMTP message has a
68308 <emphasis>From:</emphasis> header line containing just the unqualified login name of the calling
68309 user, this is replaced by an address containing the user&#x2019;s login name and full
68310 name as described in section <xref linkend="SECTconstr"/>.
68311 </para>
68312 </section>
68313 <section id="SECID226">
68314 <title>The Message-ID: header line</title>
68315 <para>
68316 <indexterm role="concept">
68317 <primary><emphasis>Message-ID:</emphasis> header line</primary>
68318 </indexterm>
68319 <indexterm role="concept">
68320 <primary>header lines</primary>
68321 <secondary>Message-ID:</secondary>
68322 </indexterm>
68323 <indexterm role="concept">
68324 <primary>message</primary>
68325 <secondary>submission</secondary>
68326 </indexterm>
68327 <indexterm role="option">
68328 <primary><option>message_id_header_text</option></primary>
68329 </indexterm>
68330 If a locally-generated or submission-mode incoming message does not contain a
68331 <emphasis>Message-ID:</emphasis> or <emphasis>Resent-Message-ID:</emphasis> header line, and the
68332 <option>suppress_local_fixups</option> control is not set, Exim adds a suitable header line
68333 to the message. If there are any <emphasis>Resent-:</emphasis> headers in the message, it
68334 creates <emphasis>Resent-Message-ID:</emphasis>. The id is constructed from Exim&#x2019;s internal
68335 message id, preceded by the letter E to ensure it starts with a letter, and
68336 followed by @ and the primary host name. Additional information can be included
68337 in this header line by setting the <option>message_id_header_text</option> and/or
68338 <option>message_id_header_domain</option> options.
68339 </para>
68340 </section>
68341 <section id="SECID227">
68342 <title>The Received: header line</title>
68343 <para>
68344 <indexterm role="concept">
68345 <primary><emphasis>Received:</emphasis> header line</primary>
68346 </indexterm>
68347 <indexterm role="concept">
68348 <primary>header lines</primary>
68349 <secondary>Received:</secondary>
68350 </indexterm>
68351 A <emphasis>Received:</emphasis> header line is added at the start of every message. The
68352 contents are defined by the <option>received_header_text</option> configuration option, and
68353 Exim automatically adds a semicolon and a timestamp to the configured string.
68354 </para>
68355 <para>
68356 The <emphasis>Received:</emphasis> header is generated as soon as the message&#x2019;s header lines
68357 have been received. At this stage, the timestamp in the <emphasis>Received:</emphasis> header
68358 line is the time that the message started to be received. This is the value
68359 that is seen by the DATA ACL and by the <function>local_scan()</function> function.
68360 </para>
68361 <para>
68362 Once a message is accepted, the timestamp in the <emphasis>Received:</emphasis> header line is
68363 changed to the time of acceptance, which is (apart from a small delay while the
68364 -H spool file is written) the earliest time at which delivery could start.
68365 </para>
68366 </section>
68367 <section id="SECID228">
68368 <title>The References: header line</title>
68369 <para>
68370 <indexterm role="concept">
68371 <primary><emphasis>References:</emphasis> header line</primary>
68372 </indexterm>
68373 <indexterm role="concept">
68374 <primary>header lines</primary>
68375 <secondary>References:</secondary>
68376 </indexterm>
68377 Messages created by the <command>autoreply</command> transport include a <emphasis>References:</emphasis>
68378 header line. This is constructed according to the rules that are described in
68379 section 3.64 of RFC 2822 (which states that replies should contain such a
68380 header line), and section 3.14 of RFC 3834 (which states that automatic
68381 responses are not different in this respect). However, because some mail
68382 processing software does not cope well with very long header lines, no more
68383 than 12 message IDs are copied from the <emphasis>References:</emphasis> header line in the
68384 incoming message. If there are more than 12, the first one and then the final
68385 11 are copied, before adding the message ID of the incoming message.
68386 </para>
68387 </section>
68388 <section id="SECID229">
68389 <title>The Return-path: header line</title>
68390 <para>
68391 <indexterm role="concept">
68392 <primary><emphasis>Return-path:</emphasis> header line</primary>
68393 </indexterm>
68394 <indexterm role="concept">
68395 <primary>header lines</primary>
68396 <secondary>Return-path:</secondary>
68397 </indexterm>
68398 <indexterm role="option">
68399 <primary><option>return_path_remove</option></primary>
68400 </indexterm>
68401 <emphasis>Return-path:</emphasis> header lines are defined as something an MTA may insert when
68402 it does the final delivery of messages. (See the generic <option>return_path_add</option>
68403 transport option.) Therefore, they should not be present in messages in
68404 transit. If the <option>return_path_remove</option> configuration option is set (the
68405 default), Exim removes <emphasis>Return-path:</emphasis> header lines from incoming messages.
68406 </para>
68407 </section>
68408 <section id="SECTthesenhea">
68409 <title>The Sender: header line</title>
68410 <para>
68411 <indexterm role="concept">
68412 <primary><emphasis>Sender:</emphasis> header line</primary>
68413 </indexterm>
68414 <indexterm role="concept">
68415 <primary>message</primary>
68416 <secondary>submission</secondary>
68417 </indexterm>
68418 <indexterm role="concept">
68419 <primary><emphasis>Sender:</emphasis> header line</primary>
68420 </indexterm>
68421 <indexterm role="concept">
68422 <primary>header lines</primary>
68423 <secondary>Sender:</secondary>
68424 </indexterm>
68425 For a locally-originated message from an untrusted user, Exim may remove an
68426 existing <emphasis>Sender:</emphasis> header line, and it may add a new one. You can modify
68427 these actions by setting the <option>local_sender_retain</option> option true, the
68428 <option>local_from_check</option> option false, or by using the <option>suppress_local_fixups</option>
68429 control setting.
68430 </para>
68431 <para>
68432 When a local message is received from an untrusted user and
68433 <option>local_from_check</option> is true (the default), and the <option>suppress_local_fixups</option>
68434 control has not been set, a check is made to see if the address given in the
68435 <emphasis>From:</emphasis> header line is the correct (local) sender of the message. The address
68436 that is expected has the login name as the local part and the value of
68437 <option>qualify_domain</option> as the domain. Prefixes and suffixes for the local part can
68438 be permitted by setting <option>local_from_prefix</option> and <option>local_from_suffix</option>
68439 appropriately. If <emphasis>From:</emphasis> does not contain the correct sender, a <emphasis>Sender:</emphasis>
68440 line is added to the message.
68441 </para>
68442 <para>
68443 If you set <option>local_from_check</option> false, this checking does not occur. However,
68444 the removal of an existing <emphasis>Sender:</emphasis> line still happens, unless you also set
68445 <option>local_sender_retain</option> to be true. It is not possible to set both of these
68446 options true at the same time.
68447 </para>
68448 <para>
68449 <indexterm role="concept">
68450 <primary>submission mode</primary>
68451 </indexterm>
68452 By default, no processing of <emphasis>Sender:</emphasis> header lines is done for messages
68453 received over TCP/IP or for messages submitted by trusted users. However, when
68454 a message is received over TCP/IP in submission mode, and <option>sender_retain</option> is
68455 not specified on the submission control, the following processing takes place:
68456 </para>
68457 <para>
68458 <indexterm role="variable">
68459 <primary><varname>$authenticated_id</varname></primary>
68460 </indexterm>
68461 First, any existing <emphasis>Sender:</emphasis> lines are removed. Then, if the SMTP session is
68462 authenticated, and <varname>$authenticated_id</varname> is not empty, a sender address is
68463 created as follows:
68464 </para>
68465 <itemizedlist>
68466 <listitem>
68467 <para>
68468 <indexterm role="variable">
68469 <primary><varname>$qualify_domain</varname></primary>
68470 </indexterm>
68471 If no domain is specified by the submission control, the local part is
68472 <varname>$authenticated_id</varname> and the domain is <varname>$qualify_domain</varname>.
68473 </para>
68474 </listitem>
68475 <listitem>
68476 <para>
68477 If a non-empty domain is specified by the submission control, the local part
68478 is <varname>$authenticated_id</varname>, and the domain is the specified domain.
68479 </para>
68480 </listitem>
68481 <listitem>
68482 <para>
68483 If an empty domain is specified by the submission control,
68484 <varname>$authenticated_id</varname> is assumed to be the complete address.
68485 </para>
68486 </listitem>
68487 </itemizedlist>
68488 <para>
68489 This address is compared with the address in the <emphasis>From:</emphasis> header line. If they
68490 are different, a <emphasis>Sender:</emphasis> header line containing the created address is
68491 added. Prefixes and suffixes for the local part in <emphasis>From:</emphasis> can be permitted
68492 by setting <option>local_from_prefix</option> and <option>local_from_suffix</option> appropriately.
68493 </para>
68494 <para>
68495 <indexterm role="concept">
68496 <primary>return path</primary>
68497 <secondary>created from <emphasis>Sender:</emphasis></secondary>
68498 </indexterm>
68499 <emphasis role="bold">Note</emphasis>: Whenever a <emphasis>Sender:</emphasis> header line is created, the return path for
68500 the message (the envelope sender address) is changed to be the same address,
68501 except in the case of submission mode when <option>sender_retain</option> is specified.
68502 </para>
68503 </section>
68504 <section id="SECTheadersaddrem">
68505 <title>Adding and removing header lines in routers and transports</title>
68506 <para>
68507 <indexterm role="concept">
68508 <primary>header lines</primary>
68509 <secondary>adding; in router or transport</secondary>
68510 </indexterm>
68511 <indexterm role="concept">
68512 <primary>header lines</primary>
68513 <secondary>removing; in router or transport</secondary>
68514 </indexterm>
68515 When a message is delivered, the addition and removal of header lines can be
68516 specified in a system filter, or on any of the routers and transports that
68517 process the message. Section <xref linkend="SECTaddremheasys"/> contains details about
68518 modifying headers in a system filter. Header lines can also be added in an ACL
68519 as a message is received (see section <xref linkend="SECTaddheadacl"/>).
68520 </para>
68521 <para>
68522 In contrast to what happens in a system filter, header modifications that are
68523 specified on routers and transports apply only to the particular recipient
68524 addresses that are being processed by those routers and transports. These
68525 changes do not actually take place until a copy of the message is being
68526 transported. Therefore, they do not affect the basic set of header lines, and
68527 they do not affect the values of the variables that refer to header lines.
68528 </para>
68529 <para>
68530 <emphasis role="bold">Note</emphasis>: In particular, this means that any expansions in the configuration of
68531 the transport cannot refer to the modified header lines, because such
68532 expansions all occur before the message is actually transported.
68533 </para>
68534 <para>
68535 For both routers and transports, the argument of a <option>headers_add</option>
68536 option must be in the form of one or more RFC 2822 header lines, separated by
68537 newlines (coded as <quote>\n</quote>). For example:
68538 </para>
68539 <literallayout class="monospaced">
68540 headers_add = X-added-header: added by $primary_hostname\n\
68541               X-added-second: another added header line
68542 </literallayout>
68543 <para>
68544 Exim does not check the syntax of these added header lines.
68545 </para>
68546 <para>
68547 Multiple <option>headers_add</option> options for a single router or transport can be
68548 specified; the values will append to a single list of header lines.
68549 Each header-line is separately expanded.
68550 </para>
68551 <para>
68552 The argument of a <option>headers_remove</option> option must consist of a colon-separated
68553 list of header names. This is confusing, because header names themselves are
68554 often terminated by colons. In this case, the colons are the list separators,
68555 not part of the names. For example:
68556 </para>
68557 <literallayout class="monospaced">
68558 headers_remove = return-receipt-to:acknowledge-to
68559 </literallayout>
68560 <para>
68561 Multiple <option>headers_remove</option> options for a single router or transport can be
68562 specified; the arguments will append to a single header-names list.
68563 Each item is separately expanded.
68564 Note that colons in complex expansions which are used to
68565 form all or part of a <option>headers_remove</option> list
68566 will act as list separators.
68567 </para>
68568 <para>
68569 When <option>headers_add</option> or <option>headers_remove</option> is specified on a router,
68570 items are expanded at routing time,
68571 and then associated with all addresses that are
68572 accepted by that router, and also with any new addresses that it generates. If
68573 an address passes through several routers as a result of aliasing or
68574 forwarding, the changes are cumulative.
68575 </para>
68576 <para>
68577 <indexterm role="option">
68578 <primary><option>unseen</option></primary>
68579 </indexterm>
68580 However, this does not apply to multiple routers that result from the use of
68581 the <option>unseen</option> option. Any header modifications that were specified by the
68582 <quote>unseen</quote> router or its predecessors apply only to the <quote>unseen</quote> delivery.
68583 </para>
68584 <para>
68585 Addresses that end up with different <option>headers_add</option> or <option>headers_remove</option>
68586 settings cannot be delivered together in a batch, so a transport is always
68587 dealing with a set of addresses that have the same header-processing
68588 requirements.
68589 </para>
68590 <para>
68591 The transport starts by writing the original set of header lines that arrived
68592 with the message, possibly modified by the system filter. As it writes out
68593 these lines, it consults the list of header names that were attached to the
68594 recipient address(es) by <option>headers_remove</option> options in routers, and it also
68595 consults the transport&#x2019;s own <option>headers_remove</option> option. Header lines whose
68596 names are on either of these lists are not written out. If there are multiple
68597 instances of any listed header, they are all skipped.
68598 </para>
68599 <para>
68600 After the remaining original header lines have been written, new header
68601 lines that were specified by routers&#x2019; <option>headers_add</option> options are written, in
68602 the order in which they were attached to the address. These are followed by any
68603 header lines specified by the transport&#x2019;s <option>headers_add</option> option.
68604 </para>
68605 <para>
68606 This way of handling header line modifications in routers and transports has
68607 the following consequences:
68608 </para>
68609 <itemizedlist>
68610 <listitem>
68611 <para>
68612 The original set of header lines, possibly modified by the system filter,
68613 remains <quote>visible</quote>, in the sense that the <varname>$header_</varname><emphasis>xxx</emphasis> variables refer
68614 to it, at all times.
68615 </para>
68616 </listitem>
68617 <listitem>
68618 <para>
68619 Header lines that are added by a router&#x2019;s
68620 <option>headers_add</option> option are not accessible by means of the <varname>$header_</varname><emphasis>xxx</emphasis>
68621 expansion syntax in subsequent routers or the transport.
68622 </para>
68623 </listitem>
68624 <listitem>
68625 <para>
68626 Conversely, header lines that are specified for removal by <option>headers_remove</option>
68627 in a router remain visible to subsequent routers and the transport.
68628 </para>
68629 </listitem>
68630 <listitem>
68631 <para>
68632 Headers added to an address by <option>headers_add</option> in a router cannot be removed by
68633 a later router or by a transport.
68634 </para>
68635 </listitem>
68636 <listitem>
68637 <para>
68638 An added header can refer to the contents of an original header that is to be
68639 removed, even it has the same name as the added header. For example:
68640 </para>
68641 <literallayout class="monospaced">
68642 headers_remove = subject
68643 headers_add = Subject: new subject (was: $h_subject:)
68644 </literallayout>
68645 </listitem>
68646 </itemizedlist>
68647 <para>
68648 <emphasis role="bold">Warning</emphasis>: The <option>headers_add</option> and <option>headers_remove</option> options cannot be used
68649 for a <command>redirect</command> router that has the <option>one_time</option> option set.
68650 </para>
68651 </section>
68652 <section id="SECTconstr">
68653 <title>Constructed addresses</title>
68654 <para>
68655 <indexterm role="concept">
68656 <primary>address</primary>
68657 <secondary>constructed</secondary>
68658 </indexterm>
68659 <indexterm role="concept">
68660 <primary>constructed address</primary>
68661 </indexterm>
68662 When Exim constructs a sender address for a locally-generated message, it uses
68663 the form
68664 </para>
68665 <literallayout>
68666 &lt;<emphasis>user name</emphasis>&gt;&nbsp;&nbsp;&lt;<emphasis>login</emphasis><literal>@</literal><emphasis>qualify_domain</emphasis>&gt;
68667 </literallayout>
68668 <para>
68669 For example:
68670 </para>
68671 <literallayout class="monospaced">
68672 Zaphod Beeblebrox &lt;zaphod@end.univ.example&gt;
68673 </literallayout>
68674 <para>
68675 The user name is obtained from the <option>-F</option> command line option if set, or
68676 otherwise by looking up the calling user by <function>getpwuid()</function> and extracting the
68677 <quote>gecos</quote> field from the password entry. If the <quote>gecos</quote> field contains an
68678 ampersand character, this is replaced by the login name with the first letter
68679 upper cased, as is conventional in a number of operating systems. See the
68680 <option>gecos_name</option> option for a way to tailor the handling of the <quote>gecos</quote> field.
68681 The <option>unknown_username</option> option can be used to specify user names in cases when
68682 there is no password file entry.
68683 </para>
68684 <para>
68685 <indexterm role="concept">
68686 <primary>RFC 2047</primary>
68687 </indexterm>
68688 In all cases, the user name is made to conform to RFC 2822 by quoting all or
68689 parts of it if necessary. In addition, if it contains any non-printing
68690 characters, it is encoded as described in RFC 2047, which defines a way of
68691 including non-ASCII characters in header lines. The value of the
68692 <option>headers_charset</option> option specifies the name of the encoding that is used (the
68693 characters are assumed to be in this encoding). The setting of
68694 <option>print_topbitchars</option> controls whether characters with the top bit set (that
68695 is, with codes greater than 127) count as printing characters or not.
68696 </para>
68697 </section>
68698 <section id="SECID230">
68699 <title>Case of local parts</title>
68700 <para>
68701 <indexterm role="concept">
68702 <primary>case of local parts</primary>
68703 </indexterm>
68704 <indexterm role="concept">
68705 <primary>local part</primary>
68706 <secondary>case of</secondary>
68707 </indexterm>
68708 RFC 2822 states that the case of letters in the local parts of addresses cannot
68709 be assumed to be non-significant. Exim preserves the case of local parts of
68710 addresses, but by default it uses a lower-cased form when it is routing,
68711 because on most Unix systems, usernames are in lower case and case-insensitive
68712 routing is required. However, any particular router can be made to use the
68713 original case for local parts by setting the <option>caseful_local_part</option> generic
68714 router option.
68715 </para>
68716 <para>
68717 <indexterm role="concept">
68718 <primary>mixed-case login names</primary>
68719 </indexterm>
68720 If you must have mixed-case user names on your system, the best way to proceed,
68721 assuming you want case-independent handling of incoming email, is to set up
68722 your first router to convert incoming local parts in your domains to the
68723 correct case by means of a file lookup. For example:
68724 </para>
68725 <literallayout class="monospaced">
68726 correct_case:
68727   driver = redirect
68728   domains = +local_domains
68729   data = ${lookup{$local_part}cdb\
68730               {/etc/usercased.cdb}{$value}fail}\
68731               @$domain
68732 </literallayout>
68733 <para>
68734 For this router, the local part is forced to lower case by the default action
68735 (<option>caseful_local_part</option> is not set). The lower-cased local part is used to look
68736 up a new local part in the correct case. If you then set <option>caseful_local_part</option>
68737 on any subsequent routers which process your domains, they will operate on
68738 local parts with the correct case in a case-sensitive manner.
68739 </para>
68740 </section>
68741 <section id="SECID231">
68742 <title>Dots in local parts</title>
68743 <para>
68744 <indexterm role="concept">
68745 <primary>dot</primary>
68746 <secondary>in local part</secondary>
68747 </indexterm>
68748 <indexterm role="concept">
68749 <primary>local part</primary>
68750 <secondary>dots in</secondary>
68751 </indexterm>
68752 RFC 2822 forbids empty components in local parts. That is, an unquoted local
68753 part may not begin or end with a dot, nor have two consecutive dots in the
68754 middle. However, it seems that many MTAs do not enforce this, so Exim permits
68755 empty components for compatibility.
68756 </para>
68757 </section>
68758 <section id="SECID232">
68759 <title>Rewriting addresses</title>
68760 <para>
68761 <indexterm role="concept">
68762 <primary>rewriting</primary>
68763 <secondary>addresses</secondary>
68764 </indexterm>
68765 Rewriting of sender and recipient addresses, and addresses in headers, can
68766 happen automatically, or as the result of configuration options, as described
68767 in chapter <xref linkend="CHAPrewrite"/>. The headers that may be affected by this are
68768 <emphasis>Bcc:</emphasis>, <emphasis>Cc:</emphasis>, <emphasis>From:</emphasis>, <emphasis>Reply-To:</emphasis>, <emphasis>Sender:</emphasis>, and <emphasis>To:</emphasis>.
68769 </para>
68770 <para>
68771 Automatic rewriting includes qualification, as mentioned above. The other case
68772 in which it can happen is when an incomplete non-local domain is given. The
68773 routing process may cause this to be expanded into the full domain name. For
68774 example, a header such as
68775 </para>
68776 <literallayout class="monospaced">
68777 To: hare@teaparty
68778 </literallayout>
68779 <para>
68780 might get rewritten as
68781 </para>
68782 <literallayout class="monospaced">
68783 To: hare@teaparty.wonderland.fict.example
68784 </literallayout>
68785 <para>
68786 Rewriting as a result of routing is the one kind of message processing that
68787 does not happen at input time, as it cannot be done until the address has
68788 been routed.
68789 </para>
68790 <para>
68791 Strictly, one should not do <emphasis>any</emphasis> deliveries of a message until all its
68792 addresses have been routed, in case any of the headers get changed as a
68793 result of routing. However, doing this in practice would hold up many
68794 deliveries for unreasonable amounts of time, just because one address could not
68795 immediately be routed. Exim therefore does not delay other deliveries when
68796 routing of one or more addresses is deferred.
68797 <indexterm role="concept" startref="IIDmesproc" class="endofrange"/>
68798 </para>
68799 </section>
68800 </chapter>
68801
68802 <chapter id="CHAPSMTP">
68803 <title>SMTP processing</title>
68804 <para>
68805 <indexterm role="concept" id="IIDsmtpproc1" class="startofrange">
68806 <primary>SMTP</primary>
68807 <secondary>processing details</secondary>
68808 </indexterm>
68809 <indexterm role="concept" id="IIDsmtpproc2" class="startofrange">
68810 <primary>LMTP</primary>
68811 <secondary>processing details</secondary>
68812 </indexterm>
68813 Exim supports a number of different ways of using the SMTP protocol, and its
68814 LMTP variant, which is an interactive protocol for transferring messages into a
68815 closed mail store application. This chapter contains details of how SMTP is
68816 processed. For incoming mail, the following are available:
68817 </para>
68818 <itemizedlist>
68819 <listitem>
68820 <para>
68821 SMTP over TCP/IP (Exim daemon or <emphasis>inetd</emphasis>);
68822 </para>
68823 </listitem>
68824 <listitem>
68825 <para>
68826 SMTP over the standard input and output (the <option>-bs</option> option);
68827 </para>
68828 </listitem>
68829 <listitem>
68830 <para>
68831 Batched SMTP on the standard input (the <option>-bS</option> option).
68832 </para>
68833 </listitem>
68834 </itemizedlist>
68835 <para>
68836 For mail delivery, the following are available:
68837 </para>
68838 <itemizedlist>
68839 <listitem>
68840 <para>
68841 SMTP over TCP/IP (the <command>smtp</command> transport);
68842 </para>
68843 </listitem>
68844 <listitem>
68845 <para>
68846 LMTP over TCP/IP (the <command>smtp</command> transport with the <option>protocol</option> option set to
68847 <quote>lmtp</quote>);
68848 </para>
68849 </listitem>
68850 <listitem>
68851 <para>
68852 LMTP over a pipe to a process running in the local host (the <command>lmtp</command>
68853 transport);
68854 </para>
68855 </listitem>
68856 <listitem>
68857 <para>
68858 Batched SMTP to a file or pipe (the <command>appendfile</command> and <command>pipe</command> transports with
68859 the <option>use_bsmtp</option> option set).
68860 </para>
68861 </listitem>
68862 </itemizedlist>
68863 <para>
68864 <emphasis>Batched SMTP</emphasis> is the name for a process in which batches of messages are
68865 stored in or read from files (or pipes), in a format in which SMTP commands are
68866 used to contain the envelope information.
68867 </para>
68868 <section id="SECToutSMTPTCP">
68869 <title>Outgoing SMTP and LMTP over TCP/IP</title>
68870 <para>
68871 <indexterm role="concept">
68872 <primary>SMTP</primary>
68873 <secondary>outgoing over TCP/IP</secondary>
68874 </indexterm>
68875 <indexterm role="concept">
68876 <primary>outgoing SMTP over TCP/IP</primary>
68877 </indexterm>
68878 <indexterm role="concept">
68879 <primary>LMTP</primary>
68880 <secondary>over TCP/IP</secondary>
68881 </indexterm>
68882 <indexterm role="concept">
68883 <primary>outgoing LMTP over TCP/IP</primary>
68884 </indexterm>
68885 <indexterm role="concept">
68886 <primary>EHLO</primary>
68887 </indexterm>
68888 <indexterm role="concept">
68889 <primary>HELO</primary>
68890 </indexterm>
68891 <indexterm role="concept">
68892 <primary>SIZE</primary>
68893 <secondary>option on MAIL command</secondary>
68894 </indexterm>
68895 Outgoing SMTP and LMTP over TCP/IP is implemented by the <command>smtp</command> transport.
68896 The <option>protocol</option> option selects which protocol is to be used, but the actual
68897 processing is the same in both cases.
68898 </para>
68899 <para>
68900 <indexterm role="concept">
68901 <primary>ESMTP extensions</primary>
68902 <secondary>SIZE</secondary>
68903 </indexterm>
68904 If, in response to its EHLO command, Exim is told that the SIZE
68905 extension is supported, it adds SIZE=&lt;<emphasis>n</emphasis>&gt; to each subsequent MAIL
68906 command. The value of &lt;<emphasis>n</emphasis>&gt; is the message size plus the value of the
68907 <option>size_addition</option> option (default 1024) to allow for additions to the message
68908 such as per-transport header lines, or changes made in a
68909 <indexterm role="concept">
68910 <primary>transport</primary>
68911 <secondary>filter</secondary>
68912 </indexterm>
68913 <indexterm role="concept">
68914 <primary>filter</primary>
68915 <secondary>transport filter</secondary>
68916 </indexterm>
68917 transport filter. If <option>size_addition</option> is set negative, the use of SIZE is
68918 suppressed.
68919 </para>
68920 <para>
68921 If the remote server advertises support for PIPELINING, Exim uses the
68922 pipelining extension to SMTP (RFC 2197) to reduce the number of TCP/IP packets
68923 required for the transaction.
68924 </para>
68925 <para>
68926 If the remote server advertises support for the STARTTLS command, and Exim
68927 was built to support TLS encryption, it tries to start a TLS session unless the
68928 server matches <option>hosts_avoid_tls</option>. See chapter <xref linkend="CHAPTLS"/> for more details.
68929 Either a match in that or <option>hosts_verify_avoid_tls</option> apply when the transport
68930 is called for verification.
68931 </para>
68932 <para>
68933 If the remote server advertises support for the AUTH command, Exim scans
68934 the authenticators configuration for any suitable client settings, as described
68935 in chapter <xref linkend="CHAPSMTPAUTH"/>.
68936 </para>
68937 <para>
68938 <indexterm role="concept">
68939 <primary>carriage return</primary>
68940 </indexterm>
68941 <indexterm role="concept">
68942 <primary>linefeed</primary>
68943 </indexterm>
68944 Responses from the remote host are supposed to be terminated by CR followed by
68945 LF. However, there are known to be hosts that do not send CR characters, so in
68946 order to be able to interwork with such hosts, Exim treats LF on its own as a
68947 line terminator.
68948 </para>
68949 <para>
68950 If a message contains a number of different addresses, all those with the same
68951 characteristics (for example, the same envelope sender) that resolve to the
68952 same set of hosts, in the same order, are sent in a single SMTP transaction,
68953 even if they are for different domains, unless there are more than the setting
68954 of the <option>max_rcpt</option>s option in the <command>smtp</command> transport allows, in which case
68955 they are split into groups containing no more than <option>max_rcpt</option>s addresses
68956 each. If <option>remote_max_parallel</option> is greater than one, such groups may be sent
68957 in parallel sessions. The order of hosts with identical MX values is not
68958 significant when checking whether addresses can be batched in this way.
68959 </para>
68960 <para>
68961 When the <command>smtp</command> transport suffers a temporary failure that is not
68962 message-related, Exim updates its transport-specific database, which contains
68963 records indexed by host name that remember which messages are waiting for each
68964 particular host. It also updates the retry database with new retry times.
68965 </para>
68966 <para>
68967 <indexterm role="concept">
68968 <primary>hints database</primary>
68969 <secondary>retry keys</secondary>
68970 </indexterm>
68971 Exim&#x2019;s retry hints are based on host name plus IP address, so if one address of
68972 a multi-homed host is broken, it will soon be skipped most of the time.
68973 See the next section for more detail about error handling.
68974 </para>
68975 <para>
68976 <indexterm role="concept">
68977 <primary>SMTP</primary>
68978 <secondary>passed connection</secondary>
68979 </indexterm>
68980 <indexterm role="concept">
68981 <primary>SMTP</primary>
68982 <secondary>batching over TCP/IP</secondary>
68983 </indexterm>
68984 When a message is successfully delivered over a TCP/IP SMTP connection, Exim
68985 looks in the hints database for the transport to see if there are any queued
68986 messages waiting for the host to which it is connected. If it finds one, it
68987 creates a new Exim process using the <option>-MC</option> option (which can only be used by
68988 a process running as root or the Exim user) and passes the TCP/IP socket to it
68989 so that it can deliver another message using the same socket. The new process
68990 does only those deliveries that are routed to the connected host, and may in
68991 turn pass the socket on to a third process, and so on.
68992 </para>
68993 <para>
68994 The <option>connection_max_messages</option> option of the <command>smtp</command> transport can be used to
68995 limit the number of messages sent down a single TCP/IP connection.
68996 </para>
68997 <para>
68998 <indexterm role="concept">
68999 <primary>asterisk</primary>
69000 <secondary>after IP address</secondary>
69001 </indexterm>
69002 The second and subsequent messages delivered down an existing connection are
69003 identified in the main log by the addition of an asterisk after the closing
69004 square bracket of the IP address.
69005 </para>
69006 </section>
69007 <section id="SECToutSMTPerr">
69008 <title>Errors in outgoing SMTP</title>
69009 <para>
69010 <indexterm role="concept">
69011 <primary>error</primary>
69012 <secondary>in outgoing SMTP</secondary>
69013 </indexterm>
69014 <indexterm role="concept">
69015 <primary>SMTP</primary>
69016 <secondary>errors in outgoing</secondary>
69017 </indexterm>
69018 <indexterm role="concept">
69019 <primary>host</primary>
69020 <secondary>error</secondary>
69021 </indexterm>
69022 Three different kinds of error are recognized for outgoing SMTP: host errors,
69023 message errors, and recipient errors.
69024 </para>
69025 <variablelist>
69026 <varlistentry>
69027 <term><emphasis role="bold">Host errors</emphasis></term>
69028 <listitem>
69029 <para>
69030 A host error is not associated with a particular message or with a
69031 particular recipient of a message. The host errors are:
69032 </para>
69033 <itemizedlist>
69034 <listitem>
69035 <para>
69036 Connection refused or timed out,
69037 </para>
69038 </listitem>
69039 <listitem>
69040 <para>
69041 Any error response code on connection,
69042 </para>
69043 </listitem>
69044 <listitem>
69045 <para>
69046 Any error response code to EHLO or HELO,
69047 </para>
69048 </listitem>
69049 <listitem>
69050 <para>
69051 Loss of connection at any time, except after <quote>.</quote>,
69052 </para>
69053 </listitem>
69054 <listitem>
69055 <para>
69056 I/O errors at any time,
69057 </para>
69058 </listitem>
69059 <listitem>
69060 <para>
69061 Timeouts during the session, other than in response to MAIL, RCPT or
69062 the <quote>.</quote> at the end of the data.
69063 </para>
69064 </listitem>
69065 </itemizedlist>
69066 <para>
69067 For a host error, a permanent error response on connection, or in response to
69068 EHLO, causes all addresses routed to the host to be failed. Any other host
69069 error causes all addresses to be deferred, and retry data to be created for the
69070 host. It is not tried again, for any message, until its retry time arrives. If
69071 the current set of addresses are not all delivered in this run (to some
69072 alternative host), the message is added to the list of those waiting for this
69073 host, so if it is still undelivered when a subsequent successful delivery is
69074 made to the host, it will be sent down the same SMTP connection.
69075 </para>
69076 </listitem></varlistentry>
69077 <varlistentry>
69078 <term><emphasis role="bold">Message errors</emphasis></term>
69079 <listitem>
69080 <para>
69081 <indexterm role="concept">
69082 <primary>message</primary>
69083 <secondary>error</secondary>
69084 </indexterm>
69085 A message error is associated with a particular message when sent to a
69086 particular host, but not with a particular recipient of the message. The
69087 message errors are:
69088 </para>
69089 <itemizedlist>
69090 <listitem>
69091 <para>
69092 Any error response code to MAIL, DATA, or the <quote>.</quote> that terminates
69093 the data,
69094 </para>
69095 </listitem>
69096 <listitem>
69097 <para>
69098 Timeout after MAIL,
69099 </para>
69100 </listitem>
69101 <listitem>
69102 <para>
69103 Timeout or loss of connection after the <quote>.</quote> that terminates the data. A
69104 timeout after the DATA command itself is treated as a host error, as is loss of
69105 connection at any other time.
69106 </para>
69107 </listitem>
69108 </itemizedlist>
69109 <para>
69110 For a message error, a permanent error response (5<emphasis>xx</emphasis>) causes all addresses
69111 to be failed, and a delivery error report to be returned to the sender. A
69112 temporary error response (4<emphasis>xx</emphasis>), or one of the timeouts, causes all
69113 addresses to be deferred. Retry data is not created for the host, but instead,
69114 a retry record for the combination of host plus message id is created. The
69115 message is not added to the list of those waiting for this host. This ensures
69116 that the failing message will not be sent to this host again until the retry
69117 time arrives. However, other messages that are routed to the host are not
69118 affected, so if it is some property of the message that is causing the error,
69119 it will not stop the delivery of other mail.
69120 </para>
69121 <para>
69122 If the remote host specified support for the SIZE parameter in its response
69123 to EHLO, Exim adds SIZE=<emphasis>nnn</emphasis> to the MAIL command, so an
69124 over-large message will cause a message error because the error arrives as a
69125 response to MAIL.
69126 </para>
69127 </listitem></varlistentry>
69128 <varlistentry>
69129 <term><emphasis role="bold">Recipient errors</emphasis></term>
69130 <listitem>
69131 <para>
69132 <indexterm role="concept">
69133 <primary>recipient</primary>
69134 <secondary>error</secondary>
69135 </indexterm>
69136 A recipient error is associated with a particular recipient of a message. The
69137 recipient errors are:
69138 </para>
69139 <itemizedlist>
69140 <listitem>
69141 <para>
69142 Any error response to RCPT,
69143 </para>
69144 </listitem>
69145 <listitem>
69146 <para>
69147 Timeout after RCPT.
69148 </para>
69149 </listitem>
69150 </itemizedlist>
69151 <para>
69152 For a recipient error, a permanent error response (5<emphasis>xx</emphasis>) causes the
69153 recipient address to be failed, and a bounce message to be returned to the
69154 sender. A temporary error response (4<emphasis>xx</emphasis>) or a timeout causes the failing
69155 address to be deferred, and routing retry data to be created for it. This is
69156 used to delay processing of the address in subsequent queue runs, until its
69157 routing retry time arrives. This applies to all messages, but because it
69158 operates only in queue runs, one attempt will be made to deliver a new message
69159 to the failing address before the delay starts to operate. This ensures that,
69160 if the failure is really related to the message rather than the recipient
69161 (<quote>message too big for this recipient</quote> is a possible example), other messages
69162 have a chance of getting delivered. If a delivery to the address does succeed,
69163 the retry information gets cleared, so all stuck messages get tried again, and
69164 the retry clock is reset.
69165 </para>
69166 <para>
69167 The message is not added to the list of those waiting for this host. Use of the
69168 host for other messages is unaffected, and except in the case of a timeout,
69169 other recipients are processed independently, and may be successfully delivered
69170 in the current SMTP session. After a timeout it is of course impossible to
69171 proceed with the session, so all addresses get deferred. However, those other
69172 than the one that failed do not suffer any subsequent retry delays. Therefore,
69173 if one recipient is causing trouble, the others have a chance of getting
69174 through when a subsequent delivery attempt occurs before the failing
69175 recipient&#x2019;s retry time.
69176 </para>
69177 </listitem></varlistentry>
69178 </variablelist>
69179 <para>
69180 In all cases, if there are other hosts (or IP addresses) available for the
69181 current set of addresses (for example, from multiple MX records), they are
69182 tried in this run for any undelivered addresses, subject of course to their
69183 own retry data. In other words, recipient error retry data does not take effect
69184 until the next delivery attempt.
69185 </para>
69186 <para>
69187 Some hosts have been observed to give temporary error responses to every
69188 MAIL command at certain times (<quote>insufficient space</quote> has been seen). It
69189 would be nice if such circumstances could be recognized, and defer data for the
69190 host itself created, but this is not possible within the current Exim design.
69191 What actually happens is that retry data for every (host, message) combination
69192 is created.
69193 </para>
69194 <para>
69195 The reason that timeouts after MAIL and RCPT are treated specially is that
69196 these can sometimes arise as a result of the remote host&#x2019;s verification
69197 procedures. Exim makes this assumption, and treats them as if a temporary error
69198 response had been received. A timeout after <quote>.</quote> is treated specially because
69199 it is known that some broken implementations fail to recognize the end of the
69200 message if the last character of the last line is a binary zero. Thus, it is
69201 helpful to treat this case as a message error.
69202 </para>
69203 <para>
69204 Timeouts at other times are treated as host errors, assuming a problem with the
69205 host, or the connection to it. If a timeout after MAIL, RCPT,
69206 or <quote>.</quote> is really a connection problem, the assumption is that at the next try
69207 the timeout is likely to occur at some other point in the dialogue, causing it
69208 then to be treated as a host error.
69209 </para>
69210 <para>
69211 There is experimental evidence that some MTAs drop the connection after the
69212 terminating <quote>.</quote> if they do not like the contents of the message for some
69213 reason, in contravention of the RFC, which indicates that a 5<emphasis>xx</emphasis> response
69214 should be given. That is why Exim treats this case as a message rather than a
69215 host error, in order not to delay other messages to the same host.
69216 </para>
69217 </section>
69218 <section id="SECID233">
69219 <title>Incoming SMTP messages over TCP/IP</title>
69220 <para>
69221 <indexterm role="concept">
69222 <primary>SMTP</primary>
69223 <secondary>incoming over TCP/IP</secondary>
69224 </indexterm>
69225 <indexterm role="concept">
69226 <primary>incoming SMTP over TCP/IP</primary>
69227 </indexterm>
69228 <indexterm role="concept">
69229 <primary>inetd</primary>
69230 </indexterm>
69231 <indexterm role="concept">
69232 <primary>daemon</primary>
69233 </indexterm>
69234 Incoming SMTP messages can be accepted in one of two ways: by running a
69235 listening daemon, or by using <emphasis>inetd</emphasis>. In the latter case, the entry in
69236 <filename>/etc/inetd.conf</filename> should be like this:
69237 </para>
69238 <literallayout class="monospaced">
69239 smtp stream tcp nowait exim /opt/exim/bin/exim in.exim -bs
69240 </literallayout>
69241 <para>
69242 Exim distinguishes between this case and the case of a locally running user
69243 agent using the <option>-bs</option> option by checking whether or not the standard input is
69244 a socket. When it is, either the port must be privileged (less than 1024), or
69245 the caller must be root or the Exim user. If any other user passes a socket
69246 with an unprivileged port number, Exim prints a message on the standard error
69247 stream and exits with an error code.
69248 </para>
69249 <para>
69250 By default, Exim does not make a log entry when a remote host connects or
69251 disconnects (either via the daemon or <emphasis>inetd</emphasis>), unless the disconnection is
69252 unexpected. It can be made to write such log entries by setting the
69253 <option>smtp_connection</option> log selector.
69254 </para>
69255 <para>
69256 <indexterm role="concept">
69257 <primary>carriage return</primary>
69258 </indexterm>
69259 <indexterm role="concept">
69260 <primary>linefeed</primary>
69261 </indexterm>
69262 Commands from the remote host are supposed to be terminated by CR followed by
69263 LF. However, there are known to be hosts that do not send CR characters. In
69264 order to be able to interwork with such hosts, Exim treats LF on its own as a
69265 line terminator.
69266 Furthermore, because common code is used for receiving messages from all
69267 sources, a CR on its own is also interpreted as a line terminator. However, the
69268 sequence <quote>CR, dot, CR</quote> does not terminate incoming SMTP data.
69269 </para>
69270 <para>
69271 <indexterm role="concept">
69272 <primary>EHLO</primary>
69273 <secondary>invalid data</secondary>
69274 </indexterm>
69275 <indexterm role="concept">
69276 <primary>HELO</primary>
69277 <secondary>invalid data</secondary>
69278 </indexterm>
69279 One area that sometimes gives rise to problems concerns the EHLO or
69280 HELO commands. Some clients send syntactically invalid versions of these
69281 commands, which Exim rejects by default. (This is nothing to do with verifying
69282 the data that is sent, so <option>helo_verify_hosts</option> is not relevant.) You can tell
69283 Exim not to apply a syntax check by setting <option>helo_accept_junk_hosts</option> to
69284 match the broken hosts that send invalid commands.
69285 </para>
69286 <para>
69287 <indexterm role="concept">
69288 <primary>SIZE option on MAIL command</primary>
69289 </indexterm>
69290 <indexterm role="concept">
69291 <primary>MAIL</primary>
69292 <secondary>SIZE option</secondary>
69293 </indexterm>
69294 The amount of disk space available is checked whenever SIZE is received on
69295 a MAIL command, independently of whether <option>message_size_limit</option> or
69296 <option>check_spool_space</option> is configured, unless <option>smtp_check_spool_space</option> is set
69297 false. A temporary error is given if there is not enough space. If
69298 <option>check_spool_space</option> is set, the check is for that amount of space plus the
69299 value given with SIZE, that is, it checks that the addition of the incoming
69300 message will not reduce the space below the threshold.
69301 </para>
69302 <para>
69303 When a message is successfully received, Exim includes the local message id in
69304 its response to the final <quote>.</quote> that terminates the data. If the remote host
69305 logs this text it can help with tracing what has happened to a message.
69306 </para>
69307 <para>
69308 The Exim daemon can limit the number of simultaneous incoming connections it is
69309 prepared to handle (see the <option>smtp_accept_max</option> option). It can also limit the
69310 number of simultaneous incoming connections from a single remote host (see the
69311 <option>smtp_accept_max_per_host</option> option). Additional connection attempts are
69312 rejected using the SMTP temporary error code 421.
69313 </para>
69314 <para>
69315 The Exim daemon does not rely on the SIGCHLD signal to detect when a
69316 subprocess has finished, as this can get lost at busy times. Instead, it looks
69317 for completed subprocesses every time it wakes up. Provided there are other
69318 things happening (new incoming calls, starts of queue runs), completed
69319 processes will be noticed and tidied away. On very quiet systems you may
69320 sometimes see a <quote>defunct</quote> Exim process hanging about. This is not a problem;
69321 it will be noticed when the daemon next wakes up.
69322 </para>
69323 <para>
69324 When running as a daemon, Exim can reserve some SMTP slots for specific hosts,
69325 and can also be set up to reject SMTP calls from non-reserved hosts at times of
69326 high system load &ndash; for details see the <option>smtp_accept_reserve</option>,
69327 <option>smtp_load_reserve</option>, and <option>smtp_reserve_hosts</option> options. The load check
69328 applies in both the daemon and <emphasis>inetd</emphasis> cases.
69329 </para>
69330 <para>
69331 Exim normally starts a delivery process for each message received, though this
69332 can be varied by means of the <option>-odq</option> command line option and the
69333 <option>queue_only</option>, <option>queue_only_file</option>, and <option>queue_only_load</option> options. The
69334 number of simultaneously running delivery processes started in this way from
69335 SMTP input can be limited by the <option>smtp_accept_queue</option> and
69336 <option>smtp_accept_queue_per_connection</option> options. When either limit is reached,
69337 subsequently received messages are just put on the input queue without starting
69338 a delivery process.
69339 </para>
69340 <para>
69341 The controls that involve counts of incoming SMTP calls (<option>smtp_accept_max</option>,
69342 <option>smtp_accept_queue</option>, <option>smtp_accept_reserve</option>) are not available when Exim is
69343 started up from the <emphasis>inetd</emphasis> daemon, because in that case each connection is
69344 handled by an entirely independent Exim process. Control by load average is,
69345 however, available with <emphasis>inetd</emphasis>.
69346 </para>
69347 <para>
69348 Exim can be configured to verify addresses in incoming SMTP commands as they
69349 are received. See chapter <xref linkend="CHAPACL"/> for details. It can also be configured
69350 to rewrite addresses at this time &ndash; before any syntax checking is done. See
69351 section <xref linkend="SECTrewriteS"/>.
69352 </para>
69353 <para>
69354 Exim can also be configured to limit the rate at which a client host submits
69355 MAIL and RCPT commands in a single SMTP session. See the
69356 <option>smtp_ratelimit_hosts</option> option.
69357 </para>
69358 </section>
69359 <section id="SECID234">
69360 <title>Unrecognized SMTP commands</title>
69361 <para>
69362 <indexterm role="concept">
69363 <primary>SMTP</primary>
69364 <secondary>unrecognized commands</secondary>
69365 </indexterm>
69366 If Exim receives more than <option>smtp_max_unknown_commands</option> unrecognized SMTP
69367 commands during a single SMTP connection, it drops the connection after sending
69368 the error response to the last command. The default value for
69369 <option>smtp_max_unknown_commands</option> is 3. This is a defence against some kinds of
69370 abuse that subvert web servers into making connections to SMTP ports; in these
69371 circumstances, a number of non-SMTP lines are sent first.
69372 </para>
69373 </section>
69374 <section id="SECID235">
69375 <title>Syntax and protocol errors in SMTP commands</title>
69376 <para>
69377 <indexterm role="concept">
69378 <primary>SMTP</primary>
69379 <secondary>syntax errors</secondary>
69380 </indexterm>
69381 <indexterm role="concept">
69382 <primary>SMTP</primary>
69383 <secondary>protocol errors</secondary>
69384 </indexterm>
69385 A syntax error is detected if an SMTP command is recognized, but there is
69386 something syntactically wrong with its data, for example, a malformed email
69387 address in a RCPT command. Protocol errors include invalid command
69388 sequencing such as RCPT before MAIL. If Exim receives more than
69389 <option>smtp_max_synprot_errors</option> such commands during a single SMTP connection, it
69390 drops the connection after sending the error response to the last command. The
69391 default value for <option>smtp_max_synprot_errors</option> is 3. This is a defence against
69392 broken clients that loop sending bad commands (yes, it has been seen).
69393 </para>
69394 </section>
69395 <section id="SECID236">
69396 <title>Use of non-mail SMTP commands</title>
69397 <para>
69398 <indexterm role="concept">
69399 <primary>SMTP</primary>
69400 <secondary>non-mail commands</secondary>
69401 </indexterm>
69402 The <quote>non-mail</quote> SMTP commands are those other than MAIL, RCPT, and
69403 DATA. Exim counts such commands, and drops the connection if there are too
69404 many of them in a single SMTP session. This action catches some
69405 denial-of-service attempts and things like repeated failing AUTHs, or a mad
69406 client looping sending EHLO. The global option <option>smtp_accept_max_nonmail</option>
69407 defines what <quote>too many</quote> means. Its default value is 10.
69408 </para>
69409 <para>
69410 When a new message is expected, one occurrence of RSET is not counted. This
69411 allows a client to send one RSET between messages (this is not necessary,
69412 but some clients do it). Exim also allows one uncounted occurrence of HELO
69413 or EHLO, and one occurrence of STARTTLS between messages. After
69414 starting up a TLS session, another EHLO is expected, and so it too is not
69415 counted.
69416 </para>
69417 <para>
69418 The first occurrence of AUTH in a connection, or immediately following
69419 STARTTLS is also not counted. Otherwise, all commands other than MAIL,
69420 RCPT, DATA, and QUIT are counted.
69421 </para>
69422 <para>
69423 You can control which hosts are subject to the limit set by
69424 <option>smtp_accept_max_nonmail</option> by setting
69425 <option>smtp_accept_max_nonmail_hosts</option>. The default value is <literal>*</literal>, which makes
69426 the limit apply to all hosts. This option means that you can exclude any
69427 specific badly-behaved hosts that you have to live with.
69428 </para>
69429 </section>
69430 <section id="SECID237">
69431 <title>The VRFY and EXPN commands</title>
69432 <para>
69433 When Exim receives a VRFY or EXPN command on a TCP/IP connection, it
69434 runs the ACL specified by <option>acl_smtp_vrfy</option> or <option>acl_smtp_expn</option> (as
69435 appropriate) in order to decide whether the command should be accepted or not.
69436 </para>
69437 <para>
69438 <indexterm role="concept">
69439 <primary>VRFY</primary>
69440 <secondary>processing</secondary>
69441 </indexterm>
69442 When no ACL is defined for VRFY, or if it rejects without
69443 setting an explicit response code, the command is accepted
69444 (with a 252 SMTP response code)
69445 in order to support awkward clients that do a VRFY before every RCPT.
69446 When VRFY is accepted, it runs exactly the same code as when Exim is
69447 called with the <option>-bv</option> option, and returns 250/451/550
69448 SMTP response codes.
69449 </para>
69450 <para>
69451 <indexterm role="concept">
69452 <primary>EXPN</primary>
69453 <secondary>processing</secondary>
69454 </indexterm>
69455 If no ACL for EXPN is defined, the command is rejected.
69456 When EXPN is accepted, a single-level expansion of the address is done.
69457 EXPN is treated as an <quote>address test</quote> (similar to the <option>-bt</option> option) rather
69458 than a verification (the <option>-bv</option> option). If an unqualified local part is given
69459 as the argument to EXPN, it is qualified with <option>qualify_domain</option>. Rejections
69460 of VRFY and EXPN commands are logged on the main and reject logs, and
69461 VRFY verification failures are logged on the main log for consistency with
69462 RCPT failures.
69463 </para>
69464 </section>
69465 <section id="SECTETRN">
69466 <title>The ETRN command</title>
69467 <para>
69468 <indexterm role="concept">
69469 <primary>ETRN</primary>
69470 <secondary>processing</secondary>
69471 </indexterm>
69472 <indexterm role="concept">
69473 <primary>ESMTP extensions</primary>
69474 <secondary>ETRN</secondary>
69475 </indexterm>
69476 RFC 1985 describes an ESMTP command called ETRN that is designed to
69477 overcome the security problems of the TURN command (which has fallen into
69478 disuse). When Exim receives an ETRN command on a TCP/IP connection, it runs
69479 the ACL specified by <option>acl_smtp_etrn</option> in order to decide whether the command
69480 should be accepted or not. If no ACL is defined, the command is rejected.
69481 </para>
69482 <para>
69483 The ETRN command is concerned with <quote>releasing</quote> messages that are awaiting
69484 delivery to certain hosts. As Exim does not organize its message queue by host,
69485 the only form of ETRN that is supported by default is the one where the
69486 text starts with the <quote>#</quote> prefix, in which case the remainder of the text is
69487 specific to the SMTP server. A valid ETRN command causes a run of Exim with
69488 the <option>-R</option> option to happen, with the remainder of the ETRN text as its
69489 argument. For example,
69490 </para>
69491 <literallayout class="monospaced">
69492 ETRN #brigadoon
69493 </literallayout>
69494 <para>
69495 runs the command
69496 </para>
69497 <literallayout class="monospaced">
69498 exim -R brigadoon
69499 </literallayout>
69500 <para>
69501 which causes a delivery attempt on all messages with undelivered addresses
69502 containing the text <quote>brigadoon</quote>. When <option>smtp_etrn_serialize</option> is set (the
69503 default), Exim prevents the simultaneous execution of more than one queue run
69504 for the same argument string as a result of an ETRN command. This stops
69505 a misbehaving client from starting more than one queue runner at once.
69506 </para>
69507 <para>
69508 <indexterm role="concept">
69509 <primary>hints database</primary>
69510 <secondary>ETRN serialization</secondary>
69511 </indexterm>
69512 Exim implements the serialization by means of a hints database in which a
69513 record is written whenever a process is started by ETRN, and deleted when
69514 the process completes. However, Exim does not keep the SMTP session waiting for
69515 the ETRN process to complete. Once ETRN is accepted, the client is sent
69516 a <quote>success</quote> return code. Obviously there is scope for hints records to get
69517 left lying around if there is a system or program crash. To guard against this,
69518 Exim ignores any records that are more than six hours old.
69519 </para>
69520 <para>
69521 <indexterm role="option">
69522 <primary><option>smtp_etrn_command</option></primary>
69523 </indexterm>
69524 For more control over what ETRN does, the <option>smtp_etrn_command</option> option can
69525 used. This specifies a command that is run whenever ETRN is received,
69526 whatever the form of its argument. For
69527 example:
69528 </para>
69529 <literallayout class="monospaced">
69530 smtp_etrn_command = /etc/etrn_command $domain \
69531                     $sender_host_address
69532 </literallayout>
69533 <para>
69534 <indexterm role="variable">
69535 <primary><varname>$domain</varname></primary>
69536 </indexterm>
69537 The string is split up into arguments which are independently expanded. The
69538 expansion variable <varname>$domain</varname> is set to the argument of the ETRN command,
69539 and no syntax checking is done on the contents of this argument. Exim does not
69540 wait for the command to complete, so its status code is not checked. Exim runs
69541 under its own uid and gid when receiving incoming SMTP, so it is not possible
69542 for it to change them before running the command.
69543 </para>
69544 </section>
69545 <section id="SECID238">
69546 <title>Incoming local SMTP</title>
69547 <para>
69548 <indexterm role="concept">
69549 <primary>SMTP</primary>
69550 <secondary>local incoming</secondary>
69551 </indexterm>
69552 Some user agents use SMTP to pass messages to their local MTA using the
69553 standard input and output, as opposed to passing the envelope on the command
69554 line and writing the message to the standard input. This is supported by the
69555 <option>-bs</option> option. This form of SMTP is handled in the same way as incoming
69556 messages over TCP/IP (including the use of ACLs), except that the envelope
69557 sender given in a MAIL command is ignored unless the caller is trusted. In
69558 an ACL you can detect this form of SMTP input by testing for an empty host
69559 identification. It is common to have this as the first line in the ACL that
69560 runs for RCPT commands:
69561 </para>
69562 <literallayout class="monospaced">
69563 accept hosts = :
69564 </literallayout>
69565 <para>
69566 This accepts SMTP messages from local processes without doing any other tests.
69567 </para>
69568 </section>
69569 <section id="SECTbatchSMTP">
69570 <title>Outgoing batched SMTP</title>
69571 <para>
69572 <indexterm role="concept">
69573 <primary>SMTP</primary>
69574 <secondary>batched outgoing</secondary>
69575 </indexterm>
69576 <indexterm role="concept">
69577 <primary>batched SMTP output</primary>
69578 </indexterm>
69579 Both the <command>appendfile</command> and <command>pipe</command> transports can be used for handling
69580 batched SMTP. Each has an option called <option>use_bsmtp</option> which causes messages to
69581 be output in BSMTP format. No SMTP responses are possible for this form of
69582 delivery. All it is doing is using SMTP commands as a way of transmitting the
69583 envelope along with the message.
69584 </para>
69585 <para>
69586 The message is written to the file or pipe preceded by the SMTP commands
69587 MAIL and RCPT, and followed by a line containing a single dot. Lines in
69588 the message that start with a dot have an extra dot added. The SMTP command
69589 HELO is not normally used. If it is required, the <option>message_prefix</option> option
69590 can be used to specify it.
69591 </para>
69592 <para>
69593 Because <command>appendfile</command> and <command>pipe</command> are both local transports, they accept only
69594 one recipient address at a time by default. However, you can arrange for them
69595 to handle several addresses at once by setting the <option>batch_max</option> option. When
69596 this is done for BSMTP, messages may contain multiple RCPT commands. See
69597 chapter <xref linkend="CHAPbatching"/> for more details.
69598 </para>
69599 <para>
69600 <indexterm role="variable">
69601 <primary><varname>$host</varname></primary>
69602 </indexterm>
69603 When one or more addresses are routed to a BSMTP transport by a router that
69604 sets up a host list, the name of the first host on the list is available to the
69605 transport in the variable <varname>$host</varname>. Here is an example of such a transport and
69606 router:
69607 </para>
69608 <literallayout class="monospaced">
69609 begin routers
69610 route_append:
69611   driver = manualroute
69612   transport = smtp_appendfile
69613   route_list = domain.example  batch.host.example
69614
69615 begin transports
69616 smtp_appendfile:
69617   driver = appendfile
69618   directory = /var/bsmtp/$host
69619   batch_max = 1000
69620   use_bsmtp
69621   user = exim
69622 </literallayout>
69623 <para>
69624 This causes messages addressed to <emphasis>domain.example</emphasis> to be written in BSMTP
69625 format to <filename>/var/bsmtp/batch.host.example</filename>, with only a single copy of each
69626 message (unless there are more than 1000 recipients).
69627 </para>
69628 </section>
69629 <section id="SECTincomingbatchedSMTP">
69630 <title>Incoming batched SMTP</title>
69631 <para>
69632 <indexterm role="concept">
69633 <primary>SMTP</primary>
69634 <secondary>batched incoming</secondary>
69635 </indexterm>
69636 <indexterm role="concept">
69637 <primary>batched SMTP input</primary>
69638 </indexterm>
69639 The <option>-bS</option> command line option causes Exim to accept one or more messages by
69640 reading SMTP on the standard input, but to generate no responses. If the caller
69641 is trusted, the senders in the MAIL commands are believed; otherwise the
69642 sender is always the caller of Exim. Unqualified senders and receivers are not
69643 rejected (there seems little point) but instead just get qualified. HELO
69644 and EHLO act as RSET; VRFY, EXPN, ETRN and  HELP, act
69645 as NOOP; QUIT quits.
69646 </para>
69647 <para>
69648 Minimal policy checking is done for BSMTP input. Only the non-SMTP
69649 ACL is run in the same way as for non-SMTP local input.
69650 </para>
69651 <para>
69652 If an error is detected while reading a message, including a missing <quote>.</quote> at
69653 the end, Exim gives up immediately. It writes details of the error to the
69654 standard output in a stylized way that the calling program should be able to
69655 make some use of automatically, for example:
69656 </para>
69657 <literallayout class="monospaced">
69658 554 Unexpected end of file
69659 Transaction started in line 10
69660 Error detected in line 14
69661 </literallayout>
69662 <para>
69663 It writes a more verbose version, for human consumption, to the standard error
69664 file, for example:
69665 </para>
69666 <literallayout class="monospaced">
69667 An error was detected while processing a file of BSMTP input.
69668 The error message was:
69669
69670 501 '&gt;' missing at end of address
69671
69672 The SMTP transaction started in line 10.
69673 The error was detected in line 12.
69674 The SMTP command at fault was:
69675
69676 rcpt to:&lt;malformed@in.com.plete
69677
69678 1 previous message was successfully processed.
69679 The rest of the batch was abandoned.
69680 </literallayout>
69681 <para>
69682 The return code from Exim is zero only if there were no errors. It is 1 if some
69683 messages were accepted before an error was detected, and 2 if no messages were
69684 accepted.
69685 <indexterm role="concept" startref="IIDsmtpproc1" class="endofrange"/>
69686 <indexterm role="concept" startref="IIDsmtpproc2" class="endofrange"/>
69687 </para>
69688 </section>
69689 </chapter>
69690
69691 <chapter id="CHAPemsgcust">
69692 <title>Customizing bounce and warning messages</title>
69693 <titleabbrev>Customizing messages</titleabbrev>
69694 <para>
69695 When a message fails to be delivered, or remains in the queue for more than a
69696 configured amount of time, Exim sends a message to the original sender, or
69697 to an alternative configured address. The text of these messages is built into
69698 the code of Exim, but it is possible to change it, either by adding a single
69699 string, or by replacing each of the paragraphs by text supplied in a file.
69700 </para>
69701 <para>
69702 The <emphasis>From:</emphasis> and <emphasis>To:</emphasis> header lines are automatically generated; you can
69703 cause a <emphasis>Reply-To:</emphasis> line to be added by setting the <option>errors_reply_to</option>
69704 option. Exim also adds the line
69705 </para>
69706 <literallayout class="monospaced">
69707 Auto-Submitted: auto-generated
69708 </literallayout>
69709 <para>
69710 to all warning and bounce messages,
69711 </para>
69712 <section id="SECID239">
69713 <title>Customizing bounce messages</title>
69714 <para>
69715 <indexterm role="concept">
69716 <primary>customizing</primary>
69717 <secondary>bounce message</secondary>
69718 </indexterm>
69719 <indexterm role="concept">
69720 <primary>bounce message</primary>
69721 <secondary>customizing</secondary>
69722 </indexterm>
69723 If <option>bounce_message_text</option> is set, its contents are included in the default
69724 message immediately after <quote>This message was created automatically by mail
69725 delivery software.</quote> The string is not expanded. It is not used if
69726 <option>bounce_message_file</option> is set.
69727 </para>
69728 <para>
69729 When <option>bounce_message_file</option> is set, it must point to a template file for
69730 constructing error messages. The file consists of a series of text items,
69731 separated by lines consisting of exactly four asterisks. If the file cannot be
69732 opened, default text is used and a message is written to the main and panic
69733 logs. If any text item in the file is empty, default text is used for that
69734 item.
69735 </para>
69736 <para>
69737 <indexterm role="variable">
69738 <primary><varname>$bounce_recipient</varname></primary>
69739 </indexterm>
69740 <indexterm role="variable">
69741 <primary><varname>$bounce_return_size_limit</varname></primary>
69742 </indexterm>
69743 Each item of text that is read from the file is expanded, and there are two
69744 expansion variables which can be of use here: <varname>$bounce_recipient</varname> is set to
69745 the recipient of an error message while it is being created, and
69746 <varname>$bounce_return_size_limit</varname> contains the value of the <option>return_size_limit</option>
69747 option, rounded to a whole number.
69748 </para>
69749 <para>
69750 The items must appear in the file in the following order:
69751 </para>
69752 <itemizedlist>
69753 <listitem>
69754 <para>
69755 The first item is included in the headers, and should include at least a
69756 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
69757 </para>
69758 </listitem>
69759 <listitem>
69760 <para>
69761 The second item forms the start of the error message. After it, Exim lists the
69762 failing addresses with their error messages.
69763 </para>
69764 </listitem>
69765 <listitem>
69766 <para>
69767 The third item is used to introduce any text from pipe transports that is to be
69768 returned to the sender. It is omitted if there is no such text.
69769 </para>
69770 </listitem>
69771 <listitem>
69772 <para>
69773 The fourth, fifth and sixth items will be ignored and may be empty.
69774 The fields exist for back-compatibility
69775 </para>
69776 </listitem>
69777 </itemizedlist>
69778 <para>
69779 The default state (<option>bounce_message_file</option> unset) is equivalent to the
69780 following file, in which the sixth item is empty. The <emphasis>Subject:</emphasis> and some
69781 other lines have been split in order to fit them on the page:
69782 </para>
69783 <literallayout class="monospaced">
69784 Subject: Mail delivery failed
69785   ${if eq{$sender_address}{$bounce_recipient}
69786   {: returning message to sender}}
69787 ****
69788 This message was created automatically by mail delivery software.
69789
69790 A message ${if eq{$sender_address}{$bounce_recipient}
69791   {that you sent }{sent by
69792
69793 &lt;$sender_address&gt;
69794
69795 }}could not be delivered to all of its recipients.
69796 This is a permanent error. The following address(es) failed:
69797 ****
69798 The following text was generated during the delivery attempt(s):
69799 ****
69800 ------ This is a copy of the message, including all the headers.
69801   ------
69802 ****
69803 ------ The body of the message is $message_size characters long;
69804   only the first
69805 ------ $bounce_return_size_limit or so are included here.
69806 ****
69807 </literallayout>
69808 </section>
69809 <section id="SECTcustwarn">
69810 <title>Customizing warning messages</title>
69811 <para>
69812 <indexterm role="concept">
69813 <primary>customizing</primary>
69814 <secondary>warning message</secondary>
69815 </indexterm>
69816 <indexterm role="concept">
69817 <primary>warning of delay</primary>
69818 <secondary>customizing the message</secondary>
69819 </indexterm>
69820 The option <option>warn_message_file</option> can be pointed at a template file for use when
69821 warnings about message delays are created. In this case there are only three
69822 text sections:
69823 </para>
69824 <itemizedlist>
69825 <listitem>
69826 <para>
69827 The first item is included in the headers, and should include at least a
69828 <emphasis>Subject:</emphasis> header. Exim does not check the syntax of these headers.
69829 </para>
69830 </listitem>
69831 <listitem>
69832 <para>
69833 The second item forms the start of the warning message. After it, Exim lists
69834 the delayed addresses.
69835 </para>
69836 </listitem>
69837 <listitem>
69838 <para>
69839 The third item then ends the message.
69840 </para>
69841 </listitem>
69842 </itemizedlist>
69843 <para>
69844 The default state is equivalent to the following file, except that some lines
69845 have been split here, in order to fit them on the page:
69846 </para>
69847 <literallayout class="monospaced">
69848 Subject: Warning: message $message_exim_id delayed
69849   $warn_message_delay
69850 ****
69851 This message was created automatically by mail delivery software.
69852
69853 A message ${if eq{$sender_address}{$warn_message_recipients}
69854 {that you sent }{sent by
69855
69856 &lt;$sender_address&gt;
69857
69858 }}has not been delivered to all of its recipients after
69859 more than $warn_message_delay in the queue on $primary_hostname.
69860
69861 The message identifier is:     $message_exim_id
69862 The subject of the message is: $h_subject
69863 The date of the message is:    $h_date
69864
69865 The following address(es) have not yet been delivered:
69866 ****
69867 No action is required on your part. Delivery attempts will
69868 continue for some time, and this warning may be repeated at
69869 intervals if the message remains undelivered. Eventually the
69870 mail delivery software will give up, and when that happens,
69871 the message will be returned to you.
69872 </literallayout>
69873 <para>
69874 <indexterm role="variable">
69875 <primary><varname>$warn_message_delay</varname></primary>
69876 </indexterm>
69877 <indexterm role="variable">
69878 <primary><varname>$warn_message_recipients</varname></primary>
69879 </indexterm>
69880 However, in the default state the subject and date lines are omitted if no
69881 appropriate headers exist. During the expansion of this file,
69882 <varname>$warn_message_delay</varname> is set to the delay time in one of the forms <quote>&lt;<emphasis>n</emphasis>&gt;
69883 minutes</quote> or <quote>&lt;<emphasis>n</emphasis>&gt; hours</quote>, and <varname>$warn_message_recipients</varname> contains a list
69884 of recipients for the warning message. There may be more than one if there are
69885 multiple addresses with different <option>errors_to</option> settings on the routers that
69886 handled them.
69887 </para>
69888 </section>
69889 </chapter>
69890
69891 <chapter id="CHAPcomconreq">
69892 <title>Some common configuration settings</title>
69893 <para>
69894 This chapter discusses some configuration settings that seem to be fairly
69895 common. More examples and discussion can be found in the Exim book.
69896 </para>
69897 <section id="SECID240">
69898 <title>Sending mail to a smart host</title>
69899 <para>
69900 <indexterm role="concept">
69901 <primary>smart host</primary>
69902 <secondary>example router</secondary>
69903 </indexterm>
69904 If you want to send all mail for non-local domains to a <quote>smart host</quote>, you
69905 should replace the default <command>dnslookup</command> router with a router which does the
69906 routing explicitly:
69907 </para>
69908 <literallayout class="monospaced">
69909 send_to_smart_host:
69910   driver = manualroute
69911   route_list = !+local_domains smart.host.name
69912   transport = remote_smtp
69913 </literallayout>
69914 <para>
69915 You can use the smart host&#x2019;s IP address instead of the name if you wish.
69916 If you are using Exim only to submit messages to a smart host, and not for
69917 receiving incoming messages, you can arrange for it to do the submission
69918 synchronously by setting the <option>mua_wrapper</option> option (see chapter
69919 <xref linkend="CHAPnonqueueing"/>).
69920 </para>
69921 </section>
69922 <section id="SECTmailinglists">
69923 <title>Using Exim to handle mailing lists</title>
69924 <para>
69925 <indexterm role="concept">
69926 <primary>mailing lists</primary>
69927 </indexterm>
69928 Exim can be used to run simple mailing lists, but for large and/or complicated
69929 requirements, the use of additional specialized mailing list software such as
69930 Majordomo or Mailman is recommended.
69931 </para>
69932 <para>
69933 The <command>redirect</command> router can be used to handle mailing lists where each list
69934 is maintained in a separate file, which can therefore be managed by an
69935 independent manager. The <option>domains</option> router option can be used to run these
69936 lists in a separate domain from normal mail. For example:
69937 </para>
69938 <literallayout class="monospaced">
69939 lists:
69940   driver = redirect
69941   domains = lists.example
69942   file = ${lookup {$local_part} dsearch,ret=full {/usr/lists}}
69943   forbid_pipe
69944   forbid_file
69945   errors_to = ${quote_local_part:$local_part-request}@lists.example
69946   no_more
69947 </literallayout>
69948 <para>
69949 This router is skipped for domains other than <emphasis>lists.example</emphasis>. For addresses
69950 in that domain, it looks for a file that matches the local part. If there is no
69951 such file, the router declines, but because <option>no_more</option> is set, no subsequent
69952 routers are tried, and so the whole delivery fails.
69953 </para>
69954 <para>
69955 The <option>forbid_pipe</option> and <option>forbid_file</option> options prevent a local part from being
69956 expanded into a filename or a pipe delivery, which is usually inappropriate in
69957 a mailing list.
69958 </para>
69959 <para>
69960 <indexterm role="option">
69961 <primary><option>errors_to</option></primary>
69962 </indexterm>
69963 The <option>errors_to</option> option specifies that any delivery errors caused by addresses
69964 taken from a mailing list are to be sent to the given address rather than the
69965 original sender of the message. However, before acting on this, Exim verifies
69966 the error address, and ignores it if verification fails.
69967 </para>
69968 <para>
69969 For example, using the configuration above, mail sent to
69970 <emphasis>dicts@lists.example</emphasis> is passed on to those addresses contained in
69971 <filename>/usr/lists/dicts</filename>, with error reports directed to
69972 <emphasis>dicts-request@lists.example</emphasis>, provided that this address can be verified.
69973 There could be a file called <filename>/usr/lists/dicts-request</filename> containing
69974 the address(es) of this particular list&#x2019;s manager(s), but other approaches,
69975 such as setting up an earlier router (possibly using the <option>local_part_prefix</option>
69976 or <option>local_part_suffix</option> options) to handle addresses of the form
69977 <option>owner-</option><emphasis>xxx</emphasis> or <option>xxx-</option><emphasis>request</emphasis>, are also possible.
69978 </para>
69979 </section>
69980 <section id="SECID241">
69981 <title>Syntax errors in mailing lists</title>
69982 <para>
69983 <indexterm role="concept">
69984 <primary>mailing lists</primary>
69985 <secondary>syntax errors in</secondary>
69986 </indexterm>
69987 If an entry in redirection data contains a syntax error, Exim normally defers
69988 delivery of the original address. That means that a syntax error in a mailing
69989 list holds up all deliveries to the list. This may not be appropriate when a
69990 list is being maintained automatically from data supplied by users, and the
69991 addresses are not rigorously checked.
69992 </para>
69993 <para>
69994 If the <option>skip_syntax_errors</option> option is set, the <command>redirect</command> router just skips
69995 entries that fail to parse, noting the incident in the log. If in addition
69996 <option>syntax_errors_to</option> is set to a verifiable address, a message is sent to it
69997 whenever a broken address is skipped. It is usually appropriate to set
69998 <option>syntax_errors_to</option> to the same address as <option>errors_to</option>.
69999 </para>
70000 </section>
70001 <section id="SECID242">
70002 <title>Re-expansion of mailing lists</title>
70003 <para>
70004 <indexterm role="concept">
70005 <primary>mailing lists</primary>
70006 <secondary>re-expansion of</secondary>
70007 </indexterm>
70008 Exim remembers every individual address to which a message has been delivered,
70009 in order to avoid duplication, but it normally stores only the original
70010 recipient addresses with a message. If all the deliveries to a mailing list
70011 cannot be done at the first attempt, the mailing list is re-expanded when the
70012 delivery is next tried. This means that alterations to the list are taken into
70013 account at each delivery attempt, so addresses that have been added to
70014 the list since the message arrived will therefore receive a copy of the
70015 message, even though it pre-dates their subscription.
70016 </para>
70017 <para>
70018 If this behaviour is felt to be undesirable, the <option>one_time</option> option can be set
70019 on the <command>redirect</command> router. If this is done, any addresses generated by the
70020 router that fail to deliver at the first attempt are added to the message as
70021 <quote>top level</quote> addresses, and the parent address that generated them is marked
70022 <quote>delivered</quote>. Thus, expansion of the mailing list does not happen again at the
70023 subsequent delivery attempts. The disadvantage of this is that if any of the
70024 failing addresses are incorrect, correcting them in the file has no effect on
70025 pre-existing messages.
70026 </para>
70027 <para>
70028 The original top-level address is remembered with each of the generated
70029 addresses, and is output in any log messages. However, any intermediate parent
70030 addresses are not recorded. This makes a difference to the log only if the
70031 <option>all_parents</option> selector is set, but for mailing lists there is normally only
70032 one level of expansion anyway.
70033 </para>
70034 </section>
70035 <section id="SECID243">
70036 <title>Closed mailing lists</title>
70037 <para>
70038 <indexterm role="concept">
70039 <primary>mailing lists</primary>
70040 <secondary>closed</secondary>
70041 </indexterm>
70042 The examples so far have assumed open mailing lists, to which anybody may
70043 send mail. It is also possible to set up closed lists, where mail is accepted
70044 from specified senders only. This is done by making use of the generic
70045 <option>senders</option> option to restrict the router that handles the list.
70046 </para>
70047 <para>
70048 The following example uses the same file as a list of recipients and as a list
70049 of permitted senders. It requires three routers:
70050 </para>
70051 <literallayout class="monospaced">
70052 lists_request:
70053   driver = redirect
70054   domains = lists.example
70055   local_part_suffix = -request
70056   local_parts = ${lookup {$local_part} dsearch,filter=file {/usr/lists}}
70057   file = /usr/lists/${local_part_data}-request
70058   no_more
70059
70060 lists_post:
70061   driver = redirect
70062   domains = lists.example
70063   local_parts = ${lookup {$local_part} dsearch,filter=file,ret=full {/usr/lists}}
70064   senders = ${if exists {$local_part_data} {lsearch;$local_part_data}{*}}
70065   file = ${lookup {$local_part} dsearch,ret=full {/usr/lists}}
70066   forbid_pipe
70067   forbid_file
70068   errors_to = ${quote_local_part:$local_part-request}@lists.example
70069   no_more
70070
70071 lists_closed:
70072   driver = redirect
70073   domains = lists.example
70074   allow_fail
70075   data = :fail: $local_part@lists.example is a closed mailing list
70076 </literallayout>
70077 <para>
70078 All three routers have the same <option>domains</option> setting, so for any other domains,
70079 they are all skipped. The first router runs only if the local part ends in
70080 <option>-request</option>. It handles messages to the list manager(s) by means of an open
70081 mailing list.
70082 </para>
70083 <para>
70084 The second router runs only if the <option>senders</option> precondition is satisfied. It
70085 checks for the existence of a list that corresponds to the local part, and then
70086 checks that the sender is on the list by means of a linear search. It is
70087 necessary to check for the existence of the file before trying to search it,
70088 because otherwise Exim thinks there is a configuration error. If the file does
70089 not exist, the expansion of <option>senders</option> is *, which matches all senders. This
70090 means that the router runs, but because there is no list, declines, and
70091 <option>no_more</option> ensures that no further routers are run. The address fails with an
70092 <quote>unrouteable address</quote> error.
70093 </para>
70094 <para>
70095 The third router runs only if the second router is skipped, which happens when
70096 a mailing list exists, but the sender is not on it. This router forcibly fails
70097 the address, giving a suitable error message.
70098 </para>
70099 </section>
70100 <section id="SECTverp">
70101 <title>Variable Envelope Return Paths (VERP)</title>
70102 <para>
70103 <indexterm role="concept">
70104 <primary>VERP</primary>
70105 </indexterm>
70106 <indexterm role="concept">
70107 <primary>Variable Envelope Return Paths</primary>
70108 </indexterm>
70109 <indexterm role="concept">
70110 <primary>envelope from</primary>
70111 </indexterm>
70112 <indexterm role="concept">
70113 <primary>envelope sender</primary>
70114 </indexterm>
70115 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;
70116 are a way of helping mailing list administrators discover which subscription
70117 address is the cause of a particular delivery failure. The idea is to encode
70118 the original recipient address in the outgoing envelope sender address, so that
70119 if the message is forwarded by another host and then subsequently bounces, the
70120 original recipient can be extracted from the recipient address of the bounce.
70121 </para>
70122 <para>
70123 <indexterm role="option">
70124 <primary><option>errors_to</option></primary>
70125 </indexterm>
70126 <indexterm role="option">
70127 <primary><option>return_path</option></primary>
70128 </indexterm>
70129 Envelope sender addresses can be modified by Exim using two different
70130 facilities: the <option>errors_to</option> option on a router (as shown in previous mailing
70131 list examples), or the <option>return_path</option> option on a transport. The second of
70132 these is effective only if the message is successfully delivered to another
70133 host; it is not used for errors detected on the local host (see the description
70134 of <option>return_path</option> in chapter <xref linkend="CHAPtransportgeneric"/>). Here is an example
70135 of the use of <option>return_path</option> to implement VERP on an <command>smtp</command> transport:
70136 </para>
70137 <literallayout class="monospaced">
70138 verp_smtp:
70139   driver = smtp
70140   max_rcpt = 1
70141   return_path = \
70142     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
70143       {${quote_local_part:$1-request+$local_part=$domain}@your.dom.example}fail}
70144 </literallayout>
70145 <para>
70146 This has the effect of rewriting the return path (envelope sender) on outgoing
70147 SMTP messages, if the local part of the original return path ends in
70148 <quote>-request</quote>, and the domain is <emphasis>your.dom.example</emphasis>. The rewriting inserts the
70149 local part and domain of the recipient into the return path. Suppose, for
70150 example, that a message whose return path has been set to
70151 <emphasis>somelist-request@your.dom.example</emphasis> is sent to
70152 <emphasis>subscriber@other.dom.example</emphasis>. In the transport, the return path is
70153 rewritten as
70154 </para>
70155 <literallayout class="monospaced">
70156 somelist-request+subscriber=other.dom.example@your.dom.example
70157 </literallayout>
70158 <para>
70159 <indexterm role="variable">
70160 <primary><varname>$local_part</varname></primary>
70161 </indexterm>
70162 For this to work, you must tell Exim to send multiple copies of messages that
70163 have more than one recipient, so that each copy has just one recipient. This is
70164 achieved by setting <option>max_rcpt</option> to 1. Without this, a single copy of a message
70165 might be sent to several different recipients in the same domain, in which case
70166 <varname>$local_part</varname> is not available in the transport, because it is not unique.
70167 </para>
70168 <para>
70169 Unless your host is doing nothing but mailing list deliveries, you should
70170 probably use a separate transport for the VERP deliveries, so as not to use
70171 extra resources in making one-per-recipient copies for other deliveries. This
70172 can easily be done by expanding the <option>transport</option> option in the router:
70173 </para>
70174 <literallayout class="monospaced">
70175 dnslookup:
70176   driver = dnslookup
70177   domains = ! +local_domains
70178   transport = \
70179     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}\
70180       {verp_smtp}{remote_smtp}}
70181   no_more
70182 </literallayout>
70183 <para>
70184 If you want to change the return path using <option>errors_to</option> in a router instead
70185 of using <option>return_path</option> in the transport, you need to set <option>errors_to</option> on all
70186 routers that handle mailing list addresses. This will ensure that all delivery
70187 errors, including those detected on the local host, are sent to the VERP
70188 address.
70189 </para>
70190 <para>
70191 On a host that does no local deliveries and has no manual routing, only the
70192 <command>dnslookup</command> router needs to be changed. A special transport is not needed for
70193 SMTP deliveries. Every mailing list recipient has its own return path value,
70194 and so Exim must hand them to the transport one at a time. Here is an example
70195 of a <command>dnslookup</command> router that implements VERP:
70196 </para>
70197 <literallayout class="monospaced">
70198 verp_dnslookup:
70199   driver = dnslookup
70200   domains = ! +local_domains
70201   transport = remote_smtp
70202   errors_to = \
70203     ${if match {$return_path}{^(.+?)-request@your.dom.example\$}}
70204      {${quote_local_part:$1-request+$local_part=$domain}@your.dom.example}fail}
70205   no_more
70206 </literallayout>
70207 <para>
70208 Before you start sending out messages with VERPed return paths, you must also
70209 configure Exim to accept the bounce messages that come back to those paths.
70210 Typically this is done by setting a <option>local_part_suffix</option> option for a
70211 router, and using this to route the messages to wherever you want to handle
70212 them.
70213 </para>
70214 <para>
70215 The overhead incurred in using VERP depends very much on the size of the
70216 message, the number of recipient addresses that resolve to the same remote
70217 host, and the speed of the connection over which the message is being sent. If
70218 a lot of addresses resolve to the same host and the connection is slow, sending
70219 a separate copy of the message for each address may take substantially longer
70220 than sending a single copy with many recipients (for which VERP cannot be
70221 used).
70222 </para>
70223 </section>
70224 <section id="SECTvirtualdomains">
70225 <title>Virtual domains</title>
70226 <para>
70227 <indexterm role="concept">
70228 <primary>virtual domains</primary>
70229 </indexterm>
70230 <indexterm role="concept">
70231 <primary>domain</primary>
70232 <secondary>virtual</secondary>
70233 </indexterm>
70234 The phrase <emphasis>virtual domain</emphasis> is unfortunately used with two rather different
70235 meanings:
70236 </para>
70237 <itemizedlist>
70238 <listitem>
70239 <para>
70240 A domain for which there are no real mailboxes; all valid local parts are
70241 aliases for other email addresses. Common examples are organizational
70242 top-level domains and <quote>vanity</quote> domains.
70243 </para>
70244 </listitem>
70245 <listitem>
70246 <para>
70247 One of a number of independent domains that are all handled by the same host,
70248 with mailboxes on that host, but where the mailbox owners do not necessarily
70249 have login accounts on that host.
70250 </para>
70251 </listitem>
70252 </itemizedlist>
70253 <para>
70254 The first usage is probably more common, and does seem more <quote>virtual</quote> than
70255 the second. This kind of domain can be handled in Exim with a straightforward
70256 aliasing router. One approach is to create a separate alias file for each
70257 virtual domain. Exim can test for the existence of the alias file to determine
70258 whether the domain exists. The <command>dsearch</command> lookup type is useful here, leading
70259 to a router of this form:
70260 </para>
70261 <literallayout class="monospaced">
70262 virtual:
70263   driver = redirect
70264   domains = dsearch;/etc/mail/virtual
70265   data = ${lookup{$local_part}lsearch{/etc/mail/virtual/$domain_data}}
70266   no_more
70267 </literallayout>
70268 <para>
70269 The <option>domains</option> option specifies that the router is to be skipped, unless there
70270 is a file in the <filename>/etc/mail/virtual</filename> directory whose name is the same as the
70271 domain that is being processed.
70272 The <command>dsearch</command> lookup used results in an untainted version of <varname>$domain</varname>
70273 being placed into the <varname>$domain_data</varname> variable.
70274 </para>
70275 <para>
70276 When the router runs, it looks up the local
70277 part in the file to find a new address (or list of addresses). The <option>no_more</option>
70278 setting ensures that if the lookup fails (leading to <option>data</option> being an empty
70279 string), Exim gives up on the address without trying any subsequent routers.
70280 </para>
70281 <para>
70282 This one router can handle all the virtual domains because the alias filenames
70283 follow a fixed pattern. Permissions can be arranged so that appropriate people
70284 can edit the different alias files. A successful aliasing operation results in
70285 a new envelope recipient address, which is then routed from scratch.
70286 </para>
70287 <para>
70288 The other kind of <quote>virtual</quote> domain can also be handled in a straightforward
70289 way. One approach is to create a file for each domain containing a list of
70290 valid local parts, and use it in a router like this:
70291 </para>
70292 <literallayout class="monospaced">
70293 my_domains:
70294   driver = accept
70295   domains = dsearch;/etc/mail/domains
70296   local_parts = lsearch;/etc/mail/domains/$domain
70297   transport = my_mailboxes
70298 </literallayout>
70299 <para>
70300 The address is accepted if there is a file for the domain, and the local part
70301 can be found in the file. The <option>domains</option> option is used to check for the
70302 file&#x2019;s existence because <option>domains</option> is tested before the <option>local_parts</option>
70303 option (see section <xref linkend="SECTrouprecon"/>). You cannot use <option>require_files</option>,
70304 because that option is tested after <option>local_parts</option>. The transport is as
70305 follows:
70306 </para>
70307 <literallayout class="monospaced">
70308 my_mailboxes:
70309   driver = appendfile
70310   file = /var/mail/$domain_data/$local_part_data
70311   user = mail
70312 </literallayout>
70313 <para>
70314 This uses a directory of mailboxes for each domain. The <option>user</option> setting is
70315 required, to specify which uid is to be used for writing to the mailboxes.
70316 </para>
70317 <para>
70318 The configuration shown here is just one example of how you might support this
70319 requirement. There are many other ways this kind of configuration can be set
70320 up, for example, by using a database instead of separate files to hold all the
70321 information about the domains.
70322 </para>
70323 </section>
70324 <section id="SECTmulbox">
70325 <title>Multiple user mailboxes</title>
70326 <para>
70327 <indexterm role="concept">
70328 <primary>multiple mailboxes</primary>
70329 </indexterm>
70330 <indexterm role="concept">
70331 <primary>mailbox</primary>
70332 <secondary>multiple</secondary>
70333 </indexterm>
70334 <indexterm role="concept">
70335 <primary>local part</primary>
70336 <secondary>prefix</secondary>
70337 </indexterm>
70338 <indexterm role="concept">
70339 <primary>local part</primary>
70340 <secondary>suffix</secondary>
70341 </indexterm>
70342 Heavy email users often want to operate with multiple mailboxes, into which
70343 incoming mail is automatically sorted. A popular way of handling this is to
70344 allow users to use multiple sender addresses, so that replies can easily be
70345 identified. Users are permitted to add prefixes or suffixes to their local
70346 parts for this purpose. The wildcard facility of the generic router options
70347 <option>local_part_prefix</option> and <option>local_part_suffix</option> can be used for this. For
70348 example, consider this router:
70349 </para>
70350 <literallayout class="monospaced">
70351 userforward:
70352   driver = redirect
70353   check_local_user
70354   file = $home/.forward
70355   local_part_suffix = -*
70356   local_part_suffix_optional
70357   allow_filter
70358 </literallayout>
70359 <para>
70360 <indexterm role="variable">
70361 <primary><varname>$local_part_suffix</varname></primary>
70362 </indexterm>
70363 It runs a user&#x2019;s <filename>.forward</filename> file for all local parts of the form
70364 <emphasis>username-*</emphasis>. Within the filter file the user can distinguish different
70365 cases by testing the variable <varname>$local_part_suffix</varname>. For example:
70366 </para>
70367 <literallayout class="monospaced">
70368 if $local_part_suffix contains -special then
70369 save /home/$local_part_data/Mail/special
70370 endif
70371 </literallayout>
70372 <para>
70373 If the filter file does not exist, or does not deal with such addresses, they
70374 fall through to subsequent routers, and, assuming no subsequent use of the
70375 <option>local_part_suffix</option> option is made, they presumably fail. Thus, users have
70376 control over which suffixes are valid.
70377 </para>
70378 <para>
70379 Alternatively, a suffix can be used to trigger the use of a different
70380 <filename>.forward</filename> file &ndash; which is the way a similar facility is implemented in
70381 another MTA:
70382 </para>
70383 <literallayout class="monospaced">
70384 userforward:
70385   driver = redirect
70386   check_local_user
70387   local_part_suffix = -*
70388   local_part_suffix_optional
70389   file = ${lookup {.forward$local_part_suffix} dsearch,ret=full {$home} {$value}fail}
70390   allow_filter
70391 </literallayout>
70392 <para>
70393 If there is no suffix, <filename>.forward</filename> is used; if the suffix is <emphasis>-special</emphasis>, for
70394 example, <filename>.forward-special</filename> is used. Once again, if the appropriate file
70395 does not exist, or does not deal with the address, it is passed on to
70396 subsequent routers, which could, if required, look for an unqualified
70397 <filename>.forward</filename> file to use as a default.
70398 </para>
70399 </section>
70400 <section id="SECID244">
70401 <title>Simplified vacation processing</title>
70402 <para>
70403 <indexterm role="concept">
70404 <primary>vacation processing</primary>
70405 </indexterm>
70406 The traditional way of running the <emphasis>vacation</emphasis> program is for a user to set up
70407 a pipe command in a <filename>.forward</filename> file
70408 (see section <xref linkend="SECTspecitredli"/> for syntax details).
70409 This is prone to error by inexperienced users. There are two features of Exim
70410 that can be used to make this process simpler for users:
70411 </para>
70412 <itemizedlist>
70413 <listitem>
70414 <para>
70415 A local part prefix such as <quote>vacation-</quote> can be specified on a router which
70416 can cause the message to be delivered directly to the <emphasis>vacation</emphasis> program, or
70417 alternatively can use Exim&#x2019;s <command>autoreply</command> transport. The contents of a user&#x2019;s
70418 <filename>.forward</filename> file are then much simpler. For example:
70419 </para>
70420 <literallayout class="monospaced">
70421 spqr, vacation-spqr
70422 </literallayout>
70423 </listitem>
70424 <listitem>
70425 <para>
70426 The <option>require_files</option> generic router option can be used to trigger a
70427 vacation delivery by checking for the existence of a certain file in the
70428 user&#x2019;s home directory. The <option>unseen</option> generic option should also be used, to
70429 ensure that the original delivery also proceeds. In this case, all the user has
70430 to do is to create a file called, say, <filename>.vacation</filename>, containing a vacation
70431 message.
70432 </para>
70433 </listitem>
70434 </itemizedlist>
70435 <para>
70436 Another advantage of both these methods is that they both work even when the
70437 use of arbitrary pipes by users is locked out.
70438 </para>
70439 </section>
70440 <section id="SECID245">
70441 <title>Taking copies of mail</title>
70442 <para>
70443 <indexterm role="concept">
70444 <primary>message</primary>
70445 <secondary>copying every</secondary>
70446 </indexterm>
70447 Some installations have policies that require archive copies of all messages to
70448 be made. A single copy of each message can easily be taken by an appropriate
70449 command in a system filter, which could, for example, use a different file for
70450 each day&#x2019;s messages.
70451 </para>
70452 <para>
70453 There is also a shadow transport mechanism that can be used to take copies of
70454 messages that are successfully delivered by local transports, one copy per
70455 delivery. This could be used, <emphasis>inter alia</emphasis>, to implement automatic
70456 notification of delivery by sites that insist on doing such things.
70457 </para>
70458 </section>
70459 <section id="SECID246">
70460 <title>Intermittently connected hosts</title>
70461 <para>
70462 <indexterm role="concept">
70463 <primary>intermittently connected hosts</primary>
70464 </indexterm>
70465 It has become quite common (because it is cheaper) for hosts to connect to the
70466 Internet periodically rather than remain connected all the time. The normal
70467 arrangement is that mail for such hosts accumulates on a system that is
70468 permanently connected.
70469 </para>
70470 <para>
70471 Exim was designed for use on permanently connected hosts, and so it is not
70472 particularly well-suited to use in an intermittently connected environment.
70473 Nevertheless there are some features that can be used.
70474 </para>
70475 </section>
70476 <section id="SECID247">
70477 <title>Exim on the upstream server host</title>
70478 <para>
70479 It is tempting to arrange for incoming mail for the intermittently connected
70480 host to remain in Exim&#x2019;s queue until the client connects. However, this
70481 approach does not scale very well. Two different kinds of waiting message are
70482 being mixed up in the same queue &ndash; those that cannot be delivered because of
70483 some temporary problem, and those that are waiting for their destination host
70484 to connect. This makes it hard to manage the queue, as well as wasting
70485 resources, because each queue runner scans the entire queue.
70486 </para>
70487 <para>
70488 A better approach is to separate off those messages that are waiting for an
70489 intermittently connected host. This can be done by delivering these messages
70490 into local files in batch SMTP, <quote>mailstore</quote>, or other envelope-preserving
70491 format, from where they are transmitted by other software when their
70492 destination connects. This makes it easy to collect all the mail for one host
70493 in a single directory, and to apply local timeout rules on a per-message basis
70494 if required.
70495 </para>
70496 <para>
70497 On a very small scale, leaving the mail on Exim&#x2019;s queue can be made to work. If
70498 you are doing this, you should configure Exim with a long retry period for the
70499 intermittent host. For example:
70500 </para>
70501 <literallayout class="monospaced">
70502 cheshire.wonderland.fict.example    *   F,5d,24h
70503 </literallayout>
70504 <para>
70505 This stops a lot of failed delivery attempts from occurring, but Exim remembers
70506 which messages it has queued up for that host. Once the intermittent host comes
70507 online, forcing delivery of one message (either by using the <option>-M</option> or <option>-R</option>
70508 options, or by using the ETRN SMTP command (see section <xref linkend="SECTETRN"/>)
70509 causes all the queued up messages to be delivered, often down a single SMTP
70510 connection. While the host remains connected, any new messages get delivered
70511 immediately.
70512 </para>
70513 <para>
70514 If the connecting hosts do not have fixed IP addresses, that is, if a host is
70515 issued with a different IP address each time it connects, Exim&#x2019;s retry
70516 mechanisms on the holding host get confused, because the IP address is normally
70517 used as part of the key string for holding retry information. This can be
70518 avoided by unsetting <option>retry_include_ip_address</option> on the <command>smtp</command> transport.
70519 Since this has disadvantages for permanently connected hosts, it is best to
70520 arrange a separate transport for the intermittently connected ones.
70521 </para>
70522 </section>
70523 <section id="SECID248">
70524 <title>Exim on the intermittently connected client host</title>
70525 <para>
70526 The value of <option>smtp_accept_queue_per_connection</option> should probably be
70527 increased, or even set to zero (that is, disabled) on the intermittently
70528 connected host, so that all incoming messages down a single connection get
70529 delivered immediately.
70530 </para>
70531 <para>
70532 <indexterm role="concept">
70533 <primary>SMTP</primary>
70534 <secondary>passed connection</secondary>
70535 </indexterm>
70536 <indexterm role="concept">
70537 <primary>SMTP</primary>
70538 <secondary>multiple deliveries</secondary>
70539 </indexterm>
70540 <indexterm role="concept">
70541 <primary>multiple SMTP deliveries</primary>
70542 </indexterm>
70543 <indexterm role="concept">
70544 <primary>first pass routing</primary>
70545 </indexterm>
70546 Mail waiting to be sent from an intermittently connected host will probably
70547 not have been routed, because without a connection DNS lookups are not
70548 possible. This means that if a normal queue run is done at connection time,
70549 each message is likely to be sent in a separate SMTP session. This can be
70550 avoided by starting the queue run with a command line option beginning with
70551 <option>-qq</option> instead of <option>-q</option>. In this case, the queue is scanned twice. In the
70552 first pass, routing is done but no deliveries take place. The second pass is a
70553 normal queue run; since all the messages have been previously routed, those
70554 destined for the same host are likely to get sent as multiple deliveries in a
70555 single SMTP connection.
70556 </para>
70557 </section>
70558 </chapter>
70559
70560 <chapter id="CHAPnonqueueing">
70561 <title>Using Exim as a non-queueing client</title>
70562 <titleabbrev>Exim as a non-queueing client</titleabbrev>
70563 <para>
70564 <indexterm role="concept">
70565 <primary>client, non-queueing</primary>
70566 </indexterm>
70567 <indexterm role="concept">
70568 <primary>smart host</primary>
70569 <secondary>suppressing queueing</secondary>
70570 </indexterm>
70571 On a personal computer, it is a common requirement for all
70572 email to be sent to a <quote>smart host</quote>. There are plenty of MUAs that can be
70573 configured to operate that way, for all the popular operating systems.
70574 However, there are some MUAs for Unix-like systems that cannot be so
70575 configured: they submit messages using the command line interface of
70576 <filename>/usr/sbin/sendmail</filename>. Furthermore, utility programs such as <emphasis>cron</emphasis> submit
70577 messages this way.
70578 </para>
70579 <para>
70580 If the personal computer runs continuously, there is no problem, because it can
70581 run a conventional MTA that handles delivery to the smart host, and deal with
70582 any delays via its queueing mechanism. However, if the computer does not run
70583 continuously or runs different operating systems at different times, queueing
70584 email is not desirable.
70585 </para>
70586 <para>
70587 There is therefore a requirement for something that can provide the
70588 <filename>/usr/sbin/sendmail</filename> interface but deliver messages to a smart host without
70589 any queueing or retrying facilities. Furthermore, the delivery to the smart
70590 host should be synchronous, so that if it fails, the sending MUA is immediately
70591 informed. In other words, we want something that extends an MUA that submits
70592 to a local MTA via the command line so that it behaves like one that submits
70593 to a remote smart host using TCP/SMTP.
70594 </para>
70595 <para>
70596 There are a number of applications (for example, there is one called <emphasis>ssmtp</emphasis>)
70597 that do this job. However, people have found them to be lacking in various
70598 ways. For instance, you might want to allow aliasing and forwarding to be done
70599 before sending a message to the smart host.
70600 </para>
70601 <para>
70602 Exim already had the necessary infrastructure for doing this job. Just a few
70603 tweaks were needed to make it behave as required, though it is somewhat of an
70604 overkill to use a fully-featured MTA for this purpose.
70605 </para>
70606 <para>
70607 <indexterm role="option">
70608 <primary><option>mua_wrapper</option></primary>
70609 </indexterm>
70610 There is a Boolean global option called <option>mua_wrapper</option>, defaulting false.
70611 Setting <option>mua_wrapper</option> true causes Exim to run in a special mode where it
70612 assumes that it is being used to <quote>wrap</quote> a command-line MUA in the manner
70613 just described. As well as setting <option>mua_wrapper</option>, you also need to provide a
70614 compatible router and transport configuration. Typically there will be just one
70615 router and one transport, sending everything to a smart host.
70616 </para>
70617 <para>
70618 When run in MUA wrapping mode, the behaviour of Exim changes in the
70619 following ways:
70620 </para>
70621 <itemizedlist>
70622 <listitem>
70623 <para>
70624 A daemon cannot be run, nor will Exim accept incoming messages from <emphasis>inetd</emphasis>.
70625 In other words, the only way to submit messages is via the command line.
70626 </para>
70627 </listitem>
70628 <listitem>
70629 <para>
70630 Each message is synchronously delivered as soon as it is received (<option>-odi</option> is
70631 assumed). All queueing options (<option>queue_only</option>, <option>queue_smtp_domains</option>,
70632 <option>control</option> in an ACL, etc.) are quietly ignored. The Exim reception process
70633 does not finish until the delivery attempt is complete. If the delivery is
70634 successful, a zero return code is given.
70635 </para>
70636 </listitem>
70637 <listitem>
70638 <para>
70639 Address redirection is permitted, but the final routing for all addresses must
70640 be to the same remote transport, and to the same list of hosts. Furthermore,
70641 the return address (envelope sender) must be the same for all recipients, as
70642 must any added or deleted header lines. In other words, it must be possible to
70643 deliver the message in a single SMTP transaction, however many recipients there
70644 are.
70645 </para>
70646 </listitem>
70647 <listitem>
70648 <para>
70649 If these conditions are not met, or if routing any address results in a
70650 failure or defer status, or if Exim is unable to deliver all the recipients
70651 successfully to one of the smart hosts, delivery of the entire message fails.
70652 </para>
70653 </listitem>
70654 <listitem>
70655 <para>
70656 Because no queueing is allowed, all failures are treated as permanent; there
70657 is no distinction between 4<emphasis>xx</emphasis> and 5<emphasis>xx</emphasis> SMTP response codes from the
70658 smart host. Furthermore, because only a single yes/no response can be given to
70659 the caller, it is not possible to deliver to some recipients and not others. If
70660 there is an error (temporary or permanent) for any recipient, all are failed.
70661 </para>
70662 </listitem>
70663 <listitem>
70664 <para>
70665 If more than one smart host is listed, Exim will try another host after a
70666 connection failure or a timeout, in the normal way. However, if this kind of
70667 failure happens for all the hosts, the delivery fails.
70668 </para>
70669 </listitem>
70670 <listitem>
70671 <para>
70672 When delivery fails, an error message is written to the standard error stream
70673 (as well as to Exim&#x2019;s log), and Exim exits to the caller with a return code
70674 value 1. The message is expunged from Exim&#x2019;s spool files. No bounce messages
70675 are ever generated.
70676 </para>
70677 </listitem>
70678 <listitem>
70679 <para>
70680 No retry data is maintained, and any retry rules are ignored.
70681 </para>
70682 </listitem>
70683 <listitem>
70684 <para>
70685 A number of Exim options are overridden: <option>deliver_drop_privilege</option> is forced
70686 true, <option>max_rcpt</option> in the <command>smtp</command> transport is forced to <quote>unlimited</quote>,
70687 <option>remote_max_parallel</option> is forced to one, and fallback hosts are ignored.
70688 </para>
70689 </listitem>
70690 </itemizedlist>
70691 <para>
70692 The overall effect is that Exim makes a single synchronous attempt to deliver
70693 the message, failing if there is any kind of problem. Because no local
70694 deliveries are done and no daemon can be run, Exim does not need root
70695 privilege. It should be possible to run it setuid to <emphasis>exim</emphasis> instead of setuid
70696 to <emphasis>root</emphasis>. See section <xref linkend="SECTrunexiwitpri"/> for a general discussion about
70697 the advantages and disadvantages of running without root privilege.
70698 </para>
70699 </chapter>
70700
70701 <chapter id="CHAPlog">
70702 <title>Log files</title>
70703 <para>
70704 <indexterm role="concept" id="IIDloggen" class="startofrange">
70705 <primary>log</primary>
70706 <secondary>general description</secondary>
70707 </indexterm>
70708 <indexterm role="concept">
70709 <primary>log</primary>
70710 <secondary>types of</secondary>
70711 </indexterm>
70712 Exim writes three different logs, referred to as the main log, the reject log,
70713 and the panic log:
70714 </para>
70715 <itemizedlist>
70716 <listitem>
70717 <para>
70718 <indexterm role="concept">
70719 <primary>main log</primary>
70720 </indexterm>
70721 The main log records the arrival of each message and each delivery in a single
70722 line in each case. The format is as compact as possible, in an attempt to keep
70723 down the size of log files. Two-character flag sequences make it easy to pick
70724 out these lines. A number of other events are recorded in the main log. Some of
70725 them are optional, in which case the <option>log_selector</option> option controls whether
70726 they are included or not. A Perl script called <emphasis>eximstats</emphasis>, which does simple
70727 analysis of main log files, is provided in the Exim distribution (see section
70728 <xref linkend="SECTmailstat"/>).
70729 </para>
70730 </listitem>
70731 <listitem>
70732 <para>
70733 <indexterm role="concept">
70734 <primary>reject log</primary>
70735 </indexterm>
70736 The reject log records information from messages that are rejected as a result
70737 of a configuration option (that is, for policy reasons).
70738 The first line of each rejection is a copy of the line that is also written to
70739 the main log. Then, if the message&#x2019;s header has been read at the time the log
70740 is written, its contents are written to this log. Only the original header
70741 lines are available; header lines added by ACLs are not logged. You can use the
70742 reject log to check that your policy controls are working correctly; on a busy
70743 host this may be easier than scanning the main log for rejection messages. You
70744 can suppress the writing of the reject log by setting <option>write_rejectlog</option>
70745 false.
70746 </para>
70747 </listitem>
70748 <listitem>
70749 <para>
70750 <indexterm role="concept">
70751 <primary>panic log</primary>
70752 </indexterm>
70753 <indexterm role="concept">
70754 <primary>system log</primary>
70755 </indexterm>
70756 When certain serious errors occur, Exim writes entries to its panic log. If the
70757 error is sufficiently disastrous, Exim bombs out afterwards. Panic log entries
70758 are usually written to the main log as well, but can get lost amid the mass of
70759 other entries. The panic log should be empty under normal circumstances. It is
70760 therefore a good idea to check it (or to have a <emphasis>cron</emphasis> script check it)
70761 regularly, in order to become aware of any problems. When Exim cannot open its
70762 panic log, it tries as a last resort to write to the system log (syslog). This
70763 is opened with LOG_PID+LOG_CONS and the facility code of LOG_MAIL. The
70764 message itself is written at priority LOG_CRIT.
70765 </para>
70766 </listitem>
70767 </itemizedlist>
70768 <para>
70769 Every log line starts with a timestamp, in the format shown in the following
70770 example. Note that many of the examples shown in this chapter are line-wrapped.
70771 In the log file, this would be all on one line:
70772 </para>
70773 <literallayout class="monospaced">
70774 2001-09-16 16:09:47 SMTP connection from [127.0.0.1] closed
70775   by QUIT
70776 </literallayout>
70777 <para>
70778 By default, the timestamps are in the local timezone. There are two
70779 ways of changing this:
70780 </para>
70781 <itemizedlist>
70782 <listitem>
70783 <para>
70784 You can set the <option>timezone</option> option to a different time zone; in particular, if
70785 you set
70786 </para>
70787 <literallayout class="monospaced">
70788 timezone = UTC
70789 </literallayout>
70790 <para>
70791 the timestamps will be in UTC (aka GMT).
70792 </para>
70793 </listitem>
70794 <listitem>
70795 <para>
70796 If you set <option>log_timezone</option> true, the time zone is added to the timestamp, for
70797 example:
70798 </para>
70799 <literallayout class="monospaced">
70800 2003-04-25 11:17:07 +0100 Start queue run: pid=12762
70801 </literallayout>
70802 </listitem>
70803 </itemizedlist>
70804 <para>
70805 <indexterm role="concept">
70806 <primary>log</primary>
70807 <secondary>process ids in</secondary>
70808 </indexterm>
70809 <indexterm role="concept">
70810 <primary>pid (process id)</primary>
70811 <secondary>in log lines</secondary>
70812 </indexterm>
70813 Exim does not include its process id in log lines by default, but you can
70814 request that it does so by specifying the <literal>pid</literal> log selector (see section
70815 <xref linkend="SECTlogselector"/>). When this is set, the process id is output, in square
70816 brackets, immediately after the time and date.
70817 </para>
70818 <section id="SECTwhelogwri">
70819 <title>Where the logs are written</title>
70820 <para>
70821 <indexterm role="concept">
70822 <primary>log</primary>
70823 <secondary>destination</secondary>
70824 </indexterm>
70825 <indexterm role="concept">
70826 <primary>log</primary>
70827 <secondary>to file</secondary>
70828 </indexterm>
70829 <indexterm role="concept">
70830 <primary>log</primary>
70831 <secondary>to syslog</secondary>
70832 </indexterm>
70833 <indexterm role="concept">
70834 <primary>syslog</primary>
70835 </indexterm>
70836 The logs may be written to local files, or to syslog, or both. However, it
70837 should be noted that many syslog implementations use UDP as a transport, and
70838 are therefore unreliable in the sense that messages are not guaranteed to
70839 arrive at the loghost, nor is the ordering of messages necessarily maintained.
70840 It has also been reported that on large log files (tens of megabytes) you may
70841 need to tweak syslog to prevent it syncing the file with each write &ndash; on
70842 Linux this has been seen to make syslog take 90% plus of CPU time.
70843 </para>
70844 <para>
70845 The destination for Exim&#x2019;s logs is configured by setting LOG_FILE_PATH in
70846 <filename>Local/Makefile</filename> or by setting <option>log_file_path</option> in the runtime
70847 configuration. This latter string is expanded, so it can contain, for example,
70848 references to the host name:
70849 </para>
70850 <literallayout class="monospaced">
70851 log_file_path = /var/log/$primary_hostname/exim_%slog
70852 </literallayout>
70853 <para>
70854 It is generally advisable, however, to set the string in <filename>Local/Makefile</filename>
70855 rather than at runtime, because then the setting is available right from the
70856 start of Exim&#x2019;s execution. Otherwise, if there&#x2019;s something it wants to log
70857 before it has read the configuration file (for example, an error in the
70858 configuration file) it will not use the path you want, and may not be able to
70859 log at all.
70860 </para>
70861 <para>
70862 The value of LOG_FILE_PATH or <option>log_file_path</option> is a colon-separated
70863 list, currently limited to at most two items. This is one option where the
70864 facility for changing a list separator may not be used. The list must always be
70865 colon-separated. If an item in the list is <quote>syslog</quote> then syslog is used;
70866 otherwise the item must either be an absolute path, containing <literal>%s</literal> at the
70867 point where <quote>main</quote>, <quote>reject</quote>, or <quote>panic</quote> is to be inserted, or be empty,
70868 implying the use of a default path.
70869 </para>
70870 <para>
70871 When Exim encounters an empty item in the list, it searches the list defined by
70872 LOG_FILE_PATH, and uses the first item it finds that is neither empty nor
70873 <quote>syslog</quote>. This means that an empty item in <option>log_file_path</option> can be used to
70874 mean <quote>use the path specified at build time</quote>. If no such item exists, log
70875 files are written in the <filename>log</filename> subdirectory of the spool directory. This is
70876 equivalent to the configuration file setting:
70877 </para>
70878 <literallayout class="monospaced">
70879 log_file_path = $spool_directory/log/%slog
70880 </literallayout>
70881 <para>
70882 If you do not specify anything at build time or runtime,
70883 or if you unset the option at runtime (i.e. <literal>log_file_path = </literal>),
70884 that is where the logs are written.
70885 </para>
70886 <para>
70887 A log file path may also contain <literal>%D</literal> or <literal>%M</literal> if datestamped log filenames
70888 are in use &ndash; see section <xref linkend="SECTdatlogfil"/> below.
70889 </para>
70890 <para>
70891 Here are some examples of possible Makefile settings:
70892 </para>
70893 <literallayout>
70894 <literal>LOG_FILE_PATH=syslog                    </literal> syslog only
70895 <literal>LOG_FILE_PATH=:syslog                   </literal> syslog and default path
70896 <literal>LOG_FILE_PATH=syslog : /usr/log/exim_%s </literal> syslog and specified path
70897 <literal>LOG_FILE_PATH=/usr/log/exim_%s          </literal> specified path only
70898 </literallayout>
70899 <para>
70900 If there are more than two paths in the list, the first is used and a panic
70901 error is logged.
70902 </para>
70903 </section>
70904 <section id="SECID285">
70905 <title>Logging to local files that are periodically <quote>cycled</quote></title>
70906 <para>
70907 <indexterm role="concept">
70908 <primary>log</primary>
70909 <secondary>cycling local files</secondary>
70910 </indexterm>
70911 <indexterm role="concept">
70912 <primary>cycling logs</primary>
70913 </indexterm>
70914 <indexterm role="concept">
70915 <primary><emphasis>exicyclog</emphasis></primary>
70916 </indexterm>
70917 <indexterm role="concept">
70918 <primary>log</primary>
70919 <secondary>local files; writing to</secondary>
70920 </indexterm>
70921 Some operating systems provide centralized and standardized methods for cycling
70922 log files. For those that do not, a utility script called <emphasis>exicyclog</emphasis> is
70923 provided (see section <xref linkend="SECTcyclogfil"/>). This renames and compresses the
70924 main and reject logs each time it is called. The maximum number of old logs to
70925 keep can be set. It is suggested this script is run as a daily <emphasis>cron</emphasis> job.
70926 </para>
70927 <para>
70928 An Exim delivery process opens the main log when it first needs to write to it,
70929 and it keeps the file open in case subsequent entries are required &ndash; for
70930 example, if a number of different deliveries are being done for the same
70931 message. However, remote SMTP deliveries can take a long time, and this means
70932 that the file may be kept open long after it is renamed if <emphasis>exicyclog</emphasis> or
70933 something similar is being used to rename log files on a regular basis. To
70934 ensure that a switch of log files is noticed as soon as possible, Exim calls
70935 <function>stat()</function> on the main log&#x2019;s name before reusing an open file, and if the file
70936 does not exist, or its inode has changed, the old file is closed and Exim
70937 tries to open the main log from scratch. Thus, an old log file may remain open
70938 for quite some time, but no Exim processes should write to it once it has been
70939 renamed.
70940 </para>
70941 </section>
70942 <section id="SECTdatlogfil">
70943 <title>Datestamped log files</title>
70944 <para>
70945 <indexterm role="concept">
70946 <primary>log</primary>
70947 <secondary>datestamped files</secondary>
70948 </indexterm>
70949 Instead of cycling the main and reject log files by renaming them
70950 periodically, some sites like to use files whose names contain a datestamp,
70951 for example, <filename>mainlog-20031225</filename>. The datestamp is in the form <filename>yyyymmdd</filename> or
70952 <filename>yyyymm</filename>. Exim has support for this way of working. It is enabled by setting
70953 the <option>log_file_path</option> option to a path that includes <literal>%D</literal> or <literal>%M</literal> at the
70954 point where the datestamp is required. For example:
70955 </para>
70956 <literallayout class="monospaced">
70957 log_file_path = /var/spool/exim/log/%slog-%D
70958 log_file_path = /var/log/exim-%s-%D.log
70959 log_file_path = /var/spool/exim/log/%D-%slog
70960 log_file_path = /var/log/exim/%s.%M
70961 </literallayout>
70962 <para>
70963 As before, <literal>%s</literal> is replaced by <quote>main</quote> or <quote>reject</quote>; the following are
70964 examples of names generated by the above examples:
70965 </para>
70966 <literallayout class="monospaced">
70967 /var/spool/exim/log/mainlog-20021225
70968 /var/log/exim-reject-20021225.log
70969 /var/spool/exim/log/20021225-mainlog
70970 /var/log/exim/main.200212
70971 </literallayout>
70972 <para>
70973 When this form of log file is specified, Exim automatically switches to new
70974 files at midnight. It does not make any attempt to compress old logs; you
70975 will need to write your own script if you require this. You should not
70976 run <emphasis>exicyclog</emphasis> with this form of logging.
70977 </para>
70978 <para>
70979 The location of the panic log is also determined by <option>log_file_path</option>, but it
70980 is not datestamped, because rotation of the panic log does not make sense.
70981 When generating the name of the panic log, <literal>%D</literal> or <literal>%M</literal> are removed from
70982 the string. In addition, if it immediately follows a slash, a following
70983 non-alphanumeric character is removed; otherwise a preceding non-alphanumeric
70984 character is removed. Thus, the four examples above would give these panic
70985 log names:
70986 </para>
70987 <literallayout class="monospaced">
70988 /var/spool/exim/log/paniclog
70989 /var/log/exim-panic.log
70990 /var/spool/exim/log/paniclog
70991 /var/log/exim/panic
70992 </literallayout>
70993 </section>
70994 <section id="SECID249">
70995 <title>Logging to syslog</title>
70996 <para>
70997 <indexterm role="concept">
70998 <primary>log</primary>
70999 <secondary>syslog; writing to</secondary>
71000 </indexterm>
71001 The use of syslog does not change what Exim logs or the format of its messages,
71002 except in one respect. If <option>syslog_timestamp</option> is set false, the timestamps on
71003 Exim&#x2019;s log lines are omitted when these lines are sent to syslog. Apart from
71004 that, the same strings are written to syslog as to log files. The syslog
71005 <quote>facility</quote> is set to LOG_MAIL, and the program name to <quote>exim</quote>
71006 by default, but you can change these by setting the <option>syslog_facility</option> and
71007 <option>syslog_processname</option> options, respectively. If Exim was compiled with
71008 SYSLOG_LOG_PID set in <filename>Local/Makefile</filename> (this is the default in
71009 <filename>src/EDITME</filename>), then, on systems that permit it (all except ULTRIX), the
71010 LOG_PID flag is set so that the <function>syslog()</function> call adds the pid as well as
71011 the time and host name to each line.
71012 The three log streams are mapped onto syslog priorities as follows:
71013 </para>
71014 <itemizedlist>
71015 <listitem>
71016 <para>
71017 <emphasis>mainlog</emphasis> is mapped to LOG_INFO
71018 </para>
71019 </listitem>
71020 <listitem>
71021 <para>
71022 <emphasis>rejectlog</emphasis> is mapped to LOG_NOTICE
71023 </para>
71024 </listitem>
71025 <listitem>
71026 <para>
71027 <emphasis>paniclog</emphasis> is mapped to LOG_ALERT
71028 </para>
71029 </listitem>
71030 </itemizedlist>
71031 <para>
71032 Many log lines are written to both <emphasis>mainlog</emphasis> and <emphasis>rejectlog</emphasis>, and some are
71033 written to both <emphasis>mainlog</emphasis> and <emphasis>paniclog</emphasis>, so there will be duplicates if
71034 these are routed by syslog to the same place. You can suppress this duplication
71035 by setting <option>syslog_duplication</option> false.
71036 </para>
71037 <para>
71038 Exim&#x2019;s log lines can sometimes be very long, and some of its <emphasis>rejectlog</emphasis>
71039 entries contain multiple lines when headers are included. To cope with both
71040 these cases, entries written to syslog are split into separate <function>syslog()</function>
71041 calls at each internal newline, and also after a maximum of
71042 870 data characters. (This allows for a total syslog line length of 1024, when
71043 additions such as timestamps are added.) If you are running a syslog
71044 replacement that can handle lines longer than the 1024 characters allowed by
71045 RFC 3164, you should set
71046 </para>
71047 <literallayout class="monospaced">
71048 SYSLOG_LONG_LINES=yes
71049 </literallayout>
71050 <para>
71051 in <filename>Local/Makefile</filename> before building Exim. That stops Exim from splitting long
71052 lines, but it still splits at internal newlines in <emphasis>reject</emphasis> log entries.
71053 </para>
71054 <para>
71055 To make it easy to re-assemble split lines later, each component of a split
71056 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;]
71057 where &lt;<emphasis>n</emphasis>&gt; is the component number and &lt;<emphasis>m</emphasis>&gt; is the total number of
71058 components in the entry. The / delimiter is used when the line was split
71059 because it was too long; if it was split because of an internal newline, the \
71060 delimiter is used. For example, supposing the length limit to be 50 instead of
71061 870, the following would be the result of a typical rejection message to
71062 <emphasis>mainlog</emphasis> (LOG_INFO), each line in addition being preceded by the time, host
71063 name, and pid as added by syslog:
71064 </para>
71065 <literallayout class="monospaced">
71066 [1/5] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected from
71067 [2/5]  [127.0.0.1] (ph10): syntax error in 'From' header
71068 [3/5]  when scanning for sender: missing or malformed lo
71069 [4/5] cal part in "&lt;&gt;" (envelope sender is &lt;ph10@cam.exa
71070 [5/5] mple&gt;)
71071 </literallayout>
71072 <para>
71073 The same error might cause the following lines to be written to <quote>rejectlog</quote>
71074 (LOG_NOTICE):
71075 </para>
71076 <literallayout class="monospaced">
71077 [1/18] 2002-09-16 16:09:43 16RdAL-0006pc-00 rejected fro
71078 [2/18] m [127.0.0.1] (ph10): syntax error in 'From' head
71079 [3/18] er when scanning for sender: missing or malformed
71080 [4/18]  local part in "&lt;&gt;" (envelope sender is &lt;ph10@cam
71081 [5\18] .example&gt;)
71082 [6\18] Recipients: ph10@some.domain.cam.example
71083 [7\18] P Received: from [127.0.0.1] (ident=ph10)
71084 [8\18]        by xxxxx.cam.example with smtp (Exim 4.00)
71085 [9\18]        id 16RdAL-0006pc-00
71086 [10/18]        for ph10@cam.example; Mon, 16 Sep 2002 16:
71087 [11\18] 09:43 +0100
71088 [12\18] F From: &lt;&gt;
71089 [13\18]   Subject: this is a test header
71090 [18\18]   X-something: this is another header
71091 [15/18] I Message-Id: &lt;E16RdAL-0006pc-00@xxxxx.cam.examp
71092 [16\18] le&gt;
71093 [17\18] B Bcc:
71094 [18/18]   Date: Mon, 16 Sep 2002 16:09:43 +0100
71095 </literallayout>
71096 <para>
71097 Log lines that are neither too long nor contain newlines are written to syslog
71098 without modification.
71099 </para>
71100 <para>
71101 If only syslog is being used, the Exim monitor is unable to provide a log tail
71102 display, unless syslog is routing <emphasis>mainlog</emphasis> to a file on the local host and
71103 the environment variable EXIMON_LOG_FILE_PATH is set to tell the monitor
71104 where it is.
71105 </para>
71106 </section>
71107 <section id="SECID250">
71108 <title>Log line flags</title>
71109 <para>
71110 One line is written to the main log for each message received, and for each
71111 successful, unsuccessful, and delayed delivery. These lines can readily be
71112 picked out by the distinctive two-character flags that immediately follow the
71113 timestamp. The flags are:
71114 </para>
71115 <informaltable frame="none">
71116 <tgroup cols="2" colsep="0" rowsep="0">
71117 <colspec colwidth="1pt" align="left"/>
71118 <colspec colwidth="1pt" align="left"/>
71119 <tbody>
71120 <row>
71121 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>&lt;=</option></entry>
71122 <entry>message arrival</entry>
71123 </row>
71124 <row>
71125 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>(=</option></entry>
71126 <entry>message fakereject</entry>
71127 </row>
71128 <row>
71129 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>=&gt;</option></entry>
71130 <entry>normal message delivery</entry>
71131 </row>
71132 <row>
71133 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>-&gt;</option></entry>
71134 <entry>additional address in same delivery</entry>
71135 </row>
71136 <row>
71137 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>&gt;&gt;</option></entry>
71138 <entry>cutthrough message delivery</entry>
71139 </row>
71140 <row>
71141 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>*&gt;</option></entry>
71142 <entry>delivery suppressed by <option>-N</option></entry>
71143 </row>
71144 <row>
71145 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>**</option></entry>
71146 <entry>delivery failed; address bounced</entry>
71147 </row>
71148 <row>
71149 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<option>==</option></entry>
71150 <entry>delivery deferred; temporary problem</entry>
71151 </row>
71152 </tbody>
71153 </tgroup>
71154 </informaltable>
71155 </section>
71156 <section id="SECID251">
71157 <title>Logging message reception</title>
71158 <para>
71159 <indexterm role="concept">
71160 <primary>log</primary>
71161 <secondary>reception line</secondary>
71162 </indexterm>
71163 The format of the single-line entry in the main log that is written for every
71164 message received is shown in the basic example below, which is split over
71165 several lines in order to fit it on the page:
71166 </para>
71167 <literallayout class="monospaced">
71168 2002-10-31 08:57:53 16ZCW1-0005MB-00 &lt;= kryten@dwarf.fict.example
71169   H=mailer.fict.example [192.168.123.123] U=exim
71170   P=smtp S=5678 id=&lt;incoming message id&gt;
71171 </literallayout>
71172 <para>
71173 The address immediately following <quote>&lt;=</quote> is the envelope sender address. A
71174 bounce message is shown with the sender address <quote>&lt;&gt;</quote>, and if it is locally
71175 generated, this is followed by an item of the form
71176 </para>
71177 <literallayout class="monospaced">
71178 R=&lt;message id&gt;
71179 </literallayout>
71180 <para>
71181 which is a reference to the message that caused the bounce to be sent.
71182 </para>
71183 <para>
71184 <indexterm role="concept">
71185 <primary>HELO</primary>
71186 </indexterm>
71187 <indexterm role="concept">
71188 <primary>EHLO</primary>
71189 </indexterm>
71190 For messages from other hosts, the H and U fields identify the remote host and
71191 record the RFC 1413 identity of the user that sent the message, if one was
71192 received. The number given in square brackets is the IP address of the sending
71193 host. If there is a single, unparenthesized  host name in the H field, as
71194 above, it has been verified to correspond to the IP address (see the
71195 <option>host_lookup</option> option). If the name is in parentheses, it was the name quoted
71196 by the remote host in the SMTP HELO or EHLO command, and has not been
71197 verified. If verification yields a different name to that given for HELO or
71198 EHLO, the verified name appears first, followed by the HELO or EHLO
71199 name in parentheses.
71200 </para>
71201 <para>
71202 Misconfigured hosts (and mail forgers) sometimes put an IP address, with or
71203 without brackets, in the HELO or EHLO command, leading to entries in
71204 the log containing text like these examples:
71205 </para>
71206 <literallayout class="monospaced">
71207 H=(10.21.32.43) [192.168.8.34]
71208 H=([10.21.32.43]) [192.168.8.34]
71209 </literallayout>
71210 <para>
71211 This can be confusing. Only the final address in square brackets can be relied
71212 on.
71213 </para>
71214 <para>
71215 For locally generated messages (that is, messages not received over TCP/IP),
71216 the H field is omitted, and the U field contains the login name of the caller
71217 of Exim.
71218 </para>
71219 <para>
71220 <indexterm role="concept">
71221 <primary>authentication</primary>
71222 <secondary>logging</secondary>
71223 </indexterm>
71224 <indexterm role="concept">
71225 <primary>AUTH</primary>
71226 <secondary>logging</secondary>
71227 </indexterm>
71228 For all messages, the P field specifies the protocol used to receive the
71229 message. This is the value that is stored in <varname>$received_protocol</varname>. In the case
71230 of incoming SMTP messages, the value indicates whether or not any SMTP
71231 extensions (ESMTP), encryption, or authentication were used. If the SMTP
71232 session was encrypted, there is an additional X field that records the cipher
71233 suite that was used.
71234 </para>
71235 <para>
71236 <indexterm role="concept">
71237 <primary>log</primary>
71238 <secondary>protocol</secondary>
71239 </indexterm>
71240 The protocol is set to <quote>esmtpsa</quote> or <quote>esmtpa</quote> for messages received from
71241 hosts that have authenticated themselves using the SMTP AUTH command. The first
71242 value is used when the SMTP connection was encrypted (<quote>secure</quote>). In this case
71243 there is an additional item A= followed by the name of the authenticator that
71244 was used. If an authenticated identification was set up by the authenticator&#x2019;s
71245 <option>server_set_id</option> option, this is logged too, separated by a colon from the
71246 authenticator name.
71247 </para>
71248 <para>
71249 <indexterm role="concept">
71250 <primary>size</primary>
71251 <secondary>of message</secondary>
71252 </indexterm>
71253 The id field records the existing message id, if present. The size of the
71254 received message is given by the S field. When the message is delivered,
71255 headers may be removed or added, so that the size of delivered copies of the
71256 message may not correspond with this value (and indeed may be different to each
71257 other).
71258 </para>
71259 <para>
71260 The <option>log_selector</option> option can be used to request the logging of additional
71261 data when a message is received. See section <xref linkend="SECTlogselector"/> below.
71262 </para>
71263 </section>
71264 <section id="SECID252">
71265 <title>Logging deliveries</title>
71266 <para>
71267 <indexterm role="concept">
71268 <primary>log</primary>
71269 <secondary>delivery line</secondary>
71270 </indexterm>
71271 The format of the single-line entry in the main log that is written for every
71272 delivery is shown in one of the examples below, for local and remote
71273 deliveries, respectively. Each example has been split into multiple lines in order
71274 to fit it on the page:
71275 </para>
71276 <literallayout class="monospaced">
71277 2002-10-31 08:59:13 16ZCW1-0005MB-00 =&gt; marv
71278   &lt;marv@hitch.fict.example&gt; R=localuser T=local_delivery
71279 2002-10-31 09:00:10 16ZCW1-0005MB-00 =&gt;
71280   monk@holistic.fict.example R=dnslookup T=remote_smtp
71281   H=holistic.fict.example [192.168.234.234]
71282 </literallayout>
71283 <para>
71284 For ordinary local deliveries, the original address is given in angle brackets
71285 after the final delivery address, which might be a pipe or a file. If
71286 intermediate address(es) exist between the original and the final address, the
71287 last of these is given in parentheses after the final address. The R and T
71288 fields record the router and transport that were used to process the address.
71289 </para>
71290 <para>
71291 If SMTP AUTH was used for the delivery there is an additional item A=
71292 followed by the name of the authenticator that was used.
71293 If an authenticated identification was set up by the authenticator&#x2019;s <option>client_set_id</option>
71294 option, this is logged too, as a second colon-separated list item.
71295 Optionally (see the <option>smtp_mailauth</option> <option>log_selector</option>) there may be a third list item.
71296 </para>
71297 <para>
71298 If a shadow transport was run after a successful local delivery, the log line
71299 for the successful delivery has an item added on the end, of the form
71300 </para>
71301 <literallayout>
71302 <literal>ST=&lt;</literal><emphasis>shadow transport name</emphasis><literal>&gt;</literal>
71303 </literallayout>
71304 <para>
71305 If the shadow transport did not succeed, the error message is put in
71306 parentheses afterwards.
71307 </para>
71308 <para>
71309 <indexterm role="concept">
71310 <primary>asterisk</primary>
71311 <secondary>after IP address</secondary>
71312 </indexterm>
71313 When more than one address is included in a single delivery (for example, two
71314 SMTP RCPT commands in one transaction) the second and subsequent addresses are
71315 flagged with <literal>-&gt;</literal> instead of <literal>=&gt;</literal>. When two or more messages are delivered
71316 down a single SMTP connection, an asterisk follows the
71317 remote IP address (and port if enabled)
71318 in the log lines for the second and subsequent messages.
71319 When two or more messages are delivered down a single TLS connection, the
71320 DNS and some TLS-related information logged for the first message delivered
71321 will not be present in the log lines for the second and subsequent messages.
71322 TLS cipher information is still available.
71323 </para>
71324 <para>
71325 <indexterm role="concept">
71326 <primary>delivery</primary>
71327 <secondary>cutthrough; logging</secondary>
71328 </indexterm>
71329 <indexterm role="concept">
71330 <primary>cutthrough</primary>
71331 <secondary>logging</secondary>
71332 </indexterm>
71333 When delivery is done in cutthrough mode it is flagged with <literal>&gt;&gt;</literal> and the log
71334 line precedes the reception line, since cutthrough waits for a possible
71335 rejection from the destination in case it can reject the sourced item.
71336 </para>
71337 <para>
71338 The generation of a reply message by a filter file gets logged as a
71339 <quote>delivery</quote> to the addressee, preceded by <quote>&gt;</quote>.
71340 </para>
71341 <para>
71342 The <option>log_selector</option> option can be used to request the logging of additional
71343 data when a message is delivered. See section <xref linkend="SECTlogselector"/> below.
71344 </para>
71345 </section>
71346 <section id="SECID253">
71347 <title>Discarded deliveries</title>
71348 <para>
71349 <indexterm role="concept">
71350 <primary>discarded messages</primary>
71351 </indexterm>
71352 <indexterm role="concept">
71353 <primary>message</primary>
71354 <secondary>discarded</secondary>
71355 </indexterm>
71356 <indexterm role="concept">
71357 <primary>delivery</primary>
71358 <secondary>discarded; logging</secondary>
71359 </indexterm>
71360 When a message is discarded as a result of the command <quote>seen finish</quote> being
71361 obeyed in a filter file which generates no deliveries, a log entry of the form
71362 </para>
71363 <literallayout class="monospaced">
71364 2002-12-10 00:50:49 16auJc-0001UB-00 =&gt; discarded
71365   &lt;low.club@bridge.example&gt; R=userforward
71366 </literallayout>
71367 <para>
71368 is written, to record why no deliveries are logged. When a message is discarded
71369 because it is aliased to <quote>:blackhole:</quote> the log line is like this:
71370 </para>
71371 <literallayout class="monospaced">
71372 1999-03-02 09:44:33 10HmaX-0005vi-00 =&gt; :blackhole:
71373   &lt;hole@nowhere.example&gt; R=blackhole_router
71374 </literallayout>
71375 </section>
71376 <section id="SECID254">
71377 <title>Deferred deliveries</title>
71378 <para>
71379 When a delivery is deferred, a line of the following form is logged:
71380 </para>
71381 <literallayout class="monospaced">
71382 2002-12-19 16:20:23 16aiQz-0002Q5-00 == marvin@endrest.example
71383   R=dnslookup T=smtp defer (146): Connection refused
71384 </literallayout>
71385 <para>
71386 In the case of remote deliveries, the error is the one that was given for the
71387 last IP address that was tried. Details of individual SMTP failures are also
71388 written to the log, so the above line would be preceded by something like
71389 </para>
71390 <literallayout class="monospaced">
71391 2002-12-19 16:20:23 16aiQz-0002Q5-00 Failed to connect to
71392   mail1.endrest.example [192.168.239.239]: Connection refused
71393 </literallayout>
71394 <para>
71395 When a deferred address is skipped because its retry time has not been reached,
71396 a message is written to the log, but this can be suppressed by setting an
71397 appropriate value in <option>log_selector</option>.
71398 </para>
71399 </section>
71400 <section id="SECID255">
71401 <title>Delivery failures</title>
71402 <para>
71403 <indexterm role="concept">
71404 <primary>delivery</primary>
71405 <secondary>failure; logging</secondary>
71406 </indexterm>
71407 If a delivery fails because an address cannot be routed, a line of the
71408 following form is logged:
71409 </para>
71410 <literallayout class="monospaced">
71411 1995-12-19 16:20:23 0tRiQz-0002Q5-00 ** jim@trek99.example
71412   &lt;jim@trek99.example&gt;: unknown mail domain
71413 </literallayout>
71414 <para>
71415 If a delivery fails at transport time, the router and transport are shown, and
71416 the response from the remote host is included, as in this example:
71417 </para>
71418 <literallayout class="monospaced">
71419 2002-07-11 07:14:17 17SXDU-000189-00 ** ace400@pb.example
71420   R=dnslookup T=remote_smtp: SMTP error from remote mailer
71421   after pipelined RCPT TO:&lt;ace400@pb.example&gt;: host
71422   pbmail3.py.example [192.168.63.111]: 553 5.3.0
71423   &lt;ace400@pb.example&gt;...Addressee unknown
71424 </literallayout>
71425 <para>
71426 The word <quote>pipelined</quote> indicates that the SMTP PIPELINING extension was being
71427 used. See <option>hosts_avoid_esmtp</option> in the <command>smtp</command> transport for a way of
71428 disabling PIPELINING. The log lines for all forms of delivery failure are
71429 flagged with <literal>**</literal>.
71430 </para>
71431 </section>
71432 <section id="SECID256">
71433 <title>Fake deliveries</title>
71434 <para>
71435 <indexterm role="concept">
71436 <primary>delivery</primary>
71437 <secondary>fake; logging</secondary>
71438 </indexterm>
71439 If a delivery does not actually take place because the <option>-N</option> option has been
71440 used to suppress it, a normal delivery line is written to the log, except that
71441 <quote>=&gt;</quote> is replaced by <quote>*&gt;</quote>.
71442 </para>
71443 </section>
71444 <section id="SECID257">
71445 <title>Completion</title>
71446 <para>
71447 A line of the form
71448 </para>
71449 <literallayout class="monospaced">
71450 2002-10-31 09:00:11 16ZCW1-0005MB-00 Completed
71451 </literallayout>
71452 <para>
71453 is written to the main log when a message is about to be removed from the spool
71454 at the end of its processing.
71455 </para>
71456 </section>
71457 <section id="SECID258">
71458 <title>Summary of Fields in Log Lines</title>
71459 <para>
71460 <indexterm role="concept">
71461 <primary>log</primary>
71462 <secondary>summary of fields</secondary>
71463 </indexterm>
71464 A summary of the field identifiers that are used in log lines is shown in
71465 the following table:
71466 </para>
71467 <literallayout>
71468 <literal>A   </literal>        authenticator name (and optional id and sender)
71469 <literal>C   </literal>        SMTP confirmation on delivery
71470 <literal>    </literal>        command list for <quote>no mail in SMTP session</quote>
71471 <literal>CV  </literal>        certificate verification status
71472 <literal>D   </literal>        duration of <quote>no mail in SMTP session</quote>
71473 <literal>DKIM</literal>        domain verified in incoming message
71474 <literal>DN  </literal>        distinguished name from peer certificate
71475 <literal>DS  </literal>        DNSSEC secured lookups
71476 <literal>DT  </literal>        on <literal>=&gt;</literal>, <emphasis>==</emphasis> and <emphasis>**</emphasis> lines: time taken for, or to attempt, a delivery
71477 <literal>F   </literal>        sender address (on delivery lines)
71478 <literal>H   </literal>        host name and IP address
71479 <literal>I   </literal>        local interface used
71480 <literal>id  </literal>        message id (from header) for incoming message
71481 <literal>K   </literal>        CHUNKING extension used
71482 <literal>L   </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: PIPELINING extension used
71483 <literal>M8S </literal>        8BITMIME status for incoming message
71484 <literal>P   </literal>        on <literal>&lt;=</literal> lines: protocol used
71485 <literal>    </literal>        on <literal>=&gt;</literal> and <literal>**</literal> lines: return path
71486 <literal>PRDR</literal>        PRDR extension used
71487 <literal>PRX </literal>        on <literal>&lt;=</literal> and <literal>=&gt;</literal> lines: proxy address
71488 <literal>Q   </literal>        alternate queue name
71489 <literal>QT  </literal>        on <literal>=&gt;</literal> lines: time spent on queue so far
71490 <literal>    </literal>        on <quote>Completed</quote> lines: time spent on queue
71491 <literal>R   </literal>        on <literal>&lt;=</literal> lines: reference for local bounce
71492 <literal>    </literal>        on <literal>=&gt;</literal>  <literal>&gt;&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: router name
71493 <literal>RT  </literal>        on <literal>&lt;=</literal> lines: time taken for reception
71494 <literal>S   </literal>        size of message in bytes
71495 <literal>SNI </literal>        server name indication from TLS client hello
71496 <literal>ST  </literal>        shadow transport name
71497 <literal>T   </literal>        on <literal>&lt;=</literal> lines: message subject (topic)
71498 <literal>TFO </literal>        connection took advantage of TCP Fast Open
71499 <literal>    </literal>        on <literal>=&gt;</literal> <literal>**</literal> and <literal>==</literal> lines: transport name
71500 <literal>U   </literal>        local user or RFC 1413 identity
71501 <literal>X   </literal>        TLS cipher suite
71502 </literallayout>
71503 </section>
71504 <section id="SECID259">
71505 <title>Other log entries</title>
71506 <para>
71507 Various other types of log entry are written from time to time. Most should be
71508 self-explanatory. Among the more common are:
71509 </para>
71510 <itemizedlist>
71511 <listitem>
71512 <para>
71513 <indexterm role="concept">
71514 <primary>retry</primary>
71515 <secondary>time not reached</secondary>
71516 </indexterm>
71517 <emphasis>retry time not reached</emphasis>&nbsp;&nbsp;An address previously suffered a temporary error
71518 during routing or local delivery, and the time to retry has not yet arrived.
71519 This message is not written to an individual message log file unless it happens
71520 during the first delivery attempt.
71521 </para>
71522 </listitem>
71523 <listitem>
71524 <para>
71525 <emphasis>retry time not reached for any host</emphasis>&nbsp;&nbsp;An address previously suffered
71526 temporary errors during remote delivery, and the retry time has not yet arrived
71527 for any of the hosts to which it is routed.
71528 </para>
71529 </listitem>
71530 <listitem>
71531 <para>
71532 <indexterm role="concept">
71533 <primary>spool directory</primary>
71534 <secondary>file locked</secondary>
71535 </indexterm>
71536 <emphasis>spool file locked</emphasis>&nbsp;&nbsp;An attempt to deliver a message cannot proceed because
71537 some other Exim process is already working on the message. This can be quite
71538 common if queue running processes are started at frequent intervals. The
71539 <emphasis>exiwhat</emphasis> utility script can be used to find out what Exim processes are
71540 doing.
71541 </para>
71542 </listitem>
71543 <listitem>
71544 <para>
71545 <indexterm role="concept">
71546 <primary>error</primary>
71547 <secondary>ignored</secondary>
71548 </indexterm>
71549 <emphasis>error ignored</emphasis>&nbsp;&nbsp;There are several circumstances that give rise to this
71550 message:
71551 </para>
71552 <orderedlist numeration="arabic">
71553 <listitem>
71554 <para>
71555 Exim failed to deliver a bounce message whose age was greater than
71556 <option>ignore_bounce_errors_after</option>. The bounce was discarded.
71557 </para>
71558 </listitem>
71559 <listitem>
71560 <para>
71561 A filter file set up a delivery using the <quote>noerror</quote> option, and the delivery
71562 failed. The delivery was discarded.
71563 </para>
71564 </listitem>
71565 <listitem>
71566 <para>
71567 A delivery set up by a router configured with
71568 </para>
71569 <literallayout class="monospaced">
71570     errors_to = &lt;&gt;
71571 </literallayout>
71572 <para>
71573 failed. The delivery was discarded.
71574 </para>
71575 </listitem>
71576 </orderedlist>
71577 </listitem>
71578 <listitem>
71579 <para>
71580 <indexterm role="concept">
71581 <primary>DKIM</primary>
71582 <secondary>log line</secondary>
71583 </indexterm>
71584 <emphasis>DKIM: d=</emphasis>&nbsp;&nbsp;Verbose results of a DKIM verification attempt, if enabled for
71585 logging and the message has a DKIM signature header.
71586 </para>
71587 </listitem>
71588 </itemizedlist>
71589 </section>
71590 <section id="SECTlogselector">
71591 <title>Reducing or increasing what is logged</title>
71592 <para>
71593 <indexterm role="concept">
71594 <primary>log</primary>
71595 <secondary>selectors</secondary>
71596 </indexterm>
71597 By setting the <option>log_selector</option> global option, you can disable some of Exim&#x2019;s
71598 default logging, or you can request additional logging. The value of
71599 <option>log_selector</option> is made up of names preceded by plus or minus characters. For
71600 example:
71601 </para>
71602 <literallayout class="monospaced">
71603 log_selector = +arguments -retry_defer
71604 </literallayout>
71605 <para>
71606 The list of optional log items is in the following table, with the default
71607 selection marked by asterisks:
71608 </para>
71609 <informaltable frame="none">
71610 <tgroup cols="3" colsep="0" rowsep="0">
71611 <colspec colwidth="1pt" align="left"/>
71612 <colspec colwidth="10pt" align="center"/>
71613 <colspec colwidth="1pt" align="left"/>
71614 <tbody>
71615 <row>
71616 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>8bitmime</literal></entry>
71617 <entry>&nbsp;</entry>
71618 <entry>received 8BITMIME status</entry>
71619 </row>
71620 <row>
71621 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>acl_warn_skipped</literal></entry>
71622 <entry>*</entry>
71623 <entry>skipped <option>warn</option> statement in ACL</entry>
71624 </row>
71625 <row>
71626 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>address_rewrite</literal></entry>
71627 <entry>&nbsp;</entry>
71628 <entry>address rewriting</entry>
71629 </row>
71630 <row>
71631 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>all_parents</literal></entry>
71632 <entry>&nbsp;</entry>
71633 <entry>all parents in =&gt; lines</entry>
71634 </row>
71635 <row>
71636 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>arguments</literal></entry>
71637 <entry>&nbsp;</entry>
71638 <entry>command line arguments</entry>
71639 </row>
71640 <row>
71641 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>connection_reject</literal></entry>
71642 <entry>*</entry>
71643 <entry>connection rejections</entry>
71644 </row>
71645 <row>
71646 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>delay_delivery</literal></entry>
71647 <entry>*</entry>
71648 <entry>immediate delivery delayed</entry>
71649 </row>
71650 <row>
71651 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>deliver_time</literal></entry>
71652 <entry>&nbsp;</entry>
71653 <entry>time taken to attempt delivery</entry>
71654 </row>
71655 <row>
71656 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>delivery_size</literal></entry>
71657 <entry>&nbsp;</entry>
71658 <entry>add <literal>S=</literal><emphasis>nnn</emphasis> to =&gt; lines</entry>
71659 </row>
71660 <row>
71661 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>dkim</literal></entry>
71662 <entry>*</entry>
71663 <entry>DKIM verified domain on &lt;= lines</entry>
71664 </row>
71665 <row>
71666 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>dkim_verbose</literal></entry>
71667 <entry>&nbsp;</entry>
71668 <entry>separate full DKIM verification result line, per signature</entry>
71669 </row>
71670 <row>
71671 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>dnslist_defer</literal></entry>
71672 <entry>*</entry>
71673 <entry>defers of DNS list (aka RBL) lookups</entry>
71674 </row>
71675 <row>
71676 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>dnssec</literal></entry>
71677 <entry>&nbsp;</entry>
71678 <entry>DNSSEC secured lookups</entry>
71679 </row>
71680 <row>
71681 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>etrn</literal></entry>
71682 <entry>*</entry>
71683 <entry>ETRN commands</entry>
71684 </row>
71685 <row>
71686 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>host_lookup_failed</literal></entry>
71687 <entry>*</entry>
71688 <entry>as it says</entry>
71689 </row>
71690 <row>
71691 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>ident_timeout</literal></entry>
71692 <entry>&nbsp;</entry>
71693 <entry>timeout for ident connection</entry>
71694 </row>
71695 <row>
71696 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>incoming_interface</literal></entry>
71697 <entry>&nbsp;</entry>
71698 <entry>local interface on &lt;= and =&gt; lines</entry>
71699 </row>
71700 <row>
71701 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>incoming_port</literal></entry>
71702 <entry>&nbsp;</entry>
71703 <entry>remote port on &lt;= lines</entry>
71704 </row>
71705 <row>
71706 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>lost_incoming_connection</literal></entry>
71707 <entry>*</entry>
71708 <entry>as it says (includes timeouts)</entry>
71709 </row>
71710 <row>
71711 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>millisec</literal></entry>
71712 <entry>&nbsp;</entry>
71713 <entry>millisecond timestamps and RT,QT,DT,D times</entry>
71714 </row>
71715 <row>
71716 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>msg_id</literal></entry>
71717 <entry>*</entry>
71718 <entry>on &lt;= lines, Message-ID: header value</entry>
71719 </row>
71720 <row>
71721 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>msg_id_created</literal></entry>
71722 <entry>&nbsp;</entry>
71723 <entry>on &lt;= lines, Message-ID: header value when one had to be added</entry>
71724 </row>
71725 <row>
71726 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>outgoing_interface</literal></entry>
71727 <entry>&nbsp;</entry>
71728 <entry>local interface on =&gt; lines</entry>
71729 </row>
71730 <row>
71731 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>outgoing_port</literal></entry>
71732 <entry>&nbsp;</entry>
71733 <entry>add remote port to =&gt; lines</entry>
71734 </row>
71735 <row>
71736 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>queue_run</literal></entry>
71737 <entry>*</entry>
71738 <entry>start and end queue runs</entry>
71739 </row>
71740 <row>
71741 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>queue_time</literal></entry>
71742 <entry>&nbsp;</entry>
71743 <entry>time on queue for one recipient</entry>
71744 </row>
71745 <row>
71746 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>queue_time_exclusive</literal></entry>
71747 <entry>&nbsp;</entry>
71748 <entry>exclude recieve time from QT times</entry>
71749 </row>
71750 <row>
71751 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>queue_time_overall</literal></entry>
71752 <entry>&nbsp;</entry>
71753 <entry>time on queue for whole message</entry>
71754 </row>
71755 <row>
71756 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>pid</literal></entry>
71757 <entry>&nbsp;</entry>
71758 <entry>Exim process id</entry>
71759 </row>
71760 <row>
71761 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>pipelining</literal></entry>
71762 <entry>&nbsp;</entry>
71763 <entry>PIPELINING use, on &lt;= and =&gt; lines</entry>
71764 </row>
71765 <row>
71766 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>proxy</literal></entry>
71767 <entry>&nbsp;</entry>
71768 <entry>proxy address on &lt;= and =&gt; lines</entry>
71769 </row>
71770 <row>
71771 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>receive_time</literal></entry>
71772 <entry>&nbsp;</entry>
71773 <entry>time taken to receive message</entry>
71774 </row>
71775 <row>
71776 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>received_recipients</literal></entry>
71777 <entry>&nbsp;</entry>
71778 <entry>recipients on &lt;= lines</entry>
71779 </row>
71780 <row>
71781 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>received_sender</literal></entry>
71782 <entry>&nbsp;</entry>
71783 <entry>sender on &lt;= lines</entry>
71784 </row>
71785 <row>
71786 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>rejected_header</literal></entry>
71787 <entry>*</entry>
71788 <entry>header contents on reject log</entry>
71789 </row>
71790 <row>
71791 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>retry_defer</literal></entry>
71792 <entry>*</entry>
71793 <entry><quote>retry time not reached</quote></entry>
71794 </row>
71795 <row>
71796 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>return_path_on_delivery</literal></entry>
71797 <entry>&nbsp;</entry>
71798 <entry>put return path on =&gt; and ** lines</entry>
71799 </row>
71800 <row>
71801 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>sender_on_delivery</literal></entry>
71802 <entry>&nbsp;</entry>
71803 <entry>add sender to =&gt; lines</entry>
71804 </row>
71805 <row>
71806 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>sender_verify_fail</literal></entry>
71807 <entry>*</entry>
71808 <entry>sender verification failures</entry>
71809 </row>
71810 <row>
71811 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>size_reject</literal></entry>
71812 <entry>*</entry>
71813 <entry>rejection because too big</entry>
71814 </row>
71815 <row>
71816 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>skip_delivery</literal></entry>
71817 <entry>*</entry>
71818 <entry>delivery skipped in a queue run</entry>
71819 </row>
71820 <row>
71821 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_confirmation</literal></entry>
71822 <entry>*</entry>
71823 <entry>SMTP confirmation on =&gt; lines</entry>
71824 </row>
71825 <row>
71826 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_connection</literal></entry>
71827 <entry>&nbsp;</entry>
71828 <entry>incoming SMTP connections</entry>
71829 </row>
71830 <row>
71831 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_incomplete_transaction</literal></entry>
71832 <entry>&nbsp;</entry>
71833 <entry>incomplete SMTP transactions</entry>
71834 </row>
71835 <row>
71836 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_mailauth</literal></entry>
71837 <entry>&nbsp;</entry>
71838 <entry>AUTH argument to MAIL commands</entry>
71839 </row>
71840 <row>
71841 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_no_mail</literal></entry>
71842 <entry>&nbsp;</entry>
71843 <entry>session with no MAIL commands</entry>
71844 </row>
71845 <row>
71846 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_protocol_error</literal></entry>
71847 <entry>&nbsp;</entry>
71848 <entry>SMTP protocol errors</entry>
71849 </row>
71850 <row>
71851 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>smtp_syntax_error</literal></entry>
71852 <entry>&nbsp;</entry>
71853 <entry>SMTP syntax errors</entry>
71854 </row>
71855 <row>
71856 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>subject</literal></entry>
71857 <entry>&nbsp;</entry>
71858 <entry>contents of <emphasis>Subject:</emphasis> on &lt;= lines</entry>
71859 </row>
71860 <row>
71861 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls_certificate_verified</literal></entry>
71862 <entry>*</entry>
71863 <entry>certificate verification status</entry>
71864 </row>
71865 <row>
71866 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls_cipher</literal></entry>
71867 <entry>*</entry>
71868 <entry>TLS cipher suite on &lt;= and =&gt; lines</entry>
71869 </row>
71870 <row>
71871 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls_peerdn</literal></entry>
71872 <entry>&nbsp;</entry>
71873 <entry>TLS peer DN on &lt;= and =&gt; lines</entry>
71874 </row>
71875 <row>
71876 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls_resumption</literal></entry>
71877 <entry>&nbsp;</entry>
71878 <entry>append * to cipher field</entry>
71879 </row>
71880 <row>
71881 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>tls_sni</literal></entry>
71882 <entry>&nbsp;</entry>
71883 <entry>TLS SNI on &lt;= lines</entry>
71884 </row>
71885 <row>
71886 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>unknown_in_list</literal></entry>
71887 <entry>&nbsp;</entry>
71888 <entry>DNS lookup failed in list match</entry>
71889 </row>
71890 <row>
71891 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>all</literal></entry>
71892 <entry>&nbsp;</entry>
71893 <entry><emphasis role="bold">all of the above</emphasis></entry>
71894 </row>
71895 </tbody>
71896 </tgroup>
71897 </informaltable>
71898 <para>
71899 See also the <option>slow_lookup_log</option> main configuration option,
71900 section <xref linkend="SECID99"/>
71901 </para>
71902 <para>
71903 More details on each of these items follows:
71904 </para>
71905 <itemizedlist>
71906 <listitem>
71907 <para>
71908 <indexterm role="concept">
71909 <primary>8BITMIME</primary>
71910 </indexterm>
71911 <indexterm role="concept">
71912 <primary>log</primary>
71913 <secondary>8BITMIME</secondary>
71914 </indexterm>
71915 <option>8bitmime</option>: This causes Exim to log any 8BITMIME status of received messages,
71916 which may help in tracking down interoperability issues with ancient MTAs
71917 that are not 8bit clean.  This is added to the <quote>&lt;=</quote> line, tagged with
71918 <literal>M8S=</literal> and a value of <literal>0</literal>, <literal>7</literal> or <literal>8</literal>, corresponding to "not given",
71919 <literal>7BIT</literal> and <literal>8BITMIME</literal> respectively.
71920 </para>
71921 </listitem>
71922 <listitem>
71923 <para>
71924 <indexterm role="concept">
71925 <primary><option>warn</option> ACL verb</primary>
71926 <secondary>log when skipping</secondary>
71927 </indexterm>
71928 <option>acl_warn_skipped</option>: When an ACL <option>warn</option> statement is skipped because one of
71929 its conditions cannot be evaluated, a log line to this effect is written if
71930 this log selector is set.
71931 </para>
71932 </listitem>
71933 <listitem>
71934 <para>
71935 <indexterm role="concept">
71936 <primary>log</primary>
71937 <secondary>rewriting</secondary>
71938 </indexterm>
71939 <indexterm role="concept">
71940 <primary>rewriting</primary>
71941 <secondary>logging</secondary>
71942 </indexterm>
71943 <option>address_rewrite</option>: This applies both to global rewrites and per-transport
71944 rewrites, but not to rewrites in filters run as an unprivileged user (because
71945 such users cannot access the log).
71946 </para>
71947 </listitem>
71948 <listitem>
71949 <para>
71950 <indexterm role="concept">
71951 <primary>log</primary>
71952 <secondary>full parentage</secondary>
71953 </indexterm>
71954 <option>all_parents</option>: Normally only the original and final addresses are logged on
71955 delivery lines; with this selector, intermediate parents are given in
71956 parentheses between them.
71957 </para>
71958 </listitem>
71959 <listitem>
71960 <para>
71961 <indexterm role="concept">
71962 <primary>log</primary>
71963 <secondary>Exim arguments</secondary>
71964 </indexterm>
71965 <indexterm role="concept">
71966 <primary>Exim arguments, logging</primary>
71967 </indexterm>
71968 <option>arguments</option>: This causes Exim to write the arguments with which it was called
71969 to the main log, preceded by the current working directory. This is a debugging
71970 feature, added to make it easier to find out how certain MUAs call
71971 <filename>/usr/sbin/sendmail</filename>. The logging does not happen if Exim has given up root
71972 privilege because it was called with the <option>-C</option> or <option>-D</option> options. Arguments
71973 that are empty or that contain white space are quoted. Non-printing characters
71974 are shown as escape sequences. This facility cannot log unrecognized arguments,
71975 because the arguments are checked before the configuration file is read. The
71976 only way to log such cases is to interpose a script such as <filename>util/logargs.sh</filename>
71977 between the caller and Exim.
71978 </para>
71979 </listitem>
71980 <listitem>
71981 <para>
71982 <indexterm role="concept">
71983 <primary>log</primary>
71984 <secondary>connection rejections</secondary>
71985 </indexterm>
71986 <option>connection_reject</option>: A log entry is written whenever an incoming SMTP
71987 connection is rejected, for whatever reason.
71988 </para>
71989 </listitem>
71990 <listitem>
71991 <para>
71992 <indexterm role="concept">
71993 <primary>log</primary>
71994 <secondary>delayed delivery</secondary>
71995 </indexterm>
71996 <indexterm role="concept">
71997 <primary>delayed delivery, logging</primary>
71998 </indexterm>
71999 <option>delay_delivery</option>: A log entry is written whenever a delivery process is not
72000 started for an incoming message because the load is too high or too many
72001 messages were received on one connection. Logging does not occur if no delivery
72002 process is started because <option>queue_only</option> is set or <option>-odq</option> was used.
72003 </para>
72004 </listitem>
72005 <listitem>
72006 <para>
72007 <indexterm role="concept">
72008 <primary>log</primary>
72009 <secondary>delivery duration</secondary>
72010 </indexterm>
72011 <option>deliver_time</option>: For each delivery, the amount of real time it has taken to
72012 perform the actual delivery is logged as DT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>DT=1s</literal>.
72013 If millisecond logging is enabled, short times will be shown with greater
72014 precision, eg. <literal>DT=0.304s</literal>.
72015 </para>
72016 </listitem>
72017 <listitem>
72018 <para>
72019 <indexterm role="concept">
72020 <primary>log</primary>
72021 <secondary>message size on delivery</secondary>
72022 </indexterm>
72023 <indexterm role="concept">
72024 <primary>size</primary>
72025 <secondary>of message</secondary>
72026 </indexterm>
72027 <option>delivery_size</option>: For each delivery, the size of message delivered is added to
72028 the <quote>=&gt;</quote> line, tagged with S=.
72029 </para>
72030 </listitem>
72031 <listitem>
72032 <para>
72033 <indexterm role="concept">
72034 <primary>log</primary>
72035 <secondary>DKIM verification</secondary>
72036 </indexterm>
72037 <indexterm role="concept">
72038 <primary>DKIM</primary>
72039 <secondary>verification logging</secondary>
72040 </indexterm>
72041 <option>dkim</option>: For message acceptance log lines, when an DKIM signature in the header
72042 verifies successfully a tag of DKIM is added, with one of the verified domains.
72043 </para>
72044 </listitem>
72045 <listitem>
72046 <para>
72047 <indexterm role="concept">
72048 <primary>log</primary>
72049 <secondary>DKIM verification</secondary>
72050 </indexterm>
72051 <indexterm role="concept">
72052 <primary>DKIM</primary>
72053 <secondary>verification logging</secondary>
72054 </indexterm>
72055 <option>dkim_verbose</option>: A log entry is written for each attempted DKIM verification.
72056 </para>
72057 </listitem>
72058 <listitem>
72059 <para>
72060 <indexterm role="concept">
72061 <primary>log</primary>
72062 <secondary>dnslist defer</secondary>
72063 </indexterm>
72064 <indexterm role="concept">
72065 <primary>DNS list</primary>
72066 <secondary>logging defer</secondary>
72067 </indexterm>
72068 <indexterm role="concept">
72069 <primary>black list (DNS)</primary>
72070 </indexterm>
72071 <option>dnslist_defer</option>: A log entry is written if an attempt to look up a host in a
72072 DNS black list suffers a temporary error.
72073 </para>
72074 </listitem>
72075 <listitem>
72076 <para>
72077 <indexterm role="concept">
72078 <primary>log</primary>
72079 <secondary>dnssec</secondary>
72080 </indexterm>
72081 <indexterm role="concept">
72082 <primary>dnssec</primary>
72083 <secondary>logging</secondary>
72084 </indexterm>
72085 <option>dnssec</option>: For message acceptance and (attempted) delivery log lines, when
72086 dns lookups gave secure results a tag of DS is added.
72087 For acceptance this covers the reverse and forward lookups for host name verification.
72088 It does not cover helo-name verification.
72089 For delivery this covers the SRV, MX, A and/or AAAA lookups.
72090 </para>
72091 </listitem>
72092 <listitem>
72093 <para>
72094 <indexterm role="concept">
72095 <primary>log</primary>
72096 <secondary>ETRN commands</secondary>
72097 </indexterm>
72098 <indexterm role="concept">
72099 <primary>ETRN</primary>
72100 <secondary>logging</secondary>
72101 </indexterm>
72102 <option>etrn</option>: Every valid ETRN command that is received is logged, before the ACL
72103 is run to determine whether or not it is actually accepted. An invalid ETRN
72104 command, or one received within a message transaction is not logged by this
72105 selector (see <option>smtp_syntax_error</option> and <option>smtp_protocol_error</option>).
72106 </para>
72107 </listitem>
72108 <listitem>
72109 <para>
72110 <indexterm role="concept">
72111 <primary>log</primary>
72112 <secondary>host lookup failure</secondary>
72113 </indexterm>
72114 <option>host_lookup_failed</option>: When a lookup of a host&#x2019;s IP addresses fails to find
72115 any addresses, or when a lookup of an IP address fails to find a host name, a
72116 log line is written. This logging does not apply to direct DNS lookups when
72117 routing email addresses, but it does apply to <quote>byname</quote> lookups.
72118 </para>
72119 </listitem>
72120 <listitem>
72121 <para>
72122 <indexterm role="concept">
72123 <primary>log</primary>
72124 <secondary>ident timeout</secondary>
72125 </indexterm>
72126 <indexterm role="concept">
72127 <primary>RFC 1413</primary>
72128 <secondary>logging timeout</secondary>
72129 </indexterm>
72130 <option>ident_timeout</option>: A log line is written whenever an attempt to connect to a
72131 client&#x2019;s ident port times out.
72132 </para>
72133 </listitem>
72134 <listitem>
72135 <para>
72136 <indexterm role="concept">
72137 <primary>log</primary>
72138 <secondary>incoming interface</secondary>
72139 </indexterm>
72140 <indexterm role="concept">
72141 <primary>log</primary>
72142 <secondary>outgoing interface</secondary>
72143 </indexterm>
72144 <indexterm role="concept">
72145 <primary>log</primary>
72146 <secondary>local interface</secondary>
72147 </indexterm>
72148 <indexterm role="concept">
72149 <primary>log</primary>
72150 <secondary>local address and port</secondary>
72151 </indexterm>
72152 <indexterm role="concept">
72153 <primary>TCP/IP</primary>
72154 <secondary>logging local address and port</secondary>
72155 </indexterm>
72156 <indexterm role="concept">
72157 <primary>interface</primary>
72158 <secondary>logging</secondary>
72159 </indexterm>
72160 <option>incoming_interface</option>: The interface on which a message was received is added
72161 to the <quote>&lt;=</quote> line as an IP address in square brackets, tagged by I= and
72162 followed by a colon and the port number. The local interface and port are also
72163 added to other SMTP log lines, for example, <quote>SMTP connection from</quote>, to
72164 rejection lines, and (despite the name) to outgoing
72165 <quote>=&gt;</quote>, <quote>-&gt;</quote>, <quote>==</quote> and <quote>**</quote> lines.
72166 The latter can be disabled by turning off the <option>outgoing_interface</option> option.
72167 </para>
72168 </listitem>
72169 <listitem>
72170 <para>
72171 <indexterm role="concept">
72172 <primary>log</primary>
72173 <secondary>incoming proxy address</secondary>
72174 </indexterm>
72175 <indexterm role="concept">
72176 <primary>proxy</primary>
72177 <secondary>logging proxy address</secondary>
72178 </indexterm>
72179 <indexterm role="concept">
72180 <primary>TCP/IP</primary>
72181 <secondary>logging proxy address</secondary>
72182 </indexterm>
72183 <option>proxy</option>: The internal (closest to the system running Exim) IP address
72184 of the proxy, tagged by PRX=, on the <quote>&lt;=</quote> line for a message accepted
72185 on a proxied connection
72186 or the <quote>=&gt;</quote> line for a message delivered on a proxied connection.
72187 See <xref linkend="SECTproxyInbound"/> for more information.
72188 </para>
72189 </listitem>
72190 <listitem>
72191 <para>
72192 <indexterm role="concept">
72193 <primary>log</primary>
72194 <secondary>incoming remote port</secondary>
72195 </indexterm>
72196 <indexterm role="concept">
72197 <primary>port</primary>
72198 <secondary>logging remote</secondary>
72199 </indexterm>
72200 <indexterm role="concept">
72201 <primary>TCP/IP</primary>
72202 <secondary>logging incoming remote port</secondary>
72203 </indexterm>
72204 <indexterm role="variable">
72205 <primary><varname>$sender_fullhost</varname></primary>
72206 </indexterm>
72207 <indexterm role="variable">
72208 <primary><varname>$sender_rcvhost</varname></primary>
72209 </indexterm>
72210 <option>incoming_port</option>: The remote port number from which a message was received is
72211 added to log entries and <emphasis>Received:</emphasis> header lines, following the IP address
72212 in square brackets, and separated from it by a colon. This is implemented by
72213 changing the value that is put in the <varname>$sender_fullhost</varname> and
72214 <varname>$sender_rcvhost</varname> variables. Recording the remote port number has become more
72215 important with the widening use of NAT (see RFC 2505).
72216 </para>
72217 </listitem>
72218 <listitem>
72219 <para>
72220 <indexterm role="concept">
72221 <primary>log</primary>
72222 <secondary>dropped connection</secondary>
72223 </indexterm>
72224 <option>lost_incoming_connection</option>: A log line is written when an incoming SMTP
72225 connection is unexpectedly dropped.
72226 </para>
72227 </listitem>
72228 <listitem>
72229 <para>
72230 <indexterm role="concept">
72231 <primary>log</primary>
72232 <secondary>millisecond timestamps</secondary>
72233 </indexterm>
72234 <indexterm role="concept">
72235 <primary>millisecond</primary>
72236 <secondary>logging</secondary>
72237 </indexterm>
72238 <indexterm role="concept">
72239 <primary>timestamps</primary>
72240 <secondary>millisecond, in logs</secondary>
72241 </indexterm>
72242 <option>millisec</option>: Timestamps have a period and three decimal places of finer granularity
72243 appended to the seconds value.
72244 </para>
72245 </listitem>
72246 <listitem>
72247 <para>
72248 <indexterm role="concept">
72249 <primary>log</primary>
72250 <secondary>message id</secondary>
72251 </indexterm>
72252 <option>msg_id</option>: The value of the Message-ID: header.
72253 </para>
72254 </listitem>
72255 <listitem>
72256 <para>
72257 <option>msg_id_created</option>: The value of the Message-ID: header, when one had to be created.
72258 This will be either because the message is a bounce, or was submitted locally
72259 (submission mode) without one.
72260 The field identifier will have an asterix appended: <quote>id*=</quote>.
72261 </para>
72262 </listitem>
72263 <listitem>
72264 <para>
72265 <indexterm role="concept">
72266 <primary>log</primary>
72267 <secondary>outgoing interface</secondary>
72268 </indexterm>
72269 <indexterm role="concept">
72270 <primary>log</primary>
72271 <secondary>local interface</secondary>
72272 </indexterm>
72273 <indexterm role="concept">
72274 <primary>log</primary>
72275 <secondary>local address and port</secondary>
72276 </indexterm>
72277 <indexterm role="concept">
72278 <primary>TCP/IP</primary>
72279 <secondary>logging local address and port</secondary>
72280 </indexterm>
72281 <indexterm role="concept">
72282 <primary>interface</primary>
72283 <secondary>logging</secondary>
72284 </indexterm>
72285 <option>outgoing_interface</option>: If <option>incoming_interface</option> is turned on, then the
72286 interface on which a message was sent is added to delivery lines as an I= tag
72287 followed by IP address in square brackets. You can disable this by turning
72288 off the <option>outgoing_interface</option> option.
72289 </para>
72290 </listitem>
72291 <listitem>
72292 <para>
72293 <indexterm role="concept">
72294 <primary>log</primary>
72295 <secondary>outgoing remote port</secondary>
72296 </indexterm>
72297 <indexterm role="concept">
72298 <primary>port</primary>
72299 <secondary>logging outgoing remote</secondary>
72300 </indexterm>
72301 <indexterm role="concept">
72302 <primary>TCP/IP</primary>
72303 <secondary>logging outgoing remote port</secondary>
72304 </indexterm>
72305 <option>outgoing_port</option>: The remote port number is added to delivery log lines (those
72306 containing =&gt; tags) following the IP address.
72307 The local port is also added if <option>incoming_interface</option> and
72308 <option>outgoing_interface</option> are both enabled.
72309 This option is not included in the default setting, because for most ordinary
72310 configurations, the remote port number is always 25 (the SMTP port), and the
72311 local port is a random ephemeral port.
72312 </para>
72313 </listitem>
72314 <listitem>
72315 <para>
72316 <indexterm role="concept">
72317 <primary>log</primary>
72318 <secondary>process ids in</secondary>
72319 </indexterm>
72320 <indexterm role="concept">
72321 <primary>pid (process id)</primary>
72322 <secondary>in log lines</secondary>
72323 </indexterm>
72324 <option>pid</option>: The current process id is added to every log line, in square brackets,
72325 immediately after the time and date.
72326 </para>
72327 </listitem>
72328 <listitem>
72329 <para>
72330 <indexterm role="concept">
72331 <primary>log</primary>
72332 <secondary>pipelining</secondary>
72333 </indexterm>
72334 <indexterm role="concept">
72335 <primary>pipelining</primary>
72336 <secondary>logging outgoing</secondary>
72337 </indexterm>
72338 <option>pipelining</option>: A field is added to delivery and accept
72339 log lines when the ESMTP PIPELINING extension was used.
72340 The field is a single "L".
72341 </para>
72342 <para>
72343 On accept lines, where PIPELINING was offered but not used by the client,
72344 the field has a minus appended.
72345 </para>
72346 <para>
72347 <indexterm role="concept">
72348 <primary>pipelining</primary>
72349 <secondary>early connection</secondary>
72350 </indexterm>
72351 If Exim is built without the DISABLE_PIPE_CONNECT build option
72352 accept "L" fields have a period appended if the feature was
72353 offered but not used, or an asterisk appended if used.
72354 Delivery "L" fields have an asterisk appended if used.
72355 </para>
72356 </listitem>
72357 <listitem>
72358 <para>
72359 <indexterm role="concept">
72360 <primary>log</primary>
72361 <secondary>queue run</secondary>
72362 </indexterm>
72363 <indexterm role="concept">
72364 <primary>queue runner</primary>
72365 <secondary>logging</secondary>
72366 </indexterm>
72367 <option>queue_run</option>: The start and end of every queue run are logged.
72368 </para>
72369 </listitem>
72370 <listitem>
72371 <para>
72372 <indexterm role="concept">
72373 <primary>log</primary>
72374 <secondary>queue time</secondary>
72375 </indexterm>
72376 <option>queue_time</option>: The amount of time the message has been in the queue on the
72377 local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on delivery (<literal>=&gt;</literal>) lines, for example,
72378 <literal>QT=3m45s</literal>.
72379 If millisecond logging is enabled, short times will be shown with greater
72380 precision, eg. <literal>QT=1.578s</literal>.
72381 </para>
72382 </listitem>
72383 <listitem>
72384 <para>
72385 <option>queue_time_overall</option>: The amount of time the message has been in the queue on
72386 the local host is logged as QT=&lt;<emphasis>time</emphasis>&gt; on <quote>Completed</quote> lines, for
72387 example, <literal>QT=3m45s</literal>.
72388 </para>
72389 </listitem>
72390 <listitem>
72391 <para>
72392 <indexterm role="concept">
72393 <primary>log</primary>
72394 <secondary>receive duration</secondary>
72395 </indexterm>
72396 <option>receive_time</option>: For each message, the amount of real time it has taken to
72397 perform the reception is logged as RT=&lt;<emphasis>time</emphasis>&gt;, for example, <literal>RT=1s</literal>.
72398 If millisecond logging is enabled, short times will be shown with greater
72399 precision, eg. <literal>RT=0.204s</literal>.
72400 </para>
72401 </listitem>
72402 <listitem>
72403 <para>
72404 <indexterm role="concept">
72405 <primary>log</primary>
72406 <secondary>recipients</secondary>
72407 </indexterm>
72408 <option>received_recipients</option>: The recipients of a message are listed in the main log
72409 as soon as the message is received. The list appears at the end of the log line
72410 that is written when a message is received, preceded by the word <quote>for</quote>. The
72411 addresses are listed after they have been qualified, but before any rewriting
72412 has taken place.
72413 Recipients that were discarded by an ACL for MAIL or RCPT do not appear
72414 in the list.
72415 </para>
72416 </listitem>
72417 <listitem>
72418 <para>
72419 <indexterm role="concept">
72420 <primary>log</primary>
72421 <secondary>sender reception</secondary>
72422 </indexterm>
72423 <option>received_sender</option>: The unrewritten original sender of a message is added to
72424 the end of the log line that records the message&#x2019;s arrival, after the word
72425 <quote>from</quote> (before the recipients if <option>received_recipients</option> is also set).
72426 </para>
72427 </listitem>
72428 <listitem>
72429 <para>
72430 <indexterm role="concept">
72431 <primary>log</primary>
72432 <secondary>header lines for rejection</secondary>
72433 </indexterm>
72434 <option>rejected_header</option>: If a message&#x2019;s header has been received at the time a
72435 rejection is written to the reject log, the complete header is added to the
72436 log. Header logging can be turned off individually for messages that are
72437 rejected by the <function>local_scan()</function> function (see section <xref linkend="SECTapiforloc"/>).
72438 </para>
72439 </listitem>
72440 <listitem>
72441 <para>
72442 <indexterm role="concept">
72443 <primary>log</primary>
72444 <secondary>retry defer</secondary>
72445 </indexterm>
72446 <option>retry_defer</option>: A log line is written if a delivery is deferred because a
72447 retry time has not yet been reached. However, this <quote>retry time not reached</quote>
72448 message is always omitted from individual message logs after the first delivery
72449 attempt.
72450 </para>
72451 </listitem>
72452 <listitem>
72453 <para>
72454 <indexterm role="concept">
72455 <primary>log</primary>
72456 <secondary>return path</secondary>
72457 </indexterm>
72458 <option>return_path_on_delivery</option>: The return path that is being transmitted with
72459 the message is included in delivery and bounce lines, using the tag P=.
72460 This is omitted if no delivery actually happens, for example, if routing fails,
72461 or if delivery is to <filename>/dev/null</filename> or to <literal>:blackhole:</literal>.
72462 </para>
72463 </listitem>
72464 <listitem>
72465 <para>
72466 <indexterm role="concept">
72467 <primary>log</primary>
72468 <secondary>sender on delivery</secondary>
72469 </indexterm>
72470 <option>sender_on_delivery</option>: The message&#x2019;s sender address is added to every delivery
72471 and bounce line, tagged by F= (for <quote>from</quote>).
72472 This is the original sender that was received with the message; it is not
72473 necessarily the same as the outgoing return path.
72474 </para>
72475 </listitem>
72476 <listitem>
72477 <para>
72478 <indexterm role="concept">
72479 <primary>log</primary>
72480 <secondary>sender verify failure</secondary>
72481 </indexterm>
72482 <option>sender_verify_fail</option>: If this selector is unset, the separate log line that
72483 gives details of a sender verification failure is not written. Log lines for
72484 the rejection of SMTP commands contain just <quote>sender verify failed</quote>, so some
72485 detail is lost.
72486 </para>
72487 </listitem>
72488 <listitem>
72489 <para>
72490 <indexterm role="concept">
72491 <primary>log</primary>
72492 <secondary>size rejection</secondary>
72493 </indexterm>
72494 <option>size_reject</option>: A log line is written whenever a message is rejected because
72495 it is too big.
72496 </para>
72497 </listitem>
72498 <listitem>
72499 <para>
72500 <indexterm role="concept">
72501 <primary>log</primary>
72502 <secondary>frozen messages; skipped</secondary>
72503 </indexterm>
72504 <indexterm role="concept">
72505 <primary>frozen messages</primary>
72506 <secondary>logging skipping</secondary>
72507 </indexterm>
72508 <option>skip_delivery</option>: A log line is written whenever a message is skipped during a
72509 queue run because it another process is already delivering it or because
72510 it is frozen.
72511 <indexterm role="concept">
72512 <primary><quote>spool file is locked</quote></primary>
72513 </indexterm>
72514 <indexterm role="concept">
72515 <primary><quote>message is frozen</quote></primary>
72516 </indexterm>
72517 The message that is written is either <quote>spool file is locked</quote> or
72518 <quote>message is frozen</quote>.
72519 </para>
72520 </listitem>
72521 <listitem>
72522 <para>
72523 <indexterm role="concept">
72524 <primary>log</primary>
72525 <secondary>smtp confirmation</secondary>
72526 </indexterm>
72527 <indexterm role="concept">
72528 <primary>SMTP</primary>
72529 <secondary>logging confirmation</secondary>
72530 </indexterm>
72531 <indexterm role="concept">
72532 <primary>LMTP</primary>
72533 <secondary>logging confirmation</secondary>
72534 </indexterm>
72535 <option>smtp_confirmation</option>: The response to the final <quote>.</quote> in the SMTP or LMTP dialogue for
72536 outgoing messages is added to delivery log lines in the form <literal>C=</literal>&lt;<emphasis>text</emphasis>&gt;.
72537 A number of MTAs (including Exim) return an identifying string in this
72538 response.
72539 </para>
72540 </listitem>
72541 <listitem>
72542 <para>
72543 <indexterm role="concept">
72544 <primary>log</primary>
72545 <secondary>SMTP connections</secondary>
72546 </indexterm>
72547 <indexterm role="concept">
72548 <primary>SMTP</primary>
72549 <secondary>logging connections</secondary>
72550 </indexterm>
72551 <option>smtp_connection</option>: A log line is written whenever an incoming SMTP connection is
72552 established or closed, unless the connection is from a host that matches
72553 <option>hosts_connection_nolog</option>. (In contrast, <option>lost_incoming_connection</option> applies
72554 only when the closure is unexpected.) This applies to connections from local
72555 processes that use <option>-bs</option> as well as to TCP/IP connections. If a connection is
72556 dropped in the middle of a message, a log line is always written, whether or
72557 not this selector is set, but otherwise nothing is written at the start and end
72558 of connections unless this selector is enabled.
72559 </para>
72560 <para>
72561 For TCP/IP connections to an Exim daemon, the current number of connections is
72562 included in the log message for each new connection, but note that the count is
72563 reset if the daemon is restarted.
72564 Also, because connections are closed (and the closure is logged) in
72565 subprocesses, the count may not include connections that have been closed but
72566 whose termination the daemon has not yet noticed. Thus, while it is possible to
72567 match up the opening and closing of connections in the log, the value of the
72568 logged counts may not be entirely accurate.
72569 </para>
72570 </listitem>
72571 <listitem>
72572 <para>
72573 <indexterm role="concept">
72574 <primary>log</primary>
72575 <secondary>SMTP transaction; incomplete</secondary>
72576 </indexterm>
72577 <indexterm role="concept">
72578 <primary>SMTP</primary>
72579 <secondary>logging incomplete transactions</secondary>
72580 </indexterm>
72581 <option>smtp_incomplete_transaction</option>: When a mail transaction is aborted by
72582 RSET, QUIT, loss of connection, or otherwise, the incident is logged,
72583 and the message sender plus any accepted recipients are included in the log
72584 line. This can provide evidence of dictionary attacks.
72585 </para>
72586 </listitem>
72587 <listitem>
72588 <para>
72589 <indexterm role="concept">
72590 <primary>log</primary>
72591 <secondary>non-MAIL SMTP sessions</secondary>
72592 </indexterm>
72593 <indexterm role="concept">
72594 <primary>MAIL</primary>
72595 <secondary>logging session without</secondary>
72596 </indexterm>
72597 <option>smtp_no_mail</option>: A line is written to the main log whenever an accepted SMTP
72598 connection terminates without having issued a MAIL command. This includes both
72599 the case when the connection is dropped, and the case when QUIT is used. It
72600 does not include cases where the connection is rejected right at the start (by
72601 an ACL, or because there are too many connections, or whatever). These cases
72602 already have their own log lines.
72603 </para>
72604 <para>
72605 The log line that is written contains the identity of the client in the usual
72606 way, followed by D= and a time, which records the duration of the connection.
72607 If the connection was authenticated, this fact is logged exactly as it is for
72608 an incoming message, with an A= item. If the connection was encrypted, CV=,
72609 DN=, and X= items may appear as they do for an incoming message, controlled by
72610 the same logging options.
72611 </para>
72612 <para>
72613 Finally, if any SMTP commands were issued during the connection, a C= item
72614 is added to the line, listing the commands that were used. For example,
72615 </para>
72616 <literallayout class="monospaced">
72617 C=EHLO,QUIT
72618 </literallayout>
72619 <para>
72620 shows that the client issued QUIT straight after EHLO. If there were fewer
72621 than 20 commands, they are all listed. If there were more than 20 commands,
72622 the last 20 are listed, preceded by <quote>...</quote>. However, with the default
72623 setting of 10 for <option>smtp_accept_max_nonmail</option>, the connection will in any case
72624 have been aborted before 20 non-mail commands are processed.
72625 </para>
72626 </listitem>
72627 <listitem>
72628 <para>
72629 <option>smtp_mailauth</option>: A third subfield with the authenticated sender,
72630 colon-separated, is appended to the A= item for a message arrival or delivery
72631 log line, if an AUTH argument to the SMTP MAIL command (see <xref linkend="SECTauthparamail"/>)
72632 was accepted or used.
72633 </para>
72634 </listitem>
72635 <listitem>
72636 <para>
72637 <indexterm role="concept">
72638 <primary>log</primary>
72639 <secondary>SMTP protocol error</secondary>
72640 </indexterm>
72641 <indexterm role="concept">
72642 <primary>SMTP</primary>
72643 <secondary>logging protocol error</secondary>
72644 </indexterm>
72645 <option>smtp_protocol_error</option>: A log line is written for every SMTP protocol error
72646 encountered. Exim does not have perfect detection of all protocol errors
72647 because of transmission delays and the use of pipelining. If PIPELINING has
72648 been advertised to a client, an Exim server assumes that the client will use
72649 it, and therefore it does not count <quote>expected</quote> errors (for example, RCPT
72650 received after rejecting MAIL) as protocol errors.
72651 </para>
72652 </listitem>
72653 <listitem>
72654 <para>
72655 <indexterm role="concept">
72656 <primary>SMTP</primary>
72657 <secondary>logging syntax errors</secondary>
72658 </indexterm>
72659 <indexterm role="concept">
72660 <primary>SMTP</primary>
72661 <secondary>syntax errors; logging</secondary>
72662 </indexterm>
72663 <indexterm role="concept">
72664 <primary>SMTP</primary>
72665 <secondary>unknown command; logging</secondary>
72666 </indexterm>
72667 <indexterm role="concept">
72668 <primary>log</primary>
72669 <secondary>unknown SMTP command</secondary>
72670 </indexterm>
72671 <indexterm role="concept">
72672 <primary>log</primary>
72673 <secondary>SMTP syntax error</secondary>
72674 </indexterm>
72675 <option>smtp_syntax_error</option>: A log line is written for every SMTP syntax error
72676 encountered. An unrecognized command is treated as a syntax error. For an
72677 external connection, the host identity is given; for an internal connection
72678 using <option>-bs</option> the sender identification (normally the calling user) is given.
72679 </para>
72680 </listitem>
72681 <listitem>
72682 <para>
72683 <indexterm role="concept">
72684 <primary>log</primary>
72685 <secondary>subject</secondary>
72686 </indexterm>
72687 <indexterm role="concept">
72688 <primary>subject, logging</primary>
72689 </indexterm>
72690 <option>subject</option>: The subject of the message is added to the arrival log line,
72691 preceded by <quote>T=</quote> (T for <quote>topic</quote>, since S is already used for <quote>size</quote>).
72692 Any MIME <quote>words</quote> in the subject are decoded. The <option>print_topbitchars</option> option
72693 specifies whether characters with values greater than 127 should be logged
72694 unchanged, or whether they should be rendered as escape sequences.
72695 </para>
72696 </listitem>
72697 <listitem>
72698 <para>
72699 <indexterm role="concept">
72700 <primary>log</primary>
72701 <secondary>certificate verification</secondary>
72702 </indexterm>
72703 <indexterm role="concept">
72704 <primary>log</primary>
72705 <secondary>DANE</secondary>
72706 </indexterm>
72707 <indexterm role="concept">
72708 <primary>DANE</primary>
72709 <secondary>logging</secondary>
72710 </indexterm>
72711 <option>tls_certificate_verified</option>: An extra item is added to &lt;= and =&gt; log lines
72712 when TLS is in use. The item is <literal>CV=yes</literal> if the peer&#x2019;s certificate was
72713 verified
72714 using a CA trust anchor,
72715 <literal>CV=dane</literal> if using a DNS trust anchor,
72716 and <literal>CV=no</literal> if not.
72717 </para>
72718 </listitem>
72719 <listitem>
72720 <para>
72721 <indexterm role="concept">
72722 <primary>log</primary>
72723 <secondary>TLS cipher</secondary>
72724 </indexterm>
72725 <indexterm role="concept">
72726 <primary>TLS</primary>
72727 <secondary>logging cipher</secondary>
72728 </indexterm>
72729 <option>tls_cipher</option>: When a message is sent or received over an encrypted
72730 connection, the cipher suite used is added to the log line, preceded by X=.
72731 </para>
72732 </listitem>
72733 <listitem>
72734 <para>
72735 <indexterm role="concept">
72736 <primary>log</primary>
72737 <secondary>TLS peer DN</secondary>
72738 </indexterm>
72739 <indexterm role="concept">
72740 <primary>TLS</primary>
72741 <secondary>logging peer DN</secondary>
72742 </indexterm>
72743 <option>tls_peerdn</option>: When a message is sent or received over an encrypted
72744 connection, and a certificate is supplied by the remote host, the peer DN is
72745 added to the log line, preceded by DN=.
72746 </para>
72747 </listitem>
72748 <listitem>
72749 <para>
72750 <indexterm role="concept">
72751 <primary>log</primary>
72752 <secondary>TLS resumption</secondary>
72753 </indexterm>
72754 <indexterm role="concept">
72755 <primary>TLS</primary>
72756 <secondary>logging session resumption</secondary>
72757 </indexterm>
72758 <option>tls_resumption</option>: When a message is sent or received over an encrypted
72759 connection and the TLS session resumed one used on a previous TCP connection,
72760 an asterisk is appended to the X= cipher field in the log line.
72761 </para>
72762 </listitem>
72763 <listitem>
72764 <para>
72765 <indexterm role="concept">
72766 <primary>log</primary>
72767 <secondary>TLS SNI</secondary>
72768 </indexterm>
72769 <indexterm role="concept">
72770 <primary>TLS</primary>
72771 <secondary>logging SNI</secondary>
72772 </indexterm>
72773 <indexterm role="concept">
72774 <primary>SNI</primary>
72775 <secondary>logging</secondary>
72776 </indexterm>
72777 <option>tls_sni</option>: When a message is received over an encrypted connection, and
72778 the remote host provided the Server Name Indication extension, the SNI is
72779 added to the log line, preceded by SNI=.
72780 </para>
72781 </listitem>
72782 <listitem>
72783 <para>
72784 <indexterm role="concept">
72785 <primary>log</primary>
72786 <secondary>DNS failure in list</secondary>
72787 </indexterm>
72788 <option>unknown_in_list</option>: This setting causes a log entry to be written when the
72789 result of a list match is failure because a DNS lookup failed.
72790 </para>
72791 </listitem>
72792 </itemizedlist>
72793 </section>
72794 <section id="SECID260">
72795 <title>Message log</title>
72796 <para>
72797 <indexterm role="concept">
72798 <primary>message</primary>
72799 <secondary>log file for</secondary>
72800 </indexterm>
72801 <indexterm role="concept">
72802 <primary>log</primary>
72803 <secondary>message log; description of</secondary>
72804 </indexterm>
72805 <indexterm role="concept">
72806 <primary><filename>msglog</filename> directory</primary>
72807 </indexterm>
72808 <indexterm role="option">
72809 <primary><option>preserve_message_logs</option></primary>
72810 </indexterm>
72811 In addition to the general log files, Exim writes a log file for each message
72812 that it handles. The names of these per-message logs are the message ids, and
72813 they are kept in the <filename>msglog</filename> sub-directory of the spool directory. Each
72814 message log contains copies of the log lines that apply to the message. This
72815 makes it easier to inspect the status of an individual message without having
72816 to search the main log. A message log is deleted when processing of the message
72817 is complete, unless <option>preserve_message_logs</option> is set, but this should be used
72818 only with great care because they can fill up your disk very quickly.
72819 </para>
72820 <para>
72821 On a heavily loaded system, it may be desirable to disable the use of
72822 per-message logs, in order to reduce disk I/O. This can be done by setting the
72823 <option>message_logs</option> option false.
72824 <indexterm role="concept" startref="IIDloggen" class="endofrange"/>
72825 </para>
72826 </section>
72827 </chapter>
72828
72829 <chapter id="CHAPutils">
72830 <title>Exim utilities</title>
72831 <para>
72832 <indexterm role="concept" id="IIDutils" class="startofrange">
72833 <primary>utilities</primary>
72834 </indexterm>
72835 A number of utility scripts and programs are supplied with Exim and are
72836 described in this chapter. There is also the Exim Monitor, which is covered in
72837 the next chapter. The utilities described here are:
72838 </para>
72839 <informaltable frame="none">
72840 <tgroup cols="3" colsep="0" rowsep="0">
72841 <colspec colwidth="7*" align="left"/>
72842 <colspec colwidth="15*" align="left"/>
72843 <colspec colwidth="40*" align="left"/>
72844 <tbody>
72845 <row>
72846 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinoutwha"/></entry>
72847 <entry><emphasis>exiwhat</emphasis></entry>
72848 <entry>list what Exim processes are doing</entry>
72849 </row>
72850 <row>
72851 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTgreptheque"/></entry>
72852 <entry><emphasis>exiqgrep</emphasis></entry>
72853 <entry>grep the queue</entry>
72854 </row>
72855 <row>
72856 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTsumtheque"/></entry>
72857 <entry><emphasis>exiqsumm</emphasis></entry>
72858 <entry>summarize the queue</entry>
72859 </row>
72860 <row>
72861 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTextspeinf"/></entry>
72862 <entry><emphasis>exigrep</emphasis></entry>
72863 <entry>search the main log</entry>
72864 </row>
72865 <row>
72866 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTexipick"/></entry>
72867 <entry><emphasis>exipick</emphasis></entry>
72868 <entry>select messages on various criteria</entry>
72869 </row>
72870 <row>
72871 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcyclogfil"/></entry>
72872 <entry><emphasis>exicyclog</emphasis></entry>
72873 <entry>cycle (rotate) log files</entry>
72874 </row>
72875 <row>
72876 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailstat"/></entry>
72877 <entry><emphasis>eximstats</emphasis></entry>
72878 <entry>extract statistics from the log</entry>
72879 </row>
72880 <row>
72881 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTcheckaccess"/></entry>
72882 <entry><emphasis>exim_checkaccess</emphasis></entry>
72883 <entry>check address acceptance from given IP</entry>
72884 </row>
72885 <row>
72886 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdbmbuild"/></entry>
72887 <entry><emphasis>exim_dbmbuild</emphasis></entry>
72888 <entry>build a DBM file</entry>
72889 </row>
72890 <row>
72891 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfinindret"/></entry>
72892 <entry><emphasis>exinext</emphasis></entry>
72893 <entry>extract retry information</entry>
72894 </row>
72895 <row>
72896 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTdumpdb"/></entry>
72897 <entry><emphasis>exim_dumpdb</emphasis></entry>
72898 <entry>dump a hints database</entry>
72899 </row>
72900 <row>
72901 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTtidydb"/></entry>
72902 <entry><emphasis>exim_tidydb</emphasis></entry>
72903 <entry>clean up a hints database</entry>
72904 </row>
72905 <row>
72906 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTfixdb"/></entry>
72907 <entry><emphasis>exim_fixdb</emphasis></entry>
72908 <entry>patch a hints database</entry>
72909 </row>
72910 <row>
72911 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<xref linkend="SECTmailboxmaint"/></entry>
72912 <entry><emphasis>exim_lock</emphasis></entry>
72913 <entry>lock a mailbox file</entry>
72914 </row>
72915 </tbody>
72916 </tgroup>
72917 </informaltable>
72918 <para>
72919 Another utility that might be of use to sites with many MTAs is Tom Kistner&#x2019;s
72920 <emphasis>exilog</emphasis>. It provides log visualizations across multiple Exim servers. See
72921 <emphasis role="bold"><ulink url="https://duncanthrax.net/exilog/">https://duncanthrax.net/exilog/</ulink></emphasis> for details.
72922 </para>
72923 <section id="SECTfinoutwha">
72924 <title>Finding out what Exim processes are doing (exiwhat)</title>
72925 <para>
72926 <indexterm role="concept">
72927 <primary><emphasis>exiwhat</emphasis></primary>
72928 </indexterm>
72929 <indexterm role="concept">
72930 <primary>process, querying</primary>
72931 </indexterm>
72932 <indexterm role="concept">
72933 <primary>SIGUSR1</primary>
72934 </indexterm>
72935 On operating systems that can restart a system call after receiving a signal
72936 (most modern OS), an Exim process responds to the SIGUSR1 signal by writing
72937 a line describing what it is doing to the file <filename>exim-process.info</filename> in the
72938 Exim spool directory. The <emphasis>exiwhat</emphasis> script sends the signal to all Exim
72939 processes it can find, having first emptied the file. It then waits for one
72940 second to allow the Exim processes to react before displaying the results. In
72941 order to run <emphasis>exiwhat</emphasis> successfully you have to have sufficient privilege to
72942 send the signal to the Exim processes, so it is normally run as root.
72943 </para>
72944 <para>
72945 <emphasis role="bold">Warning</emphasis>: This is not an efficient process. It is intended for occasional
72946 use by system administrators. It is not sensible, for example, to set up a
72947 script that sends SIGUSR1 signals to Exim processes at short intervals.
72948 </para>
72949 <para>
72950 Unfortunately, the <emphasis>ps</emphasis> command that <emphasis>exiwhat</emphasis> uses to find Exim processes
72951 varies in different operating systems. Not only are different options used,
72952 but the format of the output is different. For this reason, there are some
72953 system configuration options that configure exactly how <emphasis>exiwhat</emphasis> works. If
72954 it doesn&#x2019;t seem to be working for you, check the following compile-time
72955 options:
72956 </para>
72957 <informaltable frame="none">
72958 <tgroup cols="2" colsep="0" rowsep="0">
72959 <colspec colwidth="1pt" align="left"/>
72960 <colspec colwidth="1pt" align="left"/>
72961 <tbody>
72962 <row>
72963 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>EXIWHAT_PS_CMD</literal></entry>
72964 <entry>the command for running <emphasis>ps</emphasis></entry>
72965 </row>
72966 <row>
72967 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>EXIWHAT_PS_ARG</literal></entry>
72968 <entry>the argument for <emphasis>ps</emphasis></entry>
72969 </row>
72970 <row>
72971 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>EXIWHAT_EGREP_ARG</literal></entry>
72972 <entry>the argument for <emphasis>egrep</emphasis> to select from <emphasis>ps</emphasis> output</entry>
72973 </row>
72974 <row>
72975 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>EXIWHAT_KILL_ARG</literal></entry>
72976 <entry>the argument for the <emphasis>kill</emphasis> command</entry>
72977 </row>
72978 </tbody>
72979 </tgroup>
72980 </informaltable>
72981 <para>
72982 An example of typical output from <emphasis>exiwhat</emphasis> is
72983 </para>
72984 <literallayout class="monospaced">
72985 164 daemon: -q1h, listening on port 25
72986 10483 running queue: waiting for 0tAycK-0002ij-00 (10492)
72987 10492 delivering 0tAycK-0002ij-00 to mail.ref.example
72988   [10.19.42.42] (editor@ref.example)
72989 10592 handling incoming call from [192.168.243.242]
72990 10628 accepting a local non-SMTP message
72991 </literallayout>
72992 <para>
72993 The first number in the output line is the process number. The third line has
72994 been split here, in order to fit it on the page.
72995 </para>
72996 </section>
72997 <section id="SECTgreptheque">
72998 <title>Selective queue listing (exiqgrep)</title>
72999 <para>
73000 <indexterm role="concept">
73001 <primary><emphasis>exiqgrep</emphasis></primary>
73002 </indexterm>
73003 <indexterm role="concept">
73004 <primary>queue</primary>
73005 <secondary>grepping</secondary>
73006 </indexterm>
73007 This utility is a Perl script contributed by Matt Hubbard. It runs
73008 </para>
73009 <literallayout class="monospaced">
73010 exim -bpu
73011 </literallayout>
73012 <para>
73013 or (in case <emphasis role="bold">-a</emphasis> switch is specified)
73014 </para>
73015 <literallayout class="monospaced">
73016 exim -bp
73017 </literallayout>
73018 <para>
73019 to obtain a queue listing, and then greps the output to select messages
73020 that match given criteria. The following selection options are available:
73021 </para>
73022 <variablelist>
73023 <varlistentry>
73024 <term><emphasis role="bold">-f</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
73025 <listitem>
73026 <para>
73027 Match the sender address using a case-insensitive search. The field that is
73028 tested is enclosed in angle brackets, so you can test for bounce messages with
73029 </para>
73030 <literallayout class="monospaced">
73031 exiqgrep -f '^&lt;&gt;$'
73032 </literallayout>
73033 </listitem></varlistentry>
73034 <varlistentry>
73035 <term><emphasis role="bold">-r</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
73036 <listitem>
73037 <para>
73038 Match a recipient address using a case-insensitive search. The field that is
73039 tested is not enclosed in angle brackets.
73040 </para>
73041 </listitem></varlistentry>
73042 <varlistentry>
73043 <term><emphasis role="bold">-s</emphasis>&nbsp;&lt;<emphasis>regex</emphasis>&gt;</term>
73044 <listitem>
73045 <para>
73046 Match against the size field.
73047 </para>
73048 </listitem></varlistentry>
73049 <varlistentry>
73050 <term><emphasis role="bold">-y</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
73051 <listitem>
73052 <para>
73053 Match messages that are younger than the given time.
73054 </para>
73055 </listitem></varlistentry>
73056 <varlistentry>
73057 <term><emphasis role="bold">-o</emphasis>&nbsp;&lt;<emphasis>seconds</emphasis>&gt;</term>
73058 <listitem>
73059 <para>
73060 Match messages that are older than the given time.
73061 </para>
73062 </listitem></varlistentry>
73063 <varlistentry>
73064 <term><emphasis role="bold">-z</emphasis></term>
73065 <listitem>
73066 <para>
73067 Match only frozen messages.
73068 </para>
73069 </listitem></varlistentry>
73070 <varlistentry>
73071 <term><emphasis role="bold">-x</emphasis></term>
73072 <listitem>
73073 <para>
73074 Match only non-frozen messages.
73075 </para>
73076 </listitem></varlistentry>
73077 <varlistentry>
73078 <term><emphasis role="bold">-G</emphasis>&nbsp;&lt;<emphasis>queuename</emphasis>&gt;</term>
73079 <listitem>
73080 <para>
73081 Match only messages in the given queue.  Without this, the default queue is searched.
73082 </para>
73083 </listitem></varlistentry>
73084 </variablelist>
73085 <para>
73086 The following options control the format of the output:
73087 </para>
73088 <variablelist>
73089 <varlistentry>
73090 <term><emphasis role="bold">-c</emphasis></term>
73091 <listitem>
73092 <para>
73093 Display only the count of matching messages.
73094 </para>
73095 </listitem></varlistentry>
73096 <varlistentry>
73097 <term><emphasis role="bold">-l</emphasis></term>
73098 <listitem>
73099 <para>
73100 Long format &ndash; display the full message information as output by Exim. This is
73101 the default.
73102 </para>
73103 </listitem></varlistentry>
73104 <varlistentry>
73105 <term><emphasis role="bold">-i</emphasis></term>
73106 <listitem>
73107 <para>
73108 Display message ids only.
73109 </para>
73110 </listitem></varlistentry>
73111 <varlistentry>
73112 <term><emphasis role="bold">-b</emphasis></term>
73113 <listitem>
73114 <para>
73115 Brief format &ndash; one line per message.
73116 </para>
73117 </listitem></varlistentry>
73118 <varlistentry>
73119 <term><emphasis role="bold">-R</emphasis></term>
73120 <listitem>
73121 <para>
73122 Display messages in reverse order.
73123 </para>
73124 </listitem></varlistentry>
73125 <varlistentry>
73126 <term><emphasis role="bold">-a</emphasis></term>
73127 <listitem>
73128 <para>
73129 Include delivered recipients in queue listing.
73130 </para>
73131 </listitem></varlistentry>
73132 </variablelist>
73133 <para>
73134 The following options give alternates for configuration:
73135 </para>
73136 <variablelist>
73137 <varlistentry>
73138 <term><emphasis role="bold">-C</emphasis>&nbsp;&lt;<emphasis>config&nbsp;file</emphasis>&gt;</term>
73139 <listitem>
73140 <para>
73141 is used to specify an alternate <filename>exim.conf</filename> which might
73142 contain alternate exim configuration the queue management might be using.
73143 </para>
73144 </listitem></varlistentry>
73145 <varlistentry>
73146 <term><emphasis role="bold">-E</emphasis>&nbsp;&lt;<emphasis>path</emphasis>&gt;</term>
73147 <listitem>
73148 <para>
73149 can be used to specify a path for the exim binary,
73150 overriding the built-in one.
73151 </para>
73152 </listitem></varlistentry>
73153 </variablelist>
73154 <para>
73155 There is one more option, <option>-h</option>, which outputs a list of options.
73156 </para>
73157 <para revisionflag="changed">
73158 At least one selection option, or either the <emphasis role="bold">-c</emphasis> or <emphasis role="bold">-h</emphasis> option, must be given.
73159 </para>
73160 </section>
73161 <section id="SECTsumtheque">
73162 <title>Summarizing the queue (exiqsumm)</title>
73163 <para>
73164 <indexterm role="concept">
73165 <primary><emphasis>exiqsumm</emphasis></primary>
73166 </indexterm>
73167 <indexterm role="concept">
73168 <primary>queue</primary>
73169 <secondary>summary</secondary>
73170 </indexterm>
73171 The <emphasis>exiqsumm</emphasis> utility is a Perl script which reads the output of <literal>exim
73172 -bp</literal> and produces a summary of the messages in the queue. Thus, you use it by
73173 running a command such as
73174 </para>
73175 <literallayout class="monospaced">
73176 exim -bp | exiqsumm
73177 </literallayout>
73178 <para>
73179 The output consists of one line for each domain that has messages waiting for
73180 it, as in the following example:
73181 </para>
73182 <literallayout class="monospaced">
73183 3   2322   74m   66m  msn.com.example
73184 </literallayout>
73185 <para>
73186 Each line lists the number of pending deliveries for a domain, their total
73187 volume, and the length of time that the oldest and the newest messages have
73188 been waiting. Note that the number of pending deliveries is greater than the
73189 number of messages when messages have more than one recipient.
73190 </para>
73191 <para>
73192 A summary line is output at the end. By default the output is sorted on the
73193 domain name, but <emphasis>exiqsumm</emphasis> has the options <option>-a</option> and <option>-c</option>, which cause
73194 the output to be sorted by oldest message and by count of messages,
73195 respectively. There are also three options that split the messages for each
73196 domain into two or more subcounts: <option>-b</option> separates bounce messages, <option>-f</option>
73197 separates frozen messages, and <option>-s</option> separates messages according to their
73198 sender.
73199 </para>
73200 <para>
73201 The output of <emphasis>exim -bp</emphasis> contains the original addresses in the message, so
73202 this also applies to the output from <emphasis>exiqsumm</emphasis>. No domains from addresses
73203 generated by aliasing or forwarding are included (unless the <option>one_time</option>
73204 option of the <command>redirect</command> router has been used to convert them into <quote>top
73205 level</quote> addresses).
73206 </para>
73207 </section>
73208 <section id="SECTextspeinf">
73209 <title>Extracting specific information from the log (exigrep)</title>
73210 <para>
73211 <indexterm role="concept">
73212 <primary><emphasis>exigrep</emphasis></primary>
73213 </indexterm>
73214 <indexterm role="concept">
73215 <primary>log</primary>
73216 <secondary>extracts; grepping for</secondary>
73217 </indexterm>
73218 The <emphasis>exigrep</emphasis> utility is a Perl script that searches one or more main log
73219 files for entries that match a given pattern. When it finds a match, it
73220 extracts all the log entries for the relevant message, not just those that
73221 match the pattern. Thus, <emphasis>exigrep</emphasis> can extract complete log entries for a
73222 given message, or all mail for a given user, or for a given host, for example.
73223 The input files can be in Exim log format or syslog format.
73224 If a matching log line is not associated with a specific message, it is
73225 included in <emphasis>exigrep</emphasis>&#x2019;s output without any additional lines. The usage is:
73226 </para>
73227 <literallayout>
73228 <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>
73229 </literallayout>
73230 <para>
73231 If no log filenames are given on the command line, the standard input is read.
73232 </para>
73233 <para>
73234 The <option>-t</option> argument specifies a number of seconds. It adds an additional
73235 condition for message selection. Messages that are complete are shown only if
73236 they spent more than &lt;<emphasis>n</emphasis>&gt; seconds in the queue.
73237 </para>
73238 <para>
73239 By default, <emphasis>exigrep</emphasis> does case-insensitive matching. The <option>-I</option> option
73240 makes it case-sensitive. This may give a performance improvement when searching
73241 large log files. Without <option>-I</option>, the Perl pattern matches use Perl&#x2019;s <literal>/i</literal>
73242 option; with <option>-I</option> they do not. In both cases it is possible to change the
73243 case sensitivity within the pattern by using <literal>(?i)</literal> or <literal>(?-i)</literal>.
73244 </para>
73245 <para>
73246 The <option>-l</option> option means <quote>literal</quote>, that is, treat all characters in the
73247 pattern as standing for themselves. Otherwise the pattern must be a Perl
73248 regular expression.
73249 </para>
73250 <para>
73251 The <option>-v</option> option inverts the matching condition. That is, a line is selected
73252 if it does <emphasis>not</emphasis> match the pattern.
73253 </para>
73254 <para>
73255 The <option>-M</option> options means <quote>related messages</quote>. <emphasis>exigrep</emphasis> will show messages
73256 that are generated as a result/response to a message that <emphasis>exigrep</emphasis> matched
73257 normally.
73258 </para>
73259 <para>
73260 Example of <option>-M</option>:
73261 user_a sends a message to user_b, which generates a bounce back to user_b. If
73262 <emphasis>exigrep</emphasis> is used to search for <quote>user_a</quote>, only the first message will be
73263 displayed.  But if <emphasis>exigrep</emphasis> is used to search for <quote>user_b</quote>, the first and
73264 the second (bounce) message will be displayed. Using <option>-M</option> with <emphasis>exigrep</emphasis>
73265 when searching for <quote>user_a</quote> will show both messages since the bounce is
73266 <quote>related</quote> to or a <quote>result</quote> of the first message that was found by the
73267 search term.
73268 </para>
73269 <para>
73270 If the location of a <emphasis>zcat</emphasis> command is known from the definition of
73271 ZCAT_COMMAND in <filename>Local/Makefile</filename>, <emphasis>exigrep</emphasis> automatically passes any file
73272 whose name ends in COMPRESS_SUFFIX through <emphasis>zcat</emphasis> as it searches it.
73273 If the ZCAT_COMMAND is not executable, <emphasis>exigrep</emphasis> tries to use
73274 autodetection of some well known compression extensions.
73275 </para>
73276 </section>
73277 <section id="SECTexipick">
73278 <title>Selecting messages by various criteria (exipick)</title>
73279 <para>
73280 <indexterm role="concept">
73281 <primary><emphasis>exipick</emphasis></primary>
73282 </indexterm>
73283 John Jetmore&#x2019;s <emphasis>exipick</emphasis> utility is included in the Exim distribution. It
73284 lists messages from the queue according to a variety of criteria. For details
73285 of <emphasis>exipick</emphasis>&#x2019;s facilities, run <emphasis>exipick</emphasis> with
73286 the <option>--help</option> option.
73287 </para>
73288 </section>
73289 <section id="SECTcyclogfil">
73290 <title>Cycling log files (exicyclog)</title>
73291 <para>
73292 <indexterm role="concept">
73293 <primary>log</primary>
73294 <secondary>cycling local files</secondary>
73295 </indexterm>
73296 <indexterm role="concept">
73297 <primary>cycling logs</primary>
73298 </indexterm>
73299 <indexterm role="concept">
73300 <primary><emphasis>exicyclog</emphasis></primary>
73301 </indexterm>
73302 The <emphasis>exicyclog</emphasis> script can be used to cycle (rotate) <emphasis>mainlog</emphasis> and
73303 <emphasis>rejectlog</emphasis> files. This is not necessary if only syslog is being used, or if
73304 you are using log files with datestamps in their names (see section
73305 <xref linkend="SECTdatlogfil"/>). Some operating systems have their own standard mechanisms
73306 for log cycling, and these can be used instead of <emphasis>exicyclog</emphasis> if preferred.
73307 There are two command line options for <emphasis>exicyclog</emphasis>:
73308 </para>
73309 <itemizedlist>
73310 <listitem>
73311 <para>
73312 <option>-k</option> &lt;<emphasis>count</emphasis>&gt; specifies the number of log files to keep, overriding the
73313 default that is set when Exim is built. The default default is 10.
73314 </para>
73315 </listitem>
73316 <listitem>
73317 <para>
73318 <option>-l</option> &lt;<emphasis>path</emphasis>&gt; specifies the log file path, in the same format as Exim&#x2019;s
73319 <option>log_file_path</option> option (for example, <literal>/var/log/exim_%slog</literal>), again
73320 overriding the script&#x2019;s default, which is to find the setting from Exim&#x2019;s
73321 configuration.
73322 </para>
73323 </listitem>
73324 </itemizedlist>
73325 <para>
73326 Each time <emphasis>exicyclog</emphasis> is run the filenames get <quote>shuffled down</quote> by one. If
73327 the main log filename is <filename>mainlog</filename> (the default) then when <emphasis>exicyclog</emphasis> is
73328 run <filename>mainlog</filename> becomes <filename>mainlog.01</filename>, the previous <filename>mainlog.01</filename> becomes
73329 <filename>mainlog.02</filename> and so on, up to the limit that is set in the script or by the
73330 <option>-k</option> option. Log files whose numbers exceed the limit are discarded. Reject
73331 logs are handled similarly.
73332 </para>
73333 <para>
73334 If the limit is greater than 99, the script uses 3-digit numbers such as
73335 <filename>mainlog.001</filename>, <filename>mainlog.002</filename>, etc. If you change from a number less than 99
73336 to one that is greater, or <emphasis>vice versa</emphasis>, you will have to fix the names of
73337 any existing log files.
73338 </para>
73339 <para>
73340 If no <filename>mainlog</filename> file exists, the script does nothing. Files that <quote>drop off</quote>
73341 the end are deleted. All files with numbers greater than 01 are compressed,
73342 using a compression command which is configured by the COMPRESS_COMMAND
73343 setting in <filename>Local/Makefile</filename>. It is usual to run <emphasis>exicyclog</emphasis> daily from a
73344 root <option>crontab</option> entry of the form
73345 </para>
73346 <literallayout class="monospaced">
73347 1 0 * * * su exim -c /usr/exim/bin/exicyclog
73348 </literallayout>
73349 <para>
73350 assuming you have used the name <quote>exim</quote> for the Exim user. You can run
73351 <emphasis>exicyclog</emphasis> as root if you wish, but there is no need.
73352 </para>
73353 </section>
73354 <section id="SECTmailstat">
73355 <title>Mail statistics (eximstats)</title>
73356 <para>
73357 <indexterm role="concept">
73358 <primary>statistics</primary>
73359 </indexterm>
73360 <indexterm role="concept">
73361 <primary><emphasis>eximstats</emphasis></primary>
73362 </indexterm>
73363 A Perl script called <emphasis>eximstats</emphasis> is provided for extracting statistical
73364 information from log files. The output is either plain text, or HTML.
73365 </para>
73366 <para>
73367 The <emphasis>eximstats</emphasis> script has been hacked about quite a bit over time. The
73368 latest version is the result of some extensive revision by Steve Campbell. A
73369 lot of information is given by default, but there are options for suppressing
73370 various parts of it. Following any options, the arguments to the script are a
73371 list of files, which should be main log files. For example:
73372 </para>
73373 <literallayout class="monospaced">
73374 eximstats -nr /var/spool/exim/log/mainlog.01
73375 </literallayout>
73376 <para>
73377 By default, <emphasis>eximstats</emphasis> extracts information about the number and volume of
73378 messages received from or delivered to various hosts. The information is sorted
73379 both by message count and by volume, and the top fifty hosts in each category
73380 are listed on the standard output. Similar information, based on email
73381 addresses or domains instead of hosts can be requested by means of various
73382 options. For messages delivered and received locally, similar statistics are
73383 also produced per user.
73384 </para>
73385 <para>
73386 The output also includes total counts and statistics about delivery errors, and
73387 histograms showing the number of messages received and deliveries made in each
73388 hour of the day. A delivery with more than one address in its envelope (for
73389 example, an SMTP transaction with more than one RCPT command) is counted
73390 as a single delivery by <emphasis>eximstats</emphasis>.
73391 </para>
73392 <para>
73393 Though normally more deliveries than receipts are reported (as messages may
73394 have multiple recipients), it is possible for <emphasis>eximstats</emphasis> to report more
73395 messages received than delivered, even though the queue is empty at the start
73396 and end of the period in question. If an incoming message contains no valid
73397 recipients, no deliveries are recorded for it. A bounce message is handled as
73398 an entirely separate message.
73399 </para>
73400 <para>
73401 <emphasis>eximstats</emphasis> always outputs a grand total summary giving the volume and number
73402 of messages received and deliveries made, and the number of hosts involved in
73403 each case. It also outputs the number of messages that were delayed (that is,
73404 not completely delivered at the first attempt), and the number that had at
73405 least one address that failed.
73406 </para>
73407 <para>
73408 The remainder of the output is in sections that can be independently disabled
73409 or modified by various options. It consists of a summary of deliveries by
73410 transport, histograms of messages received and delivered per time interval
73411 (default per hour), information about the time messages spent in the queue,
73412 a list of relayed messages, lists of the top fifty sending hosts, local
73413 senders, destination hosts, and destination local users by count and by volume,
73414 and a list of delivery errors that occurred.
73415 </para>
73416 <para>
73417 The relay information lists messages that were actually relayed, that is, they
73418 came from a remote host and were directly delivered to some other remote host,
73419 without being processed (for example, for aliasing or forwarding) locally.
73420 </para>
73421 <para>
73422 There are quite a few options for <emphasis>eximstats</emphasis> to control exactly what it
73423 outputs. These are documented in the Perl script itself, and can be extracted
73424 by running the command <command>perldoc</command> on the script. For example:
73425 </para>
73426 <literallayout class="monospaced">
73427 perldoc /usr/exim/bin/eximstats
73428 </literallayout>
73429 </section>
73430 <section id="SECTcheckaccess">
73431 <title>Checking access policy (exim_checkaccess)</title>
73432 <para>
73433 <indexterm role="concept">
73434 <primary><emphasis>exim_checkaccess</emphasis></primary>
73435 </indexterm>
73436 <indexterm role="concept">
73437 <primary>policy control</primary>
73438 <secondary>checking access</secondary>
73439 </indexterm>
73440 <indexterm role="concept">
73441 <primary>checking access</primary>
73442 </indexterm>
73443 The <option>-bh</option> command line argument allows you to run a fake SMTP session with
73444 debugging output, in order to check what Exim is doing when it is applying
73445 policy controls to incoming SMTP mail. However, not everybody is sufficiently
73446 familiar with the SMTP protocol to be able to make full use of <option>-bh</option>, and
73447 sometimes you just want to answer the question <quote>Does this address have
73448 access?</quote> without bothering with any further details.
73449 </para>
73450 <para>
73451 The <emphasis>exim_checkaccess</emphasis> utility is a <quote>packaged</quote> version of <option>-bh</option>. It takes
73452 two arguments, an IP address and an email address:
73453 </para>
73454 <literallayout class="monospaced">
73455 exim_checkaccess 10.9.8.7 A.User@a.domain.example
73456 </literallayout>
73457 <para>
73458 The utility runs a call to Exim with the <option>-bh</option> option, to test whether the
73459 given email address would be accepted in a RCPT command in a TCP/IP
73460 connection from the host with the given IP address. The output of the utility
73461 is either the word <quote>accepted</quote>, or the SMTP error response, for example:
73462 </para>
73463 <literallayout class="monospaced">
73464 Rejected:
73465 550 Relay not permitted
73466 </literallayout>
73467 <para>
73468 When running this test, the utility uses <literal>&lt;&gt;</literal> as the envelope sender address
73469 for the MAIL command, but you can change this by providing additional
73470 options. These are passed directly to the Exim command. For example, to specify
73471 that the test is to be run with the sender address <emphasis>himself@there.example</emphasis>
73472 you can use:
73473 </para>
73474 <literallayout class="monospaced">
73475 exim_checkaccess 10.9.8.7 A.User@a.domain.example \
73476                  -f himself@there.example
73477 </literallayout>
73478 <para>
73479 Note that these additional Exim command line items must be given after the two
73480 mandatory arguments.
73481 </para>
73482 <para>
73483 Because the <option>exim_checkaccess</option> uses <option>-bh</option>, it does not perform callouts
73484 while running its checks. You can run checks that include callouts by using
73485 <option>-bhc</option>, but this is not yet available in a <quote>packaged</quote> form.
73486 </para>
73487 </section>
73488 <section id="SECTdbmbuild">
73489 <title>Making DBM files (exim_dbmbuild)</title>
73490 <para>
73491 <indexterm role="concept">
73492 <primary>DBM</primary>
73493 <secondary>building dbm files</secondary>
73494 </indexterm>
73495 <indexterm role="concept">
73496 <primary>building DBM files</primary>
73497 </indexterm>
73498 <indexterm role="concept">
73499 <primary><emphasis>exim_dbmbuild</emphasis></primary>
73500 </indexterm>
73501 <indexterm role="concept">
73502 <primary>lower casing</primary>
73503 </indexterm>
73504 <indexterm role="concept">
73505 <primary>binary zero</primary>
73506 <secondary>in lookup key</secondary>
73507 </indexterm>
73508 The <emphasis>exim_dbmbuild</emphasis> program reads an input file containing keys and data in
73509 the format used by the <command>lsearch</command> lookup (see section
73510 <xref linkend="SECTsinglekeylookups"/>). It writes a DBM file using the lower-cased alias
73511 names as keys and the remainder of the information as data. The lower-casing
73512 can be prevented by calling the program with the <option>-nolc</option> option.
73513 </para>
73514 <para>
73515 A terminating zero is included as part of the key string. This is expected by
73516 the <command>dbm</command> lookup type. However, if the option <option>-nozero</option> is given,
73517 <emphasis>exim_dbmbuild</emphasis> creates files without terminating zeroes in either the key
73518 strings or the data strings. The <command>dbmnz</command> lookup type can be used with such
73519 files.
73520 </para>
73521 <para>
73522 The program requires two arguments: the name of the input file (which can be a
73523 single hyphen to indicate the standard input), and the name of the output file.
73524 It creates the output under a temporary name, and then renames it if all went
73525 well.
73526 </para>
73527 <para>
73528 <indexterm role="concept">
73529 <primary>USE_DB</primary>
73530 </indexterm>
73531 If the native DB interface is in use (USE_DB is set in a compile-time
73532 configuration file &ndash; this is common in free versions of Unix) the two
73533 filenames must be different, because in this mode the Berkeley DB functions
73534 create a single output file using exactly the name given. For example,
73535 </para>
73536 <literallayout class="monospaced">
73537 exim_dbmbuild /etc/aliases /etc/aliases.db
73538 </literallayout>
73539 <para>
73540 reads the system alias file and creates a DBM version of it in
73541 <filename>/etc/aliases.db</filename>.
73542 </para>
73543 <para>
73544 In systems that use the <emphasis>ndbm</emphasis> routines (mostly proprietary versions of
73545 Unix), two files are used, with the suffixes <filename>.dir</filename> and <filename>.pag</filename>. In this
73546 environment, the suffixes are added to the second argument of
73547 <emphasis>exim_dbmbuild</emphasis>, so it can be the same as the first. This is also the case
73548 when the Berkeley functions are used in compatibility mode (though this is not
73549 recommended), because in that case it adds a <filename>.db</filename> suffix to the filename.
73550 </para>
73551 <para>
73552 If a duplicate key is encountered, the program outputs a warning, and when it
73553 finishes, its return code is 1 rather than zero, unless the <option>-noduperr</option>
73554 option is used. By default, only the first of a set of duplicates is used &ndash;
73555 this makes it compatible with <command>lsearch</command> lookups. There is an option
73556 <option>-lastdup</option> which causes it to use the data for the last duplicate instead.
73557 There is also an option <option>-nowarn</option>, which stops it listing duplicate keys to
73558 <option>stderr</option>. For other errors, where it doesn&#x2019;t actually make a new file, the
73559 return code is 2.
73560 </para>
73561 </section>
73562 <section id="SECTfinindret">
73563 <title>Finding individual retry times (exinext)</title>
73564 <para>
73565 <indexterm role="concept">
73566 <primary>retry</primary>
73567 <secondary>times</secondary>
73568 </indexterm>
73569 <indexterm role="concept">
73570 <primary><emphasis>exinext</emphasis></primary>
73571 </indexterm>
73572 A utility called <emphasis>exinext</emphasis> (mostly a Perl script) provides the ability to
73573 fish specific information out of the retry database. Given a mail domain (or a
73574 complete address), it looks up the hosts for that domain, and outputs any retry
73575 information for the hosts or for the domain. At present, the retry information
73576 is obtained by running <emphasis>exim_dumpdb</emphasis> (see below) and post-processing the
73577 output. For example:
73578 </para>
73579 <literallayout class="monospaced">
73580 $ exinext piglet@milne.fict.example
73581 kanga.milne.example:192.168.8.1 error 146: Connection refused
73582   first failed: 21-Feb-1996 14:57:34
73583   last tried:   21-Feb-1996 14:57:34
73584   next try at:  21-Feb-1996 15:02:34
73585 roo.milne.example:192.168.8.3 error 146: Connection refused
73586   first failed: 20-Jan-1996 13:12:08
73587   last tried:   21-Feb-1996 11:42:03
73588   next try at:  21-Feb-1996 19:42:03
73589   past final cutoff time
73590 </literallayout>
73591 <para>
73592 You can also give <emphasis>exinext</emphasis> a local part, without a domain, and it
73593 will give any retry information for that local part in your default domain.
73594 A message id can be used to obtain retry information pertaining to a specific
73595 message. This exists only when an attempt to deliver a message to a remote host
73596 suffers a message-specific error (see section <xref linkend="SECToutSMTPerr"/>).
73597 <emphasis>exinext</emphasis> is not particularly efficient, but then it is not expected to be
73598 run very often.
73599 </para>
73600 <para>
73601 The <emphasis>exinext</emphasis> utility calls Exim to find out information such as the location
73602 of the spool directory. The utility has <option>-C</option> and <option>-D</option> options, which are
73603 passed on to the <emphasis>exim</emphasis> commands. The first specifies an alternate Exim
73604 configuration file, and the second sets macros for use within the configuration
73605 file. These features are mainly to help in testing, but might also be useful in
73606 environments where more than one configuration file is in use.
73607 </para>
73608 </section>
73609 <section id="SECThindatmai">
73610 <title>Hints database maintenance</title>
73611 <para>
73612 <indexterm role="concept">
73613 <primary>hints database</primary>
73614 <secondary>maintenance</secondary>
73615 </indexterm>
73616 <indexterm role="concept">
73617 <primary>maintaining Exim&#x2019;s hints database</primary>
73618 </indexterm>
73619 Three utility programs are provided for maintaining the DBM files that Exim
73620 uses to contain its delivery hint information. Each program requires two
73621 arguments. The first specifies the name of Exim&#x2019;s spool directory, and the
73622 second is the name of the database it is to operate on. These are as follows:
73623 </para>
73624 <itemizedlist>
73625 <listitem>
73626 <para>
73627 <emphasis>retry</emphasis>: the database of retry information
73628 </para>
73629 </listitem>
73630 <listitem>
73631 <para>
73632 <emphasis>wait-</emphasis>&lt;<emphasis>transport name</emphasis>&gt;: databases of information about messages waiting
73633 for remote hosts
73634 </para>
73635 </listitem>
73636 <listitem>
73637 <para>
73638 <emphasis>callout</emphasis>: the callout cache
73639 </para>
73640 </listitem>
73641 <listitem>
73642 <para>
73643 <emphasis>ratelimit</emphasis>: the data for implementing the ratelimit ACL condition
73644 </para>
73645 </listitem>
73646 <listitem>
73647 <para>
73648 <emphasis>tls</emphasis>: TLS session resumption data
73649 </para>
73650 </listitem>
73651 <listitem>
73652 <para>
73653 <emphasis>misc</emphasis>: other hints data
73654 </para>
73655 </listitem>
73656 </itemizedlist>
73657 <para>
73658 The <emphasis>misc</emphasis> database is used for
73659 </para>
73660 <itemizedlist>
73661 <listitem>
73662 <para>
73663 Serializing ETRN runs (when <option>smtp_etrn_serialize</option> is set)
73664 </para>
73665 </listitem>
73666 <listitem>
73667 <para>
73668 Serializing delivery to a specific host (when <option>serialize_hosts</option> is set in an
73669 <command>smtp</command> transport)
73670 </para>
73671 </listitem>
73672 <listitem>
73673 <para>
73674 Limiting the concurrency of specific transports (when <option>max_parallel</option> is set
73675 in a transport)
73676 </para>
73677 </listitem>
73678 </itemizedlist>
73679 </section>
73680 <section id="SECTdumpdb">
73681 <title>exim_dumpdb</title>
73682 <para>
73683 <indexterm role="concept">
73684 <primary><emphasis>exim_dumpdb</emphasis></primary>
73685 </indexterm>
73686 The entire contents of a database are written to the standard output by the
73687 <emphasis>exim_dumpdb</emphasis> program,
73688 </para>
73689 <para revisionflag="changed">
73690 taking as arguments the spool and database names.
73691 An option <emphasis>-z</emphasis> may be given to request times in UTC;
73692 otherwise times are in the local timezone.
73693 An option <emphasis>-k</emphasis> may be given to dump only the record keys.
73694 </para>
73695 <para>
73696 For example, to dump the retry database:
73697 </para>
73698 <literallayout class="monospaced">
73699 exim_dumpdb /var/spool/exim retry
73700 </literallayout>
73701 <para>
73702 For the retry database
73703 two lines of output are produced for each entry:
73704 </para>
73705 <literallayout class="monospaced">
73706 T:mail.ref.example:192.168.242.242 146 77 Connection refused
73707 31-Oct-1995 12:00:12 02-Nov-1995 12:21:39 02-Nov-1995 20:21:39 *
73708 </literallayout>
73709 <para>
73710 The first item on the first line is the key of the record. It starts with one
73711 of the letters R, or T, depending on whether it refers to a routing or
73712 transport retry. For a local delivery, the next part is the local address; for
73713 a remote delivery it is the name of the remote host, followed by its failing IP
73714 address (unless <option>retry_include_ip_address</option> is set false on the <command>smtp</command>
73715 transport). If the remote port is not the standard one (port 25), it is added
73716 to the IP address. Then there follows an error code, an additional error code,
73717 and a textual description of the error.
73718 </para>
73719 <para>
73720 The three times on the second line are the time of first failure, the time of
73721 the last delivery attempt, and the computed time for the next attempt. The line
73722 ends with an asterisk if the cutoff time for the last retry rule has been
73723 exceeded.
73724 </para>
73725 <para>
73726 Each output line from <emphasis>exim_dumpdb</emphasis> for the <emphasis>wait-xxx</emphasis> databases
73727 consists of a host name followed by a list of ids for messages that are or were
73728 waiting to be delivered to that host. If there are a very large number for any
73729 one host, continuation records, with a sequence number added to the host name,
73730 may be seen. The data in these records is often out of date, because a message
73731 may be routed to several alternative hosts, and Exim makes no effort to keep
73732 cross-references.
73733 </para>
73734 </section>
73735 <section id="SECTtidydb">
73736 <title>exim_tidydb</title>
73737 <para>
73738 <indexterm role="concept">
73739 <primary><emphasis>exim_tidydb</emphasis></primary>
73740 </indexterm>
73741 The <emphasis>exim_tidydb</emphasis> utility program is used to tidy up the contents of a hints
73742 database. If run with no options, it removes all records that are more than 30
73743 days old. The age is calculated from the date and time that the record was last
73744 updated. Note that, in the case of the retry database, it is <emphasis>not</emphasis> the time
73745 since the first delivery failure. Information about a host that has been down
73746 for more than 30 days will remain in the database, provided that the record is
73747 updated sufficiently often.
73748 </para>
73749 <para>
73750 The cutoff date can be altered by means of the <option>-t</option> option, which must be
73751 followed by a time. For example, to remove all records older than a week from
73752 the retry database:
73753 </para>
73754 <literallayout class="monospaced">
73755 exim_tidydb -t 7d /var/spool/exim retry
73756 </literallayout>
73757 <para>
73758 Both the <emphasis>wait-xxx</emphasis> and <emphasis>retry</emphasis> databases contain items that involve
73759 message ids. In the former these appear as data in records keyed by host &ndash;
73760 they were messages that were waiting for that host &ndash; and in the latter they
73761 are the keys for retry information for messages that have suffered certain
73762 types of error. When <emphasis>exim_tidydb</emphasis> is run, a check is made to ensure that
73763 message ids in database records are those of messages that are still on the
73764 queue. Message ids for messages that no longer exist are removed from
73765 <emphasis>wait-xxx</emphasis> records, and if this leaves any records empty, they are deleted.
73766 For the <emphasis>retry</emphasis> database, records whose keys are non-existent message ids are
73767 removed. The <emphasis>exim_tidydb</emphasis> utility outputs comments on the standard output
73768 whenever it removes information from the database.
73769 </para>
73770 <para>
73771 Certain records are automatically removed by Exim when they are no longer
73772 needed, but others are not. For example, if all the MX hosts for a domain are
73773 down, a retry record is created for each one. If the primary MX host comes back
73774 first, its record is removed when Exim successfully delivers to it, but the
73775 records for the others remain because Exim has not tried to use those hosts.
73776 </para>
73777 <para>
73778 It is important, therefore, to run <emphasis>exim_tidydb</emphasis> periodically on all the
73779 hints databases. You should do this at a quiet time of day, because it requires
73780 a database to be locked (and therefore inaccessible to Exim) while it does its
73781 work. Removing records from a DBM file does not normally make the file smaller,
73782 but all the common DBM libraries are able to re-use the space that is released.
73783 After an initial phase of increasing in size, the databases normally reach a
73784 point at which they no longer get any bigger, as long as they are regularly
73785 tidied.
73786 </para>
73787 <para>
73788 <emphasis role="bold">Warning</emphasis>: If you never run <emphasis>exim_tidydb</emphasis>, the space used by the hints
73789 databases is likely to keep on increasing.
73790 </para>
73791 </section>
73792 <section id="SECTfixdb">
73793 <title>exim_fixdb</title>
73794 <para>
73795 <indexterm role="concept">
73796 <primary><emphasis>exim_fixdb</emphasis></primary>
73797 </indexterm>
73798 The <emphasis>exim_fixdb</emphasis> program is a utility for interactively modifying databases.
73799 Its main use is for testing Exim, but it might also be occasionally useful for
73800 getting round problems in a live system. Its interface
73801 is somewhat crude. On entry, it prompts for input with a right angle-bracket. A
73802 key of a database record can then be entered, and the data for that record is
73803 displayed.
73804 </para>
73805 <para>
73806 If <quote>d</quote> is typed at the next prompt, the entire record is deleted. For all
73807 except the <emphasis>retry</emphasis> database, that is the only operation that can be carried
73808 out. For the <emphasis>retry</emphasis> database, each field is output preceded by a number, and
73809 data for individual fields can be changed by typing the field number followed
73810 by new data, for example:
73811 </para>
73812 <literallayout class="monospaced">
73813 &gt; 4 951102:1000
73814 </literallayout>
73815 <para>
73816 resets the time of the next delivery attempt. Time values are given as a
73817 sequence of digit pairs for year, month, day, hour, and minute. Colons can be
73818 used as optional separators.
73819 </para>
73820 <para revisionflag="changed">
73821 Both displayed and input times are in the local timezone by default.
73822 If an option <emphasis>-z</emphasis> is used on the command line, displayed times
73823 are in UTC.
73824 </para>
73825 </section>
73826 <section id="SECTmailboxmaint">
73827 <title>Mailbox maintenance (exim_lock)</title>
73828 <para>
73829 <indexterm role="concept">
73830 <primary>mailbox</primary>
73831 <secondary>maintenance</secondary>
73832 </indexterm>
73833 <indexterm role="concept">
73834 <primary><emphasis>exim_lock</emphasis></primary>
73835 </indexterm>
73836 <indexterm role="concept">
73837 <primary>locking mailboxes</primary>
73838 </indexterm>
73839 The <emphasis>exim_lock</emphasis> utility locks a mailbox file using the same algorithm as
73840 Exim. For a discussion of locking issues, see section <xref linkend="SECTopappend"/>.
73841 <emphasis>Exim_lock</emphasis> can be used to prevent any modification of a mailbox by Exim or
73842 a user agent while investigating a problem. The utility requires the name of
73843 the file as its first argument. If the locking is successful, the second
73844 argument is run as a command (using C&#x2019;s <function>system()</function> function); if there is no
73845 second argument, the value of the SHELL environment variable is used; if this
73846 is unset or empty, <filename>/bin/sh</filename> is run. When the command finishes, the mailbox
73847 is unlocked and the utility ends. The following options are available:
73848 </para>
73849 <variablelist>
73850 <varlistentry>
73851 <term><option>-fcntl</option></term>
73852 <listitem>
73853 <para>
73854 Use <function>fcntl()</function> locking on the open mailbox.
73855 </para>
73856 </listitem></varlistentry>
73857 <varlistentry>
73858 <term><option>-flock</option></term>
73859 <listitem>
73860 <para>
73861 Use <function>flock()</function> locking on the open mailbox, provided the operating system
73862 supports it.
73863 </para>
73864 </listitem></varlistentry>
73865 <varlistentry>
73866 <term><option>-interval</option></term>
73867 <listitem>
73868 <para>
73869 This must be followed by a number, which is a number of seconds; it sets the
73870 interval to sleep between retries (default 3).
73871 </para>
73872 </listitem></varlistentry>
73873 <varlistentry>
73874 <term><option>-lockfile</option></term>
73875 <listitem>
73876 <para>
73877 Create a lock file before opening the mailbox.
73878 </para>
73879 </listitem></varlistentry>
73880 <varlistentry>
73881 <term><option>-mbx</option></term>
73882 <listitem>
73883 <para>
73884 Lock the mailbox using MBX rules.
73885 </para>
73886 </listitem></varlistentry>
73887 <varlistentry>
73888 <term><option>-q</option></term>
73889 <listitem>
73890 <para>
73891 Suppress verification output.
73892 </para>
73893 </listitem></varlistentry>
73894 <varlistentry>
73895 <term><option>-retries</option></term>
73896 <listitem>
73897 <para>
73898 This must be followed by a number; it sets the number of times to try to get
73899 the lock (default 10).
73900 </para>
73901 </listitem></varlistentry>
73902 <varlistentry>
73903 <term><option>-restore_time</option></term>
73904 <listitem>
73905 <para>
73906 This option causes <option>exim_lock</option> to restore the modified and read times to the
73907 locked file before exiting. This allows you to access a locked mailbox (for
73908 example, to take a backup copy) without disturbing the times that the user
73909 subsequently sees.
73910 </para>
73911 </listitem></varlistentry>
73912 <varlistentry>
73913 <term><option>-timeout</option></term>
73914 <listitem>
73915 <para>
73916 This must be followed by a number, which is a number of seconds; it sets a
73917 timeout to be used with a blocking <function>fcntl()</function> lock. If it is not set (the
73918 default), a non-blocking call is used.
73919 </para>
73920 </listitem></varlistentry>
73921 <varlistentry>
73922 <term><option>-v</option></term>
73923 <listitem>
73924 <para>
73925 Generate verbose output.
73926 </para>
73927 </listitem></varlistentry>
73928 </variablelist>
73929 <para>
73930 If none of <option>-fcntl</option>, <option>-flock</option>, <option>-lockfile</option> or <option>-mbx</option> are given, the
73931 default is to create a lock file and also to use <function>fcntl()</function> locking on the
73932 mailbox, which is the same as Exim&#x2019;s default. The use of <option>-flock</option> or
73933 <option>-fcntl</option> requires that the file be writeable; the use of <option>-lockfile</option>
73934 requires that the directory containing the file be writeable. Locking by lock
73935 file does not last forever; Exim assumes that a lock file is expired if it is
73936 more than 30 minutes old.
73937 </para>
73938 <para>
73939 The <option>-mbx</option> option can be used with either or both of <option>-fcntl</option> or
73940 <option>-flock</option>. It assumes <option>-fcntl</option> by default. MBX locking causes a shared lock
73941 to be taken out on the open mailbox, and an exclusive lock on the file
73942 <filename>/tmp/.n.m</filename> where <emphasis>n</emphasis> and <emphasis>m</emphasis> are the device number and inode
73943 number of the mailbox file. When the locking is released, if an exclusive lock
73944 can be obtained for the mailbox, the file in <filename>/tmp</filename> is deleted.
73945 </para>
73946 <para>
73947 The default output contains verification of the locking that takes place. The
73948 <option>-v</option> option causes some additional information to be given. The <option>-q</option> option
73949 suppresses all output except error messages.
73950 </para>
73951 <para>
73952 A command such as
73953 </para>
73954 <literallayout class="monospaced">
73955 exim_lock /var/spool/mail/spqr
73956 </literallayout>
73957 <para>
73958 runs an interactive shell while the file is locked, whereas
73959 </para>
73960 <literallayout>
73961 <literal>exim_lock -q /var/spool/mail/spqr &lt;&lt;End</literal>
73962 &lt;<emphasis>some commands</emphasis>&gt;
73963 <literal>End</literal>
73964 </literallayout>
73965 <para>
73966 runs a specific non-interactive sequence of commands while the file is locked,
73967 suppressing all verification output. A single command can be run by a command
73968 such as
73969 </para>
73970 <literallayout class="monospaced">
73971 exim_lock -q /var/spool/mail/spqr \
73972   "cp /var/spool/mail/spqr /some/where"
73973 </literallayout>
73974 <para>
73975 Note that if a command is supplied, it must be entirely contained within the
73976 second argument &ndash; hence the quotes.
73977 <indexterm role="concept" startref="IIDutils" class="endofrange"/>
73978 </para>
73979 </section>
73980 </chapter>
73981
73982 <chapter id="CHAPeximon">
73983 <title>The Exim monitor</title>
73984 <para>
73985 <indexterm role="concept" id="IIDeximon" class="startofrange">
73986 <primary>Exim monitor</primary>
73987 <secondary>description</secondary>
73988 </indexterm>
73989 <indexterm role="concept">
73990 <primary>X-windows</primary>
73991 </indexterm>
73992 <indexterm role="concept">
73993 <primary><emphasis>eximon</emphasis></primary>
73994 </indexterm>
73995 <indexterm role="concept">
73996 <primary>Local/eximon.conf</primary>
73997 </indexterm>
73998 <indexterm role="concept">
73999 <primary><filename>exim_monitor/EDITME</filename></primary>
74000 </indexterm>
74001 The Exim monitor is an application which displays in an X window information
74002 about the state of Exim&#x2019;s queue and what Exim is doing. An admin user can
74003 perform certain operations on messages from this GUI interface; however all
74004 such facilities are also available from the command line, and indeed, the
74005 monitor itself makes use of the command line to perform any actions requested.
74006 </para>
74007 <section id="SECID264">
74008 <title>Running the monitor</title>
74009 <para>
74010 The monitor is started by running the script called <emphasis>eximon</emphasis>. This is a shell
74011 script that sets up a number of environment variables, and then runs the
74012 binary called <filename>eximon.bin</filename>. The default appearance of the monitor window can
74013 be changed by editing the <filename>Local/eximon.conf</filename> file created by editing
74014 <filename>exim_monitor/EDITME</filename>. Comments in that file describe what the various
74015 parameters are for.
74016 </para>
74017 <para>
74018 The parameters that get built into the <emphasis>eximon</emphasis> script can be overridden for
74019 a particular invocation by setting up environment variables of the same names,
74020 preceded by <literal>EXIMON_</literal>. For example, a shell command such as
74021 </para>
74022 <literallayout class="monospaced">
74023 EXIMON_LOG_DEPTH=400 eximon
74024 </literallayout>
74025 <para>
74026 (in a Bourne-compatible shell) runs <emphasis>eximon</emphasis> with an overriding setting of
74027 the LOG_DEPTH parameter. If EXIMON_LOG_FILE_PATH is set in the environment, it
74028 overrides the Exim log file configuration. This makes it possible to have
74029 <emphasis>eximon</emphasis> tailing log data that is written to syslog, provided that MAIL.INFO
74030 syslog messages are routed to a file on the local host.
74031 </para>
74032 <para>
74033 X resources can be used to change the appearance of the window in the normal
74034 way. For example, a resource setting of the form
74035 </para>
74036 <literallayout class="monospaced">
74037 Eximon*background: gray94
74038 </literallayout>
74039 <para>
74040 changes the colour of the background to light grey rather than white. The
74041 stripcharts are drawn with both the data lines and the reference lines in
74042 black. This means that the reference lines are not visible when on top of the
74043 data. However, their colour can be changed by setting a resource called
74044 <quote>highlight</quote> (an odd name, but that&#x2019;s what the Athena stripchart widget uses).
74045 For example, if your X server is running Unix, you could set up lighter
74046 reference lines in the stripcharts by obeying
74047 </para>
74048 <literallayout class="monospaced">
74049 xrdb -merge &lt;&lt;End
74050 Eximon*highlight: gray
74051 End
74052 </literallayout>
74053 <para>
74054 <indexterm role="concept">
74055 <primary>admin user</primary>
74056 </indexterm>
74057 In order to see the contents of messages in the queue, and to operate on them,
74058 <emphasis>eximon</emphasis> must either be run as root or by an admin user.
74059 </para>
74060 <para>
74061 The command-line parameters of <emphasis>eximon</emphasis> are passed to <filename>eximon.bin</filename> and may
74062 contain X11 resource parameters interpreted by the X11 library.  In addition,
74063 if the first parameter starts with the string "gdb" then it is removed and the
74064 binary is invoked under gdb (the parameter is used as the gdb command-name, so
74065 versioned variants of gdb can be invoked).
74066 </para>
74067 <para>
74068 The monitor&#x2019;s window is divided into three parts. The first contains one or
74069 more stripcharts and two action buttons, the second contains a <quote>tail</quote> of the
74070 main log file, and the third is a display of the queue of messages awaiting
74071 delivery, with two more action buttons. The following sections describe these
74072 different parts of the display.
74073 </para>
74074 </section>
74075 <section id="SECID265">
74076 <title>The stripcharts</title>
74077 <para>
74078 <indexterm role="concept">
74079 <primary>stripchart</primary>
74080 </indexterm>
74081 The first stripchart is always a count of messages in the queue. Its name can
74082 be configured by setting QUEUE_STRIPCHART_NAME in the
74083 <filename>Local/eximon.conf</filename> file. The remaining stripcharts are defined in the
74084 configuration script by regular expression matches on log file entries, making
74085 it possible to display, for example, counts of messages delivered to certain
74086 hosts or using certain transports. The supplied defaults display counts of
74087 received and delivered messages, and of local and SMTP deliveries. The default
74088 period between stripchart updates is one minute; this can be adjusted by a
74089 parameter in the <filename>Local/eximon.conf</filename> file.
74090 </para>
74091 <para>
74092 The stripchart displays rescale themselves automatically as the value they are
74093 displaying changes. There are always 10 horizontal lines in each chart; the
74094 title string indicates the value of each division when it is greater than one.
74095 For example, <quote>x2</quote> means that each division represents a value of 2.
74096 </para>
74097 <para>
74098 It is also possible to have a stripchart which shows the percentage fullness of
74099 a particular disk partition, which is useful when local deliveries are confined
74100 to a single partition.
74101 </para>
74102 <para>
74103 <indexterm role="concept">
74104 <primary><option>statvfs</option> function</primary>
74105 </indexterm>
74106 This relies on the availability of the <function>statvfs()</function> function or equivalent in
74107 the operating system. Most, but not all versions of Unix that support Exim have
74108 this. For this particular stripchart, the top of the chart always represents
74109 100%, and the scale is given as <quote>x10%</quote>. This chart is configured by setting
74110 SIZE_STRIPCHART and (optionally) SIZE_STRIPCHART_NAME in the
74111 <filename>Local/eximon.conf</filename> file.
74112 </para>
74113 </section>
74114 <section id="SECID266">
74115 <title>Main action buttons</title>
74116 <para>
74117 <indexterm role="concept">
74118 <primary>size</primary>
74119 <secondary>of monitor window</secondary>
74120 </indexterm>
74121 <indexterm role="concept">
74122 <primary>Exim monitor</primary>
74123 <secondary>window size</secondary>
74124 </indexterm>
74125 <indexterm role="concept">
74126 <primary>window size</primary>
74127 </indexterm>
74128 Below the stripcharts there is an action button for quitting the monitor. Next
74129 to this is another button marked <quote>Size</quote>. They are placed here so that
74130 shrinking the window to its default minimum size leaves just the queue count
74131 stripchart and these two buttons visible. Pressing the <quote>Size</quote> button causes
74132 the window to expand to its maximum size, unless it is already at the maximum,
74133 in which case it is reduced to its minimum.
74134 </para>
74135 <para>
74136 When expanding to the maximum, if the window cannot be fully seen where it
74137 currently is, it is moved back to where it was the last time it was at full
74138 size. When it is expanding from its minimum size, the old position is
74139 remembered, and next time it is reduced to the minimum it is moved back there.
74140 </para>
74141 <para>
74142 The idea is that you can keep a reduced window just showing one or two
74143 stripcharts at a convenient place on your screen, easily expand it to show
74144 the full window when required, and just as easily put it back to what it was.
74145 The idea is copied from what the <emphasis>twm</emphasis> window manager does for its
74146 <emphasis>f.fullzoom</emphasis> action. The minimum size of the window can be changed by setting
74147 the MIN_HEIGHT and MIN_WIDTH values in <filename>Local/eximon.conf</filename>.
74148 </para>
74149 <para>
74150 Normally, the monitor starts up with the window at its full size, but it can be
74151 built so that it starts up with the window at its smallest size, by setting
74152 START_SMALL=yes in <filename>Local/eximon.conf</filename>.
74153 </para>
74154 </section>
74155 <section id="SECID267">
74156 <title>The log display</title>
74157 <para>
74158 <indexterm role="concept">
74159 <primary>log</primary>
74160 <secondary>tail of; in monitor</secondary>
74161 </indexterm>
74162 The second section of the window is an area in which a display of the tail of
74163 the main log is maintained.
74164 To save space on the screen, the timestamp on each log line is shortened by
74165 removing the date and, if <option>log_timezone</option> is set, the timezone.
74166 The log tail is not available when the only destination for logging data is
74167 syslog, unless the syslog lines are routed to a local file whose name is passed
74168 to <emphasis>eximon</emphasis> via the EXIMON_LOG_FILE_PATH environment variable.
74169 </para>
74170 <para>
74171 The log sub-window has a scroll bar at its lefthand side which can be used to
74172 move back to look at earlier text, and the up and down arrow keys also have a
74173 scrolling effect. The amount of log that is kept depends on the setting of
74174 LOG_BUFFER in <filename>Local/eximon.conf</filename>, which specifies the amount of memory
74175 to use. When this is full, the earlier 50% of data is discarded &ndash; this is
74176 much more efficient than throwing it away line by line. The sub-window also has
74177 a horizontal scroll bar for accessing the ends of long log lines. This is the
74178 only means of horizontal scrolling; the right and left arrow keys are not
74179 available. Text can be cut from this part of the window using the mouse in the
74180 normal way. The size of this subwindow is controlled by parameters in the
74181 configuration file <filename>Local/eximon.conf</filename>.
74182 </para>
74183 <para>
74184 Searches of the text in the log window can be carried out by means of the ^R
74185 and ^S keystrokes, which default to a reverse and a forward search,
74186 respectively. The search covers only the text that is displayed in the window.
74187 It cannot go further back up the log.
74188 </para>
74189 <para>
74190 The point from which the search starts is indicated by a caret marker. This is
74191 normally at the end of the text in the window, but can be positioned explicitly
74192 by pointing and clicking with the left mouse button, and is moved automatically
74193 by a successful search. If new text arrives in the window when it is scrolled
74194 back, the caret remains where it is, but if the window is not scrolled back,
74195 the caret is moved to the end of the new text.
74196 </para>
74197 <para>
74198 Pressing ^R or ^S pops up a window into which the search text can be typed.
74199 There are buttons for selecting forward or reverse searching, for carrying out
74200 the search, and for cancelling. If the <quote>Search</quote> button is pressed, the search
74201 happens and the window remains so that further searches can be done. If the
74202 <quote>Return</quote> key is pressed, a single search is done and the window is closed. If
74203 ^C is typed the search is cancelled.
74204 </para>
74205 <para>
74206 The searching facility is implemented using the facilities of the Athena text
74207 widget. By default this pops up a window containing both <quote>search</quote> and
74208 <quote>replace</quote> options. In order to suppress the unwanted <quote>replace</quote> portion for
74209 eximon, a modified version of the <option>TextPop</option> widget is distributed with Exim.
74210 However, the linkers in BSDI and HP-UX seem unable to handle an externally
74211 provided version of <option>TextPop</option> when the remaining parts of the text widget
74212 come from the standard libraries. The compile-time option EXIMON_TEXTPOP can be
74213 unset to cut out the modified <option>TextPop</option>, making it possible to build Eximon
74214 on these systems, at the expense of having unwanted items in the search popup
74215 window.
74216 </para>
74217 </section>
74218 <section id="SECID268">
74219 <title>The queue display</title>
74220 <para>
74221 <indexterm role="concept">
74222 <primary>queue</primary>
74223 <secondary>display in monitor</secondary>
74224 </indexterm>
74225 The bottom section of the monitor window contains a list of all messages that
74226 are in the queue, which includes those currently being received or delivered,
74227 as well as those awaiting delivery. The size of this subwindow is controlled by
74228 parameters in the configuration file <filename>Local/eximon.conf</filename>, and the frequency
74229 at which it is updated is controlled by another parameter in the same file &ndash;
74230 the default is 5 minutes, since queue scans can be quite expensive. However,
74231 there is an <quote>Update</quote> action button just above the display which can be used
74232 to force an update of the queue display at any time.
74233 </para>
74234 <para>
74235 When a host is down for some time, a lot of pending mail can build up for it,
74236 and this can make it hard to deal with other messages in the queue. To help
74237 with this situation there is a button next to <quote>Update</quote> called <quote>Hide</quote>. If
74238 pressed, a dialogue box called <quote>Hide addresses ending with</quote> is put up. If you
74239 type anything in here and press <quote>Return</quote>, the text is added to a chain of
74240 such texts, and if every undelivered address in a message matches at least one
74241 of the texts, the message is not displayed.
74242 </para>
74243 <para>
74244 If there is an address that does not match any of the texts, all the addresses
74245 are displayed as normal. The matching happens on the ends of addresses so, for
74246 example, <emphasis>cam.ac.uk</emphasis> specifies all addresses in Cambridge, while
74247 <emphasis>xxx@foo.com.example</emphasis> specifies just one specific address. When any hiding
74248 has been set up, a button called <quote>Unhide</quote> is displayed. If pressed, it
74249 cancels all hiding. Also, to ensure that hidden messages do not get forgotten,
74250 a hide request is automatically cancelled after one hour.
74251 </para>
74252 <para>
74253 While the dialogue box is displayed, you can&#x2019;t press any buttons or do anything
74254 else to the monitor window. For this reason, if you want to cut text from the
74255 queue display to use in the dialogue box, you have to do the cutting before
74256 pressing the <quote>Hide</quote> button.
74257 </para>
74258 <para>
74259 The queue display contains, for each unhidden queued message, the length of
74260 time it has been in the queue, the size of the message, the message id, the
74261 message sender, and the first undelivered recipient, all on one line. If it is
74262 a bounce message, the sender is shown as <quote>&lt;&gt;</quote>. If there is more than one
74263 recipient to which the message has not yet been delivered, subsequent ones are
74264 listed on additional lines, up to a maximum configured number, following which
74265 an ellipsis is displayed. Recipients that have already received the message are
74266 not shown.
74267 </para>
74268 <para>
74269 <indexterm role="concept">
74270 <primary>frozen messages</primary>
74271 <secondary>display</secondary>
74272 </indexterm>
74273 If a message is frozen, an asterisk is displayed at the left-hand side.
74274 </para>
74275 <para>
74276 The queue display has a vertical scroll bar, and can also be scrolled by means
74277 of the arrow keys. Text can be cut from it using the mouse in the normal way.
74278 The text searching facilities, as described above for the log window, are also
74279 available, but the caret is always moved to the end of the text when the queue
74280 display is updated.
74281 </para>
74282 </section>
74283 <section id="SECID269">
74284 <title>The queue menu</title>
74285 <para>
74286 <indexterm role="concept">
74287 <primary>queue</primary>
74288 <secondary>menu in monitor</secondary>
74289 </indexterm>
74290 If the <option>shift</option> key is held down and the left button is clicked when the mouse
74291 pointer is over the text for any message, an action menu pops up, and the first
74292 line of the queue display for the message is highlighted. This does not affect
74293 any selected text.
74294 </para>
74295 <para>
74296 If you want to use some other event for popping up the menu, you can set the
74297 MENU_EVENT parameter in <filename>Local/eximon.conf</filename> to change the default, or
74298 set EXIMON_MENU_EVENT in the environment before starting the monitor. The
74299 value set in this parameter is a standard X event description. For example, to
74300 run eximon using <option>ctrl</option> rather than <option>shift</option> you could use
74301 </para>
74302 <literallayout class="monospaced">
74303 EXIMON_MENU_EVENT='Ctrl&lt;Btn1Down&gt;' eximon
74304 </literallayout>
74305 <para>
74306 The title of the menu is the message id, and it contains entries which act as
74307 follows:
74308 </para>
74309 <itemizedlist>
74310 <listitem>
74311 <para>
74312 <emphasis>message log</emphasis>: The contents of the message log for the message are displayed
74313 in a new text window.
74314 </para>
74315 </listitem>
74316 <listitem>
74317 <para>
74318 <emphasis>headers</emphasis>: Information from the spool file that contains the envelope
74319 information and headers is displayed in a new text window. See chapter
74320 <xref linkend="CHAPspool"/> for a description of the format of spool files.
74321 </para>
74322 </listitem>
74323 <listitem>
74324 <para>
74325 <emphasis>body</emphasis>: The contents of the spool file containing the body of the message are
74326 displayed in a new text window. There is a default limit of 20,000 bytes to the
74327 amount of data displayed. This can be changed by setting the BODY_MAX
74328 option at compile time, or the EXIMON_BODY_MAX option at runtime.
74329 </para>
74330 </listitem>
74331 <listitem>
74332 <para>
74333 <emphasis>deliver message</emphasis>: A call to Exim is made using the <option>-M</option> option to request
74334 delivery of the message. This causes an automatic thaw if the message is
74335 frozen. The <option>-v</option> option is also set, and the output from Exim is displayed in
74336 a new text window. The delivery is run in a separate process, to avoid holding
74337 up the monitor while the delivery proceeds.
74338 </para>
74339 </listitem>
74340 <listitem>
74341 <para>
74342 <emphasis>freeze message</emphasis>: A call to Exim is made using the <option>-Mf</option> option to request
74343 that the message be frozen.
74344 </para>
74345 </listitem>
74346 <listitem>
74347 <para>
74348 <indexterm role="concept">
74349 <primary>thawing messages</primary>
74350 </indexterm>
74351 <indexterm role="concept">
74352 <primary>unfreezing messages</primary>
74353 </indexterm>
74354 <indexterm role="concept">
74355 <primary>frozen messages</primary>
74356 <secondary>thawing</secondary>
74357 </indexterm>
74358 <emphasis>thaw message</emphasis>: A call to Exim is made using the <option>-Mt</option> option to request
74359 that the message be thawed.
74360 </para>
74361 </listitem>
74362 <listitem>
74363 <para>
74364 <indexterm role="concept">
74365 <primary>delivery</primary>
74366 <secondary>forcing failure</secondary>
74367 </indexterm>
74368 <emphasis>give up on msg</emphasis>: A call to Exim is made using the <option>-Mg</option> option to request
74369 that Exim gives up trying to deliver the message. A bounce message is generated
74370 for any remaining undelivered addresses.
74371 </para>
74372 </listitem>
74373 <listitem>
74374 <para>
74375 <emphasis>remove message</emphasis>: A call to Exim is made using the <option>-Mrm</option> option to request
74376 that the message be deleted from the system without generating a bounce
74377 message.
74378 </para>
74379 </listitem>
74380 <listitem>
74381 <para>
74382 <emphasis>add recipient</emphasis>: A dialog box is displayed into which a recipient address can
74383 be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
74384 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
74385 Otherwise it must be entered as a fully qualified address. Pressing RETURN
74386 causes a call to Exim to be made using the <option>-Mar</option> option to request that an
74387 additional recipient be added to the message, unless the entry box is empty, in
74388 which case no action is taken.
74389 </para>
74390 </listitem>
74391 <listitem>
74392 <para>
74393 <emphasis>mark delivered</emphasis>: A dialog box is displayed into which a recipient address
74394 can be typed. If the address is not qualified and the QUALIFY_DOMAIN parameter
74395 is set in <filename>Local/eximon.conf</filename>, the address is qualified with that domain.
74396 Otherwise it must be entered as a fully qualified address. Pressing RETURN
74397 causes a call to Exim to be made using the <option>-Mmd</option> option to mark the given
74398 recipient address as already delivered, unless the entry box is empty, in which
74399 case no action is taken.
74400 </para>
74401 </listitem>
74402 <listitem>
74403 <para>
74404 <emphasis>mark all delivered</emphasis>: A call to Exim is made using the <option>-Mmad</option> option to
74405 mark all recipient addresses as already delivered.
74406 </para>
74407 </listitem>
74408 <listitem>
74409 <para>
74410 <emphasis>edit sender</emphasis>: A dialog box is displayed initialized with the current
74411 sender&#x2019;s address. Pressing RETURN causes a call to Exim to be made using the
74412 <option>-Mes</option> option to replace the sender address, unless the entry box is empty,
74413 in which case no action is taken. If you want to set an empty sender (as in
74414 bounce messages), you must specify it as <quote>&lt;&gt;</quote>. Otherwise, if the address is
74415 not qualified and the QUALIFY_DOMAIN parameter is set in <filename>Local/eximon.conf</filename>,
74416 the address is qualified with that domain.
74417 </para>
74418 </listitem>
74419 </itemizedlist>
74420 <para>
74421 When a delivery is forced, a window showing the <option>-v</option> output is displayed. In
74422 other cases when a call to Exim is made, if there is any output from Exim (in
74423 particular, if the command fails) a window containing the command and the
74424 output is displayed. Otherwise, the results of the action are normally apparent
74425 from the log and queue displays. However, if you set ACTION_OUTPUT=yes in
74426 <filename>Local/eximon.conf</filename>, a window showing the Exim command is always opened, even
74427 if no output is generated.
74428 </para>
74429 <para>
74430 The queue display is automatically updated for actions such as freezing and
74431 thawing, unless ACTION_QUEUE_UPDATE=no has been set in
74432 <filename>Local/eximon.conf</filename>. In this case the <quote>Update</quote> button has to be used to
74433 force an update of the display after one of these actions.
74434 </para>
74435 <para>
74436 In any text window that is displayed as result of a menu action, the normal
74437 cut-and-paste facility is available, and searching can be carried out using ^R
74438 and ^S, as described above for the log tail window.
74439 <indexterm role="concept" startref="IIDeximon" class="endofrange"/>
74440 </para>
74441 </section>
74442 </chapter>
74443
74444 <chapter id="CHAPsecurity">
74445 <title>Security considerations</title>
74446 <para>
74447 <indexterm role="concept" id="IIDsecurcon" class="startofrange">
74448 <primary>security</primary>
74449 <secondary>discussion of</secondary>
74450 </indexterm>
74451 This chapter discusses a number of issues concerned with security, some of
74452 which are also covered in other parts of this manual.
74453 </para>
74454 <para>
74455 For reasons that this author does not understand, some people have promoted
74456 Exim as a <quote>particularly secure</quote> mailer. Perhaps it is because of the
74457 existence of this chapter in the documentation. However, the intent of the
74458 chapter is simply to describe the way Exim works in relation to certain
74459 security concerns, not to make any specific claims about the effectiveness of
74460 its security as compared with other MTAs.
74461 </para>
74462 <para>
74463 What follows is a description of the way Exim is supposed to be. Best efforts
74464 have been made to try to ensure that the code agrees with the theory, but an
74465 absence of bugs can never be guaranteed. Any that are reported will get fixed
74466 as soon as possible.
74467 </para>
74468 <section id="SECID286">
74469 <title>Building a more <quote>hardened</quote> Exim</title>
74470 <para>
74471 <indexterm role="concept">
74472 <primary>security</primary>
74473 <secondary>build-time features</secondary>
74474 </indexterm>
74475 There are a number of build-time options that can be set in <filename>Local/Makefile</filename>
74476 to create Exim binaries that are <quote>harder</quote> to attack, in particular by a rogue
74477 Exim administrator who does not have the root password, or by someone who has
74478 penetrated the Exim (but not the root) account. These options are as follows:
74479 </para>
74480 <itemizedlist>
74481 <listitem>
74482 <para>
74483 ALT_CONFIG_PREFIX can be set to a string that is required to match the
74484 start of any filenames used with the <option>-C</option> option. When it is set, these
74485 filenames are also not allowed to contain the sequence <quote>/../</quote>. (However, if
74486 the value of the <option>-C</option> option is identical to the value of CONFIGURE_FILE in
74487 <filename>Local/Makefile</filename>, Exim ignores <option>-C</option> and proceeds as usual.) There is no
74488 default setting for <option>ALT_CONFIG_PREFIX</option>.
74489 </para>
74490 <para>
74491 If the permitted configuration files are confined to a directory to
74492 which only root has access, this guards against someone who has broken
74493 into the Exim account from running a privileged Exim with an arbitrary
74494 configuration file, and using it to break into other accounts.
74495 </para>
74496 </listitem>
74497 <listitem>
74498 <para>
74499 If a non-trusted configuration file (i.e. not the default configuration file
74500 or one which is trusted by virtue of being listed in the TRUSTED_CONFIG_LIST
74501 file) is specified with <option>-C</option>, or if macros are given with <option>-D</option> (but see
74502 the next item), then root privilege is retained only if the caller of Exim is
74503 root. This locks out the possibility of testing a configuration using <option>-C</option>
74504 right through message reception and delivery, even if the caller is root. The
74505 reception works, but by that time, Exim is running as the Exim user, so when
74506 it re-execs to regain privilege for the delivery, the use of <option>-C</option> causes
74507 privilege to be lost. However, root can test reception and delivery using two
74508 separate commands.
74509 </para>
74510 </listitem>
74511 <listitem>
74512 <para>
74513 The WHITELIST_D_MACROS build option declares some macros to be safe to override
74514 with <option>-D</option> if the real uid is one of root, the Exim run-time user or the
74515 CONFIGURE_OWNER, if defined.  The potential impact of this option is limited by
74516 requiring the run-time value supplied to <option>-D</option> to match a regex that errs on
74517 the restrictive side.  Requiring build-time selection of safe macros is onerous
74518 but this option is intended solely as a transition mechanism to permit
74519 previously-working configurations to continue to work after release 4.73.
74520 </para>
74521 </listitem>
74522 <listitem>
74523 <para>
74524 If DISABLE_D_OPTION is defined, the use of the <option>-D</option> command line option
74525 is disabled.
74526 </para>
74527 </listitem>
74528 <listitem>
74529 <para>
74530 FIXED_NEVER_USERS can be set to a colon-separated list of users that are
74531 never to be used for any deliveries. This is like the <option>never_users</option> runtime
74532 option, but it cannot be overridden; the runtime option adds additional users
74533 to the list. The default setting is <quote>root</quote>; this prevents a non-root user who
74534 is permitted to modify the runtime file from using Exim as a way to get root.
74535 </para>
74536 </listitem>
74537 </itemizedlist>
74538 </section>
74539 <section id="SECID270">
74540 <title>Root privilege</title>
74541 <para>
74542 <indexterm role="concept">
74543 <primary>setuid</primary>
74544 </indexterm>
74545 <indexterm role="concept">
74546 <primary>root privilege</primary>
74547 </indexterm>
74548 The Exim binary is normally setuid to root, which means that it gains root
74549 privilege (runs as root) when it starts execution. In some special cases (for
74550 example, when the daemon is not in use and there are no local deliveries), it
74551 may be possible to run Exim setuid to some user other than root. This is
74552 discussed in the next section. However, in most installations, root privilege
74553 is required for two things:
74554 </para>
74555 <itemizedlist>
74556 <listitem>
74557 <para>
74558 To set up a socket connected to the standard SMTP port (25) when initialising
74559 the listening daemon. If Exim is run from <emphasis>inetd</emphasis>, this privileged action is
74560 not required.
74561 </para>
74562 </listitem>
74563 <listitem>
74564 <para>
74565 To be able to change uid and gid in order to read users&#x2019; <filename>.forward</filename> files and
74566 perform local deliveries as the receiving user or as specified in the
74567 configuration.
74568 </para>
74569 </listitem>
74570 </itemizedlist>
74571 <para>
74572 It is not necessary to be root to do any of the other things Exim does, such as
74573 receiving messages and delivering them externally over SMTP, and it is
74574 obviously more secure if Exim does not run as root except when necessary.
74575 For this reason, a user and group for Exim to use must be defined in
74576 <filename>Local/Makefile</filename>. These are known as <quote>the Exim user</quote> and <quote>the Exim
74577 group</quote>. Their values can be changed by the runtime configuration, though this
74578 is not recommended. Often a user called <emphasis>exim</emphasis> is used, but some sites use
74579 <emphasis>mail</emphasis> or another user name altogether.
74580 </para>
74581 <para>
74582 Exim uses <function>setuid()</function> whenever it gives up root privilege. This is a permanent
74583 abdication; the process cannot regain root afterwards. Prior to release 4.00,
74584 <function>seteuid()</function> was used in some circumstances, but this is no longer the case.
74585 </para>
74586 <para>
74587 After a new Exim process has interpreted its command line options, it changes
74588 uid and gid in the following cases:
74589 </para>
74590 <itemizedlist>
74591 <listitem>
74592 <para>
74593 <indexterm role="option">
74594 <primary><option>-C</option></primary>
74595 </indexterm>
74596 <indexterm role="option">
74597 <primary><option>-D</option></primary>
74598 </indexterm>
74599 If the <option>-C</option> option is used to specify an alternate configuration file, or if
74600 the <option>-D</option> option is used to define macro values for the configuration, and the
74601 calling process is not running as root, the uid and gid are changed to those of
74602 the calling process.
74603 However, if DISABLE_D_OPTION is defined in <filename>Local/Makefile</filename>, the <option>-D</option>
74604 option may not be used at all.
74605 If WHITELIST_D_MACROS is defined in <filename>Local/Makefile</filename>, then some macro values
74606 can be supplied if the calling process is running as root, the Exim run-time
74607 user or CONFIGURE_OWNER, if defined.
74608 </para>
74609 </listitem>
74610 <listitem>
74611 <para>
74612 <indexterm role="option">
74613 <primary><option>-be</option></primary>
74614 </indexterm>
74615 <indexterm role="option">
74616 <primary><option>-bf</option></primary>
74617 </indexterm>
74618 <indexterm role="option">
74619 <primary><option>-bF</option></primary>
74620 </indexterm>
74621 If the expansion test option (<option>-be</option>) or one of the filter testing options
74622 (<option>-bf</option> or <option>-bF</option>) are used, the uid and gid are changed to those of the
74623 calling process.
74624 </para>
74625 </listitem>
74626 <listitem>
74627 <para>
74628 If the process is not a daemon process or a queue runner process or a delivery
74629 process or a process for testing address routing (started with <option>-bt</option>), the
74630 uid and gid are changed to the Exim user and group. This means that Exim always
74631 runs under its own uid and gid when receiving messages. This also applies when
74632 testing address verification
74633 <indexterm role="option">
74634 <primary><option>-bv</option></primary>
74635 </indexterm>
74636 <indexterm role="option">
74637 <primary><option>-bh</option></primary>
74638 </indexterm>
74639 (the <option>-bv</option> option) and testing incoming message policy controls (the <option>-bh</option>
74640 option).
74641 </para>
74642 </listitem>
74643 <listitem>
74644 <para>
74645 For a daemon, queue runner, delivery, or address testing process, the uid
74646 remains as root at this stage, but the gid is changed to the Exim group.
74647 </para>
74648 </listitem>
74649 </itemizedlist>
74650 <para>
74651 The processes that initially retain root privilege behave as follows:
74652 </para>
74653 <itemizedlist>
74654 <listitem>
74655 <para>
74656 A daemon process changes the gid to the Exim group and the uid to the Exim
74657 user after setting up one or more listening sockets. The <function>initgroups()</function>
74658 function is called, so that if the Exim user is in any additional groups, they
74659 will be used during message reception.
74660 </para>
74661 </listitem>
74662 <listitem>
74663 <para>
74664 A queue runner process retains root privilege throughout its execution. Its
74665 job is to fork a controlled sequence of delivery processes.
74666 </para>
74667 </listitem>
74668 <listitem>
74669 <para>
74670 A delivery process retains root privilege throughout most of its execution,
74671 but any actual deliveries (that is, the transports themselves) are run in
74672 subprocesses which always change to a non-root uid and gid. For local
74673 deliveries this is typically the uid and gid of the owner of the mailbox; for
74674 remote deliveries, the Exim uid and gid are used. Once all the delivery
74675 subprocesses have been run, a delivery process changes to the Exim uid and gid
74676 while doing post-delivery tidying up such as updating the retry database and
74677 generating bounce and warning messages.
74678 </para>
74679 <para>
74680 While the recipient addresses in a message are being routed, the delivery
74681 process runs as root. However, if a user&#x2019;s filter file has to be processed,
74682 this is done in a subprocess that runs under the individual user&#x2019;s uid and
74683 gid. A system filter is run as root unless <option>system_filter_user</option> is set.
74684 </para>
74685 </listitem>
74686 <listitem>
74687 <para>
74688 A process that is testing addresses (the <option>-bt</option> option) runs as root so that
74689 the routing is done in the same environment as a message delivery.
74690 </para>
74691 </listitem>
74692 </itemizedlist>
74693 </section>
74694 <section id="SECTrunexiwitpri">
74695 <title>Running Exim without privilege</title>
74696 <para>
74697 <indexterm role="concept">
74698 <primary>privilege, running without</primary>
74699 </indexterm>
74700 <indexterm role="concept">
74701 <primary>unprivileged running</primary>
74702 </indexterm>
74703 <indexterm role="concept">
74704 <primary>root privilege</primary>
74705 <secondary>running without</secondary>
74706 </indexterm>
74707 Some installations like to run Exim in an unprivileged state for more of its
74708 operation, for added security. Support for this mode of operation is provided
74709 by the global option <option>deliver_drop_privilege</option>. When this is set, the uid and
74710 gid are changed to the Exim user and group at the start of a delivery process
74711 (and also queue runner and address testing processes). This means that address
74712 routing is no longer run as root, and the deliveries themselves cannot change
74713 to any other uid.
74714 </para>
74715 <para>
74716 <indexterm role="concept">
74717 <primary>SIGHUP</primary>
74718 </indexterm>
74719 <indexterm role="concept">
74720 <primary>daemon</primary>
74721 <secondary>restarting</secondary>
74722 </indexterm>
74723 Leaving the binary setuid to root, but setting <option>deliver_drop_privilege</option> means
74724 that the daemon can still be started in the usual way, and it can respond
74725 correctly to SIGHUP because the re-invocation regains root privilege.
74726 </para>
74727 <para>
74728 An alternative approach is to make Exim setuid to the Exim user and also setgid
74729 to the Exim group. If you do this, the daemon must be started from a root
74730 process. (Calling Exim from a root process makes it behave in the way it does
74731 when it is setuid root.) However, the daemon cannot restart itself after a
74732 SIGHUP signal because it cannot regain privilege.
74733 </para>
74734 <para>
74735 It is still useful to set <option>deliver_drop_privilege</option> in this case, because it
74736 stops Exim from trying to re-invoke itself to do a delivery after a message has
74737 been received. Such a re-invocation is a waste of resources because it has no
74738 effect.
74739 </para>
74740 <para>
74741 If restarting the daemon is not an issue (for example, if <option>mua_wrapper</option> is
74742 set, or <emphasis>inetd</emphasis> is being used instead of a daemon), having the binary setuid
74743 to the Exim user seems a clean approach, but there is one complication:
74744 </para>
74745 <para>
74746 In this style of operation, Exim is running with the real uid and gid set to
74747 those of the calling process, and the effective uid/gid set to Exim&#x2019;s values.
74748 Ideally, any association with the calling process&#x2019; uid/gid should be dropped,
74749 that is, the real uid/gid should be reset to the effective values so as to
74750 discard any privileges that the caller may have. While some operating systems
74751 have a function that permits this action for a non-root effective uid, quite a
74752 number of them do not. Because of this lack of standardization, Exim does not
74753 address this problem at this time.
74754 </para>
74755 <para>
74756 For this reason, the recommended approach for <quote>mostly unprivileged</quote> running
74757 is to keep the Exim binary setuid to root, and to set
74758 <option>deliver_drop_privilege</option>. This also has the advantage of allowing a daemon to
74759 be used in the most straightforward way.
74760 </para>
74761 <para>
74762 If you configure Exim not to run delivery processes as root, there are a
74763 number of restrictions on what you can do:
74764 </para>
74765 <itemizedlist>
74766 <listitem>
74767 <para>
74768 You can deliver only as the Exim user/group. You should  explicitly use the
74769 <option>user</option> and <option>group</option> options to override routers or local transports that
74770 normally deliver as the recipient. This makes sure that configurations that
74771 work in this mode function the same way in normal mode. Any implicit or
74772 explicit specification of another user causes an error.
74773 </para>
74774 </listitem>
74775 <listitem>
74776 <para>
74777 Use of <filename>.forward</filename> files is severely restricted, such that it is usually
74778 not worthwhile to include them in the configuration.
74779 </para>
74780 </listitem>
74781 <listitem>
74782 <para>
74783 Users who wish to use <filename>.forward</filename> would have to make their home directory and
74784 the file itself accessible to the Exim user. Pipe and append-to-file entries,
74785 and their equivalents in Exim filters, cannot be used. While they could be
74786 enabled in the Exim user&#x2019;s name, that would be insecure and not very useful.
74787 </para>
74788 </listitem>
74789 <listitem>
74790 <para>
74791 Unless the local user mailboxes are all owned by the Exim user (possible in
74792 some POP3 or IMAP-only environments):
74793 </para>
74794 <orderedlist numeration="arabic">
74795 <listitem>
74796 <para>
74797 They must be owned by the Exim group and be writeable by that group. This
74798 implies you must set <option>mode</option> in the appendfile configuration, as well as the
74799 mode of the mailbox files themselves.
74800 </para>
74801 </listitem>
74802 <listitem>
74803 <para>
74804 You must set <option>no_check_owner</option>, since most or all of the files will not be
74805 owned by the Exim user.
74806 </para>
74807 </listitem>
74808 <listitem>
74809 <para>
74810 You must set <option>file_must_exist</option>, because Exim cannot set the owner correctly
74811 on a newly created mailbox when unprivileged. This also implies that new
74812 mailboxes need to be created manually.
74813 </para>
74814 </listitem>
74815 </orderedlist>
74816 </listitem>
74817 </itemizedlist>
74818 <para>
74819 These restrictions severely restrict what can be done in local deliveries.
74820 However, there are no restrictions on remote deliveries. If you are running a
74821 gateway host that does no local deliveries, setting <option>deliver_drop_privilege</option>
74822 gives more security at essentially no cost.
74823 </para>
74824 <para>
74825 If you are using the <option>mua_wrapper</option> facility (see chapter
74826 <xref linkend="CHAPnonqueueing"/>), <option>deliver_drop_privilege</option> is forced to be true.
74827 </para>
74828 </section>
74829 <section id="SECID271">
74830 <title>Delivering to local files</title>
74831 <para>
74832 Full details of the checks applied by <command>appendfile</command> before it writes to a file
74833 are given in chapter <xref linkend="CHAPappendfile"/>.
74834 </para>
74835 </section>
74836 <section id="SECTsecconslocalcmds">
74837 <title>Running local commands</title>
74838 <para>
74839 <indexterm role="concept">
74840 <primary>security</primary>
74841 <secondary>local commands</secondary>
74842 </indexterm>
74843 <indexterm role="concept">
74844 <primary>security</primary>
74845 <secondary>command injection attacks</secondary>
74846 </indexterm>
74847 There are a number of ways in which an administrator can configure Exim to run
74848 commands based upon received, untrustworthy, data. Further, in some
74849 configurations a user who can control a <filename>.forward</filename> file can also arrange to
74850 run commands. Configuration to check includes, but is not limited to:
74851 </para>
74852 <itemizedlist>
74853 <listitem>
74854 <para>
74855 Use of <option>use_shell</option> in the pipe transport: various forms of shell command
74856 injection may be possible with this option present. It is dangerous and should
74857 be used only with considerable caution. Consider constraints which whitelist
74858 allowed characters in a variable which is to be used in a pipe transport that
74859 has <option>use_shell</option> enabled.
74860 </para>
74861 </listitem>
74862 <listitem>
74863 <para>
74864 A number of options such as <option>forbid_filter_run</option>, <option>forbid_filter_perl</option>,
74865 <option>forbid_filter_dlfunc</option> and so forth which restrict facilities available to
74866 <filename>.forward</filename> files in a redirect router. If Exim is running on a central mail
74867 hub to which ordinary users do not have shell access, but home directories are
74868 NFS mounted (for instance) then administrators should review the list of these
74869 forbid options available, and should bear in mind that the options that may
74870 need forbidding can change as new features are added between releases.
74871 </para>
74872 </listitem>
74873 <listitem>
74874 <para>
74875 The <option>${run...}</option> expansion item does not use a shell by default, but
74876 administrators can configure use of <filename>/bin/sh</filename> as part of the command.
74877 Such invocations should be viewed with prejudicial suspicion.
74878 </para>
74879 </listitem>
74880 <listitem>
74881 <para>
74882 Administrators who use embedded Perl are advised to explore how Perl&#x2019;s
74883 taint checking might apply to their usage.
74884 </para>
74885 </listitem>
74886 <listitem>
74887 <para>
74888 Use of <option>${expand...}</option> is somewhat analogous to shell&#x2019;s eval builtin and
74889 administrators are well advised to view its use with suspicion, in case (for
74890 instance) it allows a local-part to contain embedded Exim directives.
74891 </para>
74892 </listitem>
74893 <listitem>
74894 <para>
74895 Use of <option>${match_local_part...}</option> and friends becomes more dangerous if
74896 Exim was built with EXPAND_LISTMATCH_RHS defined: the second string in
74897 each can reference arbitrary lists and files, rather than just being a list
74898 of opaque strings.
74899 The EXPAND_LISTMATCH_RHS option was added and set false by default because of
74900 real-world security vulnerabilities caused by its use with untrustworthy data
74901 injected in, for SQL injection attacks.
74902 Consider the use of the <option>inlisti</option> expansion condition instead.
74903 </para>
74904 </listitem>
74905 </itemizedlist>
74906 </section>
74907 <section id="SECTsecconfdata">
74908 <title>Trust in configuration data</title>
74909 <para>
74910 <indexterm role="concept">
74911 <primary>security</primary>
74912 <secondary>data sources</secondary>
74913 </indexterm>
74914 <indexterm role="concept">
74915 <primary>security</primary>
74916 <secondary>regular expressions</secondary>
74917 </indexterm>
74918 <indexterm role="concept">
74919 <primary>regular expressions</primary>
74920 <secondary>security</secondary>
74921 </indexterm>
74922 <indexterm role="concept">
74923 <primary>PCRE2</primary>
74924 <secondary>security</secondary>
74925 </indexterm>
74926 If configuration data for Exim can come from untrustworthy sources, there
74927 are some issues to be aware of:
74928 </para>
74929 <itemizedlist>
74930 <listitem>
74931 <para>
74932 Use of <option>${expand...}</option> may provide a path for shell injection attacks.
74933 </para>
74934 </listitem>
74935 <listitem>
74936 <para>
74937 Letting untrusted data provide a regular expression is unwise.
74938 </para>
74939 </listitem>
74940 <listitem>
74941 <para>
74942 Using <option>${match...}</option> to apply a fixed regular expression against untrusted
74943 data may result in pathological behaviour within PCRE2.  Be aware of what
74944 "backtracking" means and consider options for being more strict with a regular
74945 expression. Avenues to explore include limiting what can match (avoiding <literal>.</literal>
74946 when <literal>[a-z0-9]</literal> or other character class will do), use of atomic grouping and
74947 possessive quantifiers or just not using regular expressions against untrusted
74948 data.
74949 </para>
74950 </listitem>
74951 <listitem>
74952 <para>
74953 It can be important to correctly use <option>${quote:...}</option>,
74954 <option>${quote_local_part:...}</option> and <option>${quote_</option>&lt;<emphasis>lookup-type</emphasis>&gt;<option>:...}</option> expansion
74955 items to ensure that data is correctly constructed.
74956 </para>
74957 </listitem>
74958 <listitem>
74959 <para>
74960 Some lookups might return multiple results, even though normal usage is only
74961 expected to yield one result.
74962 </para>
74963 </listitem>
74964 </itemizedlist>
74965 </section>
74966 <section id="SECID272">
74967 <title>IPv4 source routing</title>
74968 <para>
74969 <indexterm role="concept">
74970 <primary>source routing</primary>
74971 <secondary>in IP packets</secondary>
74972 </indexterm>
74973 <indexterm role="concept">
74974 <primary>IP source routing</primary>
74975 </indexterm>
74976 Many operating systems suppress IP source-routed packets in the kernel, but
74977 some cannot be made to do this, so Exim does its own check. It logs incoming
74978 IPv4 source-routed TCP calls, and then drops them. Things are all different in
74979 IPv6. No special checking is currently done.
74980 </para>
74981 </section>
74982 <section id="SECID273">
74983 <title>The VRFY, EXPN, and ETRN commands in SMTP</title>
74984 <para>
74985 Support for these SMTP commands is disabled by default. If required, they can
74986 be enabled by defining suitable ACLs.
74987 </para>
74988 </section>
74989 <section id="SECID274">
74990 <title>Privileged users</title>
74991 <para>
74992 <indexterm role="concept">
74993 <primary>trusted users</primary>
74994 </indexterm>
74995 <indexterm role="concept">
74996 <primary>admin user</primary>
74997 </indexterm>
74998 <indexterm role="concept">
74999 <primary>privileged user</primary>
75000 </indexterm>
75001 <indexterm role="concept">
75002 <primary>user</primary>
75003 <secondary>trusted</secondary>
75004 </indexterm>
75005 <indexterm role="concept">
75006 <primary>user</primary>
75007 <secondary>admin</secondary>
75008 </indexterm>
75009 Exim recognizes two sets of users with special privileges. Trusted users are
75010 able to submit new messages to Exim locally, but supply their own sender
75011 addresses and information about a sending host. For other users submitting
75012 local messages, Exim sets up the sender address from the uid, and doesn&#x2019;t
75013 permit a remote host to be specified.
75014 </para>
75015 <para>
75016 <indexterm role="option">
75017 <primary><option>-f</option></primary>
75018 </indexterm>
75019 However, an untrusted user is permitted to use the <option>-f</option> command line option
75020 in the special form <option>-f &lt;&gt;</option> to indicate that a delivery failure for the
75021 message should not cause an error report. This affects the message&#x2019;s envelope,
75022 but it does not affect the <emphasis>Sender:</emphasis> header. Untrusted users may also be
75023 permitted to use specific forms of address with the <option>-f</option> option by setting
75024 the <option>untrusted_set_sender</option> option.
75025 </para>
75026 <para>
75027 Trusted users are used to run processes that receive mail messages from some
75028 other mail domain and pass them on to Exim for delivery either locally, or over
75029 the Internet. Exim trusts a caller that is running as root, as the Exim user,
75030 as any user listed in the <option>trusted_users</option> configuration option, or under any
75031 group listed in the <option>trusted_groups</option> option.
75032 </para>
75033 <para>
75034 Admin users are permitted to do things to the messages on Exim&#x2019;s queue. They
75035 can freeze or thaw messages, cause them to be returned to their senders, remove
75036 them entirely, or modify them in various ways. In addition, admin users can run
75037 the Exim monitor and see all the information it is capable of providing, which
75038 includes the contents of files on the spool.
75039 </para>
75040 <para>
75041 <indexterm role="option">
75042 <primary><option>-M</option></primary>
75043 </indexterm>
75044 <indexterm role="option">
75045 <primary><option>-q</option></primary>
75046 </indexterm>
75047 By default, the use of the <option>-M</option> and <option>-q</option> options to cause Exim to attempt
75048 delivery of messages on its queue is restricted to admin users. This
75049 restriction can be relaxed by setting the <option>no_prod_requires_admin</option> option.
75050 Similarly, the use of <option>-bp</option> (and its variants) to list the contents of the
75051 queue is also restricted to admin users. This restriction can be relaxed by
75052 setting <option>no_queue_list_requires_admin</option>.
75053 </para>
75054 <para>
75055 Exim recognizes an admin user if the calling process is running as root or as
75056 the Exim user or if any of the groups associated with the calling process is
75057 the Exim group. It is not necessary actually to be running under the Exim
75058 group. However, if admin users who are not root or the Exim user are to access
75059 the contents of files on the spool via the Exim monitor (which runs
75060 unprivileged), Exim must be built to allow group read access to its spool
75061 files.
75062 </para>
75063 <para>
75064 By default, regular users are trusted to perform basic testing and
75065 introspection commands, as themselves.  This setting can be tightened by
75066 setting the <option>commandline_checks_require_admin</option> option.
75067 This affects most of the checking options,
75068 such as <option>-be</option> and anything else <option>-b*</option>.
75069 </para>
75070 </section>
75071 <section id="SECID275">
75072 <title>Spool files</title>
75073 <para>
75074 <indexterm role="concept">
75075 <primary>spool directory</primary>
75076 <secondary>files</secondary>
75077 </indexterm>
75078 Exim&#x2019;s spool directory and everything it contains is owned by the Exim user and
75079 set to the Exim group. The mode for spool files is defined in the
75080 <filename>Local/Makefile</filename> configuration file, and defaults to 0640. This means that
75081 any user who is a member of the Exim group can access these files.
75082 </para>
75083 </section>
75084 <section id="SECID276">
75085 <title>Use of argv[0]</title>
75086 <para>
75087 Exim examines the last component of <option>argv[0]</option>, and if it matches one of a set
75088 of specific strings, Exim assumes certain options. For example, calling Exim
75089 with the last component of <option>argv[0]</option> set to <quote>rsmtp</quote> is exactly equivalent
75090 to calling it with the option <option>-bS</option>. There are no security implications in
75091 this.
75092 </para>
75093 </section>
75094 <section id="SECID277">
75095 <title>Use of %f formatting</title>
75096 <para>
75097 The only use made of <quote>%f</quote> by Exim is in formatting load average values. These
75098 are actually stored in integer variables as 1000 times the load average.
75099 Consequently, their range is limited and so therefore is the length of the
75100 converted output.
75101 </para>
75102 </section>
75103 <section id="SECID278">
75104 <title>Embedded Exim path</title>
75105 <para>
75106 Exim uses its own path name, which is embedded in the code, only when it needs
75107 to re-exec in order to regain root privilege. Therefore, it is not root when it
75108 does so. If some bug allowed the path to get overwritten, it would lead to an
75109 arbitrary program&#x2019;s being run as exim, not as root.
75110 </para>
75111 </section>
75112 <section id="SECTdynmoddir">
75113 <title>Dynamic module directory</title>
75114 <para>
75115 Any dynamically loadable modules must be installed into the directory
75116 defined in <literal>LOOKUP_MODULE_DIR</literal> in <filename>Local/Makefile</filename> for Exim to permit
75117 loading it.
75118 </para>
75119 </section>
75120 <section id="SECID279">
75121 <title>Use of sprintf()</title>
75122 <para>
75123 <indexterm role="concept">
75124 <primary><function>sprintf()</function></primary>
75125 </indexterm>
75126 A large number of occurrences of <quote>sprintf</quote> in the code are actually calls to
75127 <emphasis>string_sprintf()</emphasis>, a function that returns the result in malloc&#x2019;d store.
75128 The intermediate formatting is done into a large fixed buffer by a function
75129 that runs through the format string itself, and checks the length of each
75130 conversion before performing it, thus preventing buffer overruns.
75131 </para>
75132 <para>
75133 The remaining uses of <function>sprintf()</function> happen in controlled circumstances where
75134 the output buffer is known to be sufficiently long to contain the converted
75135 string.
75136 </para>
75137 </section>
75138 <section id="SECID280">
75139 <title>Use of debug_printf() and log_write()</title>
75140 <para>
75141 Arbitrary strings are passed to both these functions, but they do their
75142 formatting by calling the function <emphasis>string_vformat()</emphasis>, which runs through
75143 the format string itself, and checks the length of each conversion.
75144 </para>
75145 </section>
75146 <section id="SECID281">
75147 <title>Use of strcat() and strcpy()</title>
75148 <para>
75149 These are used only in cases where the output buffer is known to be large
75150 enough to hold the result.
75151 <indexterm role="concept" startref="IIDsecurcon" class="endofrange"/>
75152 </para>
75153 </section>
75154 </chapter>
75155
75156 <chapter id="CHAPspool">
75157 <title>Format of spool files</title>
75158 <para>
75159 <indexterm role="concept" id="IIDforspo1" class="startofrange">
75160 <primary>format</primary>
75161 <secondary>spool files</secondary>
75162 </indexterm>
75163 <indexterm role="concept" id="IIDforspo2" class="startofrange">
75164 <primary>spool directory</primary>
75165 <secondary>format of files</secondary>
75166 </indexterm>
75167 <indexterm role="concept" id="IIDforspo3" class="startofrange">
75168 <primary>spool files</primary>
75169 <secondary>format of</secondary>
75170 </indexterm>
75171 <indexterm role="concept">
75172 <primary>spool files</primary>
75173 <secondary>editing</secondary>
75174 </indexterm>
75175 A message on Exim&#x2019;s queue consists of two files, whose names are the message id
75176 followed by -D and -H, respectively. The data portion of the message is kept in
75177 the -D file on its own. The message&#x2019;s envelope, status, and headers are all
75178 kept in the -H file, whose format is described in this chapter. Each of these
75179 two files contains the final component of its own name as its first line. This
75180 is insurance against disk crashes where the directory is lost but the files
75181 themselves are recoverable.
75182 </para>
75183 <para>
75184 The file formats may be changed, or new formats added, at any release.
75185 Spool files are not intended as an interface to other programs
75186 and should not be used as such.
75187 </para>
75188 <para>
75189 Some people are tempted into editing -D files in order to modify messages. You
75190 need to be extremely careful if you do this; it is not recommended and you are
75191 on your own if you do it. Here are some of the pitfalls:
75192 </para>
75193 <itemizedlist>
75194 <listitem>
75195 <para>
75196 You must ensure that Exim does not try to deliver the message while you are
75197 fiddling with it. The safest way is to take out a write lock on the -D file,
75198 which is what Exim itself does, using <function>fcntl()</function>. If you update the file in
75199 place, the lock will be retained. If you write a new file and rename it, the
75200 lock will be lost at the instant of rename.
75201 </para>
75202 </listitem>
75203 <listitem>
75204 <para>
75205 <indexterm role="variable">
75206 <primary><varname>$body_linecount</varname></primary>
75207 </indexterm>
75208 If you change the number of lines in the file, the value of
75209 <varname>$body_linecount</varname>, which is stored in the -H file, will be incorrect and can
75210 cause incomplete transmission of messages or undeliverable messages.
75211 </para>
75212 </listitem>
75213 <listitem>
75214 <para>
75215 If the message is in MIME format, you must take care not to break it.
75216 </para>
75217 </listitem>
75218 <listitem>
75219 <para>
75220 If the message is cryptographically signed, any change will invalidate the
75221 signature.
75222 </para>
75223 </listitem>
75224 </itemizedlist>
75225 <para>
75226 All in all, modifying -D files is fraught with danger.
75227 </para>
75228 <para>
75229 Files whose names end with -J may also be seen in the <filename>input</filename> directory (or
75230 its subdirectories when <option>split_spool_directory</option> is set). These are journal
75231 files, used to record addresses to which the message has been delivered during
75232 the course of a delivery attempt. If there are still undelivered recipients at
75233 the end, the -H file is updated, and the -J file is deleted. If, however, there
75234 is some kind of crash (for example, a power outage) before this happens, the -J
75235 file remains in existence. When Exim next processes the message, it notices the
75236 -J file and uses it to update the -H file before starting the next delivery
75237 attempt.
75238 </para>
75239 <para>
75240 Files whose names end with -K or .eml may also be seen in the spool.
75241 These are temporaries used for DKIM or malware processing, when that is used.
75242 They should be tidied up by normal operations; any old ones are probably
75243 relics of crashes and can be removed.
75244 </para>
75245 <section id="SECID282">
75246 <title>Format of the -H file</title>
75247 <para>
75248 <indexterm role="concept">
75249 <primary>uid (user id)</primary>
75250 <secondary>in spool file</secondary>
75251 </indexterm>
75252 <indexterm role="concept">
75253 <primary>gid (group id)</primary>
75254 <secondary>in spool file</secondary>
75255 </indexterm>
75256 The second line of the -H file contains the login name for the uid of the
75257 process that called Exim to read the message, followed by the numerical uid and
75258 gid. For a locally generated message, this is normally the user who sent the
75259 message. For a message received over TCP/IP via the daemon, it is
75260 normally the Exim user.
75261 </para>
75262 <para>
75263 The third line of the file contains the address of the message&#x2019;s sender as
75264 transmitted in the envelope, contained in angle brackets. The sender address is
75265 empty for bounce messages. For incoming SMTP mail, the sender address is given
75266 in the MAIL command. For locally generated mail, the sender address is
75267 created by Exim from the login name of the current user and the configured
75268 <option>qualify_domain</option>. However, this can be overridden by the <option>-f</option> option or a
75269 leading <quote>From&nbsp;</quote> line if the caller is trusted, or if the supplied address is
75270 <quote>&lt;&gt;</quote> or an address that matches <option>untrusted_set_senders</option>.
75271 </para>
75272 <para>
75273 The fourth line contains two numbers. The first is the time that the message
75274 was received, in the conventional Unix form &ndash; the number of seconds since the
75275 start of the epoch. The second number is a count of the number of messages
75276 warning of delayed delivery that have been sent to the sender.
75277 </para>
75278 <para revisionflag="changed">
75279 There follow a number of lines starting with a hyphen.
75280 These contain variables, can appear in any
75281 order, and are omitted when not relevant.
75282 </para>
75283 <para revisionflag="changed">
75284 If there is a second hyphen after the first,
75285 the corresponding data is tainted.
75286 If there is a value in parentheses, the data is quoted for a lookup.
75287 </para>
75288 <para revisionflag="changed">
75289 The following word specifies a variable,
75290 and the remainder of the item depends on the variable.
75291 </para>
75292 <variablelist>
75293 <varlistentry>
75294 <term><option>-acl</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
75295 <listitem>
75296 <para>
75297 This item is obsolete, and is not generated from Exim release 4.61 onwards;
75298 <option>-aclc</option> and <option>-aclm</option> are used instead. However, <option>-acl</option> is still
75299 recognized, to provide backward compatibility. In the old format, a line of
75300 this form is present for every ACL variable that is not empty. The number
75301 identifies the variable; the <option>acl_c</option><emphasis role="bold">x</emphasis> variables are numbered 0&ndash;9 and
75302 the <option>acl_m</option><emphasis role="bold">x</emphasis> variables are numbered 10&ndash;19. The length is the length of
75303 the data string for the variable. The string itself starts at the beginning of
75304 the next line, and is followed by a newline character. It may contain internal
75305 newlines.
75306 </para>
75307 </listitem></varlistentry>
75308 <varlistentry>
75309 <term><option>-aclc</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
75310 <listitem>
75311 <para>
75312 A line of this form is present for every ACL connection variable that is
75313 defined. Note that there is a space between <option>-aclc</option> and the rest of the name.
75314 The length is the length of the data string for the variable. The string itself
75315 starts at the beginning of the next line, and is followed by a newline
75316 character. It may contain internal newlines.
75317 </para>
75318 </listitem></varlistentry>
75319 <varlistentry>
75320 <term><option>-aclm</option>&nbsp;&lt;<emphasis>rest-of-name</emphasis>&gt;&nbsp;&lt;<emphasis>length</emphasis>&gt;</term>
75321 <listitem>
75322 <para>
75323 A line of this form is present for every ACL message variable that is defined.
75324 Note that there is a space between <option>-aclm</option> and the rest of the name. The
75325 length is the length of the data string for the variable. The string itself
75326 starts at the beginning of the next line, and is followed by a newline
75327 character. It may contain internal newlines.
75328 </para>
75329 </listitem></varlistentry>
75330 <varlistentry>
75331 <term><option>-active_hostname</option>&nbsp;&lt;<emphasis>hostname</emphasis>&gt;</term>
75332 <listitem>
75333 <para>
75334 This is present if, when the message was received over SMTP, the value of
75335 <varname>$smtp_active_hostname</varname> was different to the value of <varname>$primary_hostname</varname>.
75336 </para>
75337 </listitem></varlistentry>
75338 <varlistentry>
75339 <term><option>-allow_unqualified_recipient</option></term>
75340 <listitem>
75341 <para>
75342 This is present if unqualified recipient addresses are permitted in header
75343 lines (to stop such addresses from being qualified if rewriting occurs at
75344 transport time). Local messages that were input using <option>-bnq</option> and remote
75345 messages from hosts that match <option>recipient_unqualified_hosts</option> set this flag.
75346 </para>
75347 </listitem></varlistentry>
75348 <varlistentry>
75349 <term><option>-allow_unqualified_sender</option></term>
75350 <listitem>
75351 <para>
75352 This is present if unqualified sender addresses are permitted in header lines
75353 (to stop such addresses from being qualified if rewriting occurs at transport
75354 time). Local messages that were input using <option>-bnq</option> and remote messages from
75355 hosts that match <option>sender_unqualified_hosts</option> set this flag.
75356 </para>
75357 </listitem></varlistentry>
75358 <varlistentry>
75359 <term><option>-auth_id</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
75360 <listitem>
75361 <para>
75362 The id information for a message received on an authenticated SMTP connection
75363 &ndash; the value of the <varname>$authenticated_id</varname> variable.
75364 </para>
75365 </listitem></varlistentry>
75366 <varlistentry>
75367 <term><option>-auth_sender</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;</term>
75368 <listitem>
75369 <para>
75370 The address of an authenticated sender &ndash; the value of the
75371 <varname>$authenticated_sender</varname> variable.
75372 </para>
75373 </listitem></varlistentry>
75374 <varlistentry>
75375 <term><option>-body_linecount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
75376 <listitem>
75377 <para>
75378 This records the number of lines in the body of the message, and is
75379 present unless <option>-spool_file_wireformat</option> is.
75380 </para>
75381 </listitem></varlistentry>
75382 <varlistentry>
75383 <term><option>-body_zerocount</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
75384 <listitem>
75385 <para>
75386 This records the number of binary zero bytes in the body of the message, and is
75387 present if the number is greater than zero.
75388 </para>
75389 </listitem></varlistentry>
75390 <varlistentry>
75391 <term><option>-deliver_firsttime</option></term>
75392 <listitem>
75393 <para>
75394 This is written when a new message is first added to the spool. When the spool
75395 file is updated after a deferral, it is omitted.
75396 </para>
75397 </listitem></varlistentry>
75398 <varlistentry>
75399 <term><option>-frozen</option>&nbsp;&lt;<emphasis>time</emphasis>&gt;</term>
75400 <listitem>
75401 <para>
75402 <indexterm role="concept">
75403 <primary>frozen messages</primary>
75404 <secondary>spool data</secondary>
75405 </indexterm>
75406 The message is frozen, and the freezing happened at &lt;<emphasis>time</emphasis>&gt;.
75407 </para>
75408 </listitem></varlistentry>
75409 <varlistentry>
75410 <term><option>-helo_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
75411 <listitem>
75412 <para>
75413 This records the host name as specified by a remote host in a HELO or EHLO
75414 command.
75415 </para>
75416 </listitem></varlistentry>
75417 <varlistentry>
75418 <term><option>-host_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
75419 <listitem>
75420 <para>
75421 This records the IP address of the host from which the message was received and
75422 the remote port number that was used. It is omitted for locally generated
75423 messages.
75424 </para>
75425 </listitem></varlistentry>
75426 <varlistentry>
75427 <term><option>-host_auth</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
75428 <listitem>
75429 <para>
75430 If the message was received on an authenticated SMTP connection, this records
75431 the name of the authenticator &ndash; the value of the
75432 <varname>$sender_host_authenticated</varname> variable.
75433 </para>
75434 </listitem></varlistentry>
75435 <varlistentry>
75436 <term><option>-host_lookup_failed</option></term>
75437 <listitem>
75438 <para>
75439 This is present if an attempt to look up the sending host&#x2019;s name from its IP
75440 address failed. It corresponds to the <varname>$host_lookup_failed</varname> variable.
75441 </para>
75442 </listitem></varlistentry>
75443 <varlistentry>
75444 <term><option>-host_name</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
75445 <listitem>
75446 <para>
75447 <indexterm role="concept">
75448 <primary>reverse DNS lookup</primary>
75449 </indexterm>
75450 <indexterm role="concept">
75451 <primary>DNS</primary>
75452 <secondary>reverse lookup</secondary>
75453 </indexterm>
75454 This records the name of the remote host from which the message was received,
75455 if the host name was looked up from the IP address when the message was being
75456 received. It is not present if no reverse lookup was done.
75457 </para>
75458 </listitem></varlistentry>
75459 <varlistentry>
75460 <term><option>-ident</option>&nbsp;&lt;<emphasis>text</emphasis>&gt;</term>
75461 <listitem>
75462 <para>
75463 For locally submitted messages, this records the login of the originating user,
75464 unless it was a trusted user and the <option>-oMt</option> option was used to specify an
75465 ident value. For messages received over TCP/IP, this records the ident string
75466 supplied by the remote host, if any.
75467 </para>
75468 </listitem></varlistentry>
75469 <varlistentry>
75470 <term><option>-interface_address</option>&nbsp;&lt;<emphasis>address</emphasis>&gt;.&lt;<emphasis>port</emphasis>&gt;</term>
75471 <listitem>
75472 <para>
75473 This records the IP address of the local interface and the port number through
75474 which a message was received from a remote host. It is omitted for locally
75475 generated messages.
75476 </para>
75477 </listitem></varlistentry>
75478 <varlistentry>
75479 <term><option>-local</option></term>
75480 <listitem>
75481 <para>
75482 The message is from a local sender.
75483 </para>
75484 </listitem></varlistentry>
75485 <varlistentry>
75486 <term><option>-localerror</option></term>
75487 <listitem>
75488 <para>
75489 The message is a locally-generated bounce message.
75490 </para>
75491 </listitem></varlistentry>
75492 <varlistentry>
75493 <term><option>-local_scan</option>&nbsp;&lt;<emphasis>string</emphasis>&gt;</term>
75494 <listitem>
75495 <para>
75496 This records the data string that was returned by the <function>local_scan()</function> function
75497 when the message was received &ndash; the value of the <varname>$local_scan_data</varname>
75498 variable. It is omitted if no data was returned.
75499 </para>
75500 </listitem></varlistentry>
75501 <varlistentry>
75502 <term><option>-manual_thaw</option></term>
75503 <listitem>
75504 <para>
75505 The message was frozen but has been thawed manually, that is, by an explicit
75506 Exim command rather than via the auto-thaw process.
75507 </para>
75508 </listitem></varlistentry>
75509 <varlistentry>
75510 <term><option>-N</option></term>
75511 <listitem>
75512 <para>
75513 A testing delivery process was started using the <option>-N</option> option to suppress any
75514 actual deliveries, but delivery was deferred. At any further delivery attempts,
75515 <option>-N</option> is assumed.
75516 </para>
75517 </listitem></varlistentry>
75518 <varlistentry>
75519 <term><option>-received_protocol</option></term>
75520 <listitem>
75521 <para>
75522 This records the value of the <varname>$received_protocol</varname> variable, which contains
75523 the name of the protocol by which the message was received.
75524 </para>
75525 </listitem></varlistentry>
75526 <varlistentry>
75527 <term><option>-sender_set_untrusted</option></term>
75528 <listitem>
75529 <para>
75530 The envelope sender of this message was set by an untrusted local caller (used
75531 to ensure that the caller is displayed in queue listings).
75532 </para>
75533 </listitem></varlistentry>
75534 <varlistentry>
75535 <term><option>-spam_score_int</option>&nbsp;&lt;<emphasis>number</emphasis>&gt;</term>
75536 <listitem>
75537 <para>
75538 If a message was scanned by SpamAssassin, this is present. It records the value
75539 of <varname>$spam_score_int</varname>.
75540 </para>
75541 </listitem></varlistentry>
75542 <varlistentry>
75543 <term><option>-spool_file_wireformat</option></term>
75544 <listitem>
75545 <para>
75546 The -D file for this message is in wire-format (for ESMTP CHUNKING)
75547 rather than Unix-format.
75548 The line-ending is CRLF rather than newline.
75549 There is still, however, no leading-dot-stuffing.
75550 </para>
75551 </listitem></varlistentry>
75552 <varlistentry>
75553 <term><option>-tls_certificate_verified</option></term>
75554 <listitem>
75555 <para>
75556 A TLS certificate was received from the client that sent this message, and the
75557 certificate was verified by the server.
75558 </para>
75559 </listitem></varlistentry>
75560 <varlistentry>
75561 <term><option>-tls_cipher</option>&nbsp;&lt;<emphasis>cipher name</emphasis>&gt;</term>
75562 <listitem>
75563 <para>
75564 When the message was received over an encrypted connection, this records the
75565 name of the cipher suite that was used.
75566 </para>
75567 </listitem></varlistentry>
75568 <varlistentry>
75569 <term><option>-tls_peerdn</option>&nbsp;&lt;<emphasis>peer DN</emphasis>&gt;</term>
75570 <listitem>
75571 <para>
75572 When the message was received over an encrypted connection, and a certificate
75573 was received from the client, this records the Distinguished Name from that
75574 certificate.
75575 </para>
75576 </listitem></varlistentry>
75577 </variablelist>
75578 <para>
75579 Following the options there is a list of those addresses to which the message
75580 is not to be delivered. This set of addresses is initialized from the command
75581 line when the <option>-t</option> option is used and <option>extract_addresses_remove_arguments</option>
75582 is set; otherwise it starts out empty. Whenever a successful delivery is made,
75583 the address is added to this set. The addresses are kept internally as a
75584 balanced binary tree, and it is a representation of that tree which is written
75585 to the spool file. If an address is expanded via an alias or forward file, the
75586 original address is added to the tree when deliveries to all its child
75587 addresses are complete.
75588 </para>
75589 <para>
75590 If the tree is empty, there is a single line in the spool file containing just
75591 the text <quote>XX</quote>. Otherwise, each line consists of two letters, which are either
75592 Y or N, followed by an address. The address is the value for the node of the
75593 tree, and the letters indicate whether the node has a left branch and/or a
75594 right branch attached to it, respectively. If branches exist, they immediately
75595 follow. Here is an example of a three-node tree:
75596 </para>
75597 <literallayout class="monospaced">
75598 YY darcy@austen.fict.example
75599 NN alice@wonderland.fict.example
75600 NN editor@thesaurus.ref.example
75601 </literallayout>
75602 <para>
75603 After the non-recipients tree, there is a list of the message&#x2019;s recipients.
75604 This is a simple list, preceded by a count. It includes all the original
75605 recipients of the message, including those to whom the message has already been
75606 delivered. In the simplest case, the list contains one address per line. For
75607 example:
75608 </para>
75609 <literallayout class="monospaced">
75610 4
75611 editor@thesaurus.ref.example
75612 darcy@austen.fict.example
75613 rdo@foundation
75614 alice@wonderland.fict.example
75615 </literallayout>
75616 <para>
75617 However, when a child address has been added to the top-level addresses as a
75618 result of the use of the <option>one_time</option> option on a <command>redirect</command> router, each
75619 line is of the following form:
75620 </para>
75621 <literallayout>
75622 &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;
75623 </literallayout>
75624 <para>
75625 The 01 flag bit indicates the presence of the three other fields that follow
75626 the top-level address. Other bits may be used in future to support additional
75627 fields. The &lt;<emphasis>parent number</emphasis>&gt; is the offset in the recipients list of the
75628 original parent of the <quote>one time</quote> address. The first two fields are the
75629 envelope sender that is associated with this address and its length. If the
75630 length is zero, there is no special envelope sender (there are then two space
75631 characters in the line). A non-empty field can arise from a <command>redirect</command> router
75632 that has an <option>errors_to</option> setting.
75633 </para>
75634 <para>
75635 A blank line separates the envelope and status information from the headers
75636 which follow. A header may occupy several lines of the file, and to save effort
75637 when reading it in, each header is preceded by a number and an identifying
75638 character. The number is the number of characters in the header, including any
75639 embedded newlines and the terminating newline. The character is one of the
75640 following:
75641 </para>
75642 <informaltable frame="none">
75643 <tgroup cols="2" colsep="0" rowsep="0">
75644 <colspec colwidth="50pt" align="left"/>
75645 <colspec colwidth="254pt" align="left"/>
75646 <tbody>
75647 <row>
75648 <entry>&lt;<emphasis>blank</emphasis>&gt;</entry>
75649 <entry>header in which Exim has no special interest</entry>
75650 </row>
75651 <row>
75652 <entry><literal>B</literal></entry>
75653 <entry><emphasis>Bcc:</emphasis> header</entry>
75654 </row>
75655 <row>
75656 <entry><literal>C</literal></entry>
75657 <entry><emphasis>Cc:</emphasis> header</entry>
75658 </row>
75659 <row>
75660 <entry><literal>F</literal></entry>
75661 <entry><emphasis>From:</emphasis> header</entry>
75662 </row>
75663 <row>
75664 <entry><literal>I</literal></entry>
75665 <entry><emphasis>Message-id:</emphasis> header</entry>
75666 </row>
75667 <row>
75668 <entry><literal>P</literal></entry>
75669 <entry><emphasis>Received:</emphasis> header &ndash; P for <quote>postmark</quote></entry>
75670 </row>
75671 <row>
75672 <entry><literal>R</literal></entry>
75673 <entry><emphasis>Reply-To:</emphasis> header</entry>
75674 </row>
75675 <row>
75676 <entry><literal>S</literal></entry>
75677 <entry><emphasis>Sender:</emphasis> header</entry>
75678 </row>
75679 <row>
75680 <entry><literal>T</literal></entry>
75681 <entry><emphasis>To:</emphasis> header</entry>
75682 </row>
75683 <row>
75684 <entry><literal>*</literal></entry>
75685 <entry>replaced or deleted header</entry>
75686 </row>
75687 </tbody>
75688 </tgroup>
75689 </informaltable>
75690 <para>
75691 Deleted or replaced (rewritten) headers remain in the spool file for debugging
75692 purposes. They are not transmitted when the message is delivered. Here is a
75693 typical set of headers:
75694 </para>
75695 <literallayout class="monospaced">
75696 111P Received: by hobbit.fict.example with local (Exim 4.00)
75697 id 14y9EI-00026G-00; Fri, 11 May 2001 10:28:59 +0100
75698 049  Message-Id: &lt;E14y9EI-00026G-00@hobbit.fict.example&gt;
75699 038* X-rewrote-sender: bb@hobbit.fict.example
75700 042* From: Bilbo Baggins &lt;bb@hobbit.fict.example&gt;
75701 049F From: Bilbo Baggins &lt;B.Baggins@hobbit.fict.example&gt;
75702 099* To: alice@wonderland.fict.example, rdo@foundation,
75703 darcy@austen.fict.example, editor@thesaurus.ref.example
75704 104T To: alice@wonderland.fict.example, rdo@foundation.example,
75705 darcy@austen.fict.example, editor@thesaurus.ref.example
75706 038  Date: Fri, 11 May 2001 10:28:59 +0100
75707 </literallayout>
75708 <para>
75709 The asterisked headers indicate that the envelope sender, <emphasis>From:</emphasis> header, and
75710 <emphasis>To:</emphasis> header have been rewritten, the last one because routing expanded the
75711 unqualified domain <emphasis>foundation</emphasis>.
75712 <indexterm role="concept" startref="IIDforspo1" class="endofrange"/>
75713 <indexterm role="concept" startref="IIDforspo2" class="endofrange"/>
75714 <indexterm role="concept" startref="IIDforspo3" class="endofrange"/>
75715 </para>
75716 </section>
75717 <section id="SECID282a">
75718 <title>Format of the -D file</title>
75719 <para>
75720 The data file is traditionally in Unix-standard format: lines are ended with
75721 an ASCII newline character.
75722 However, when the <option>spool_wireformat</option> main option is used some -D files
75723 can have an alternate format.
75724 This is flagged by a <option>-spool_file_wireformat</option> line in the corresponding -H file.
75725 The -D file lines (not including the first name-component line) are
75726 suitable for direct copying to the wire when transmitting using the
75727 ESMTP CHUNKING option, meaning lower processing overhead.
75728 Lines are terminated with an ASCII CRLF pair.
75729 There is no dot-stuffing (and no dot-termination).
75730 </para>
75731 </section>
75732 </chapter>
75733
75734 <chapter id="CHAPdkim">
75735 <title>DKIM, SPF, SRS and DMARC</title>
75736 <titleabbrev>DKIM, SPF, SRS and DMARC Support</titleabbrev>
75737 <section id="SECDKIM">
75738 <title>DKIM (DomainKeys Identified Mail)</title>
75739 <para>
75740 <indexterm role="concept">
75741 <primary>DKIM</primary>
75742 </indexterm>
75743 </para>
75744 <para>
75745 DKIM is a mechanism by which messages sent by some entity can be provably
75746 linked to a domain which that entity controls.  It permits reputation to
75747 be tracked on a per-domain basis, rather than merely upon source IP address.
75748 DKIM is documented in RFC 6376.
75749 </para>
75750 <para>
75751 As DKIM relies on the message being unchanged in transit, messages handled
75752 by a mailing-list (which traditionally adds to the message) will not match
75753 any original DKIM signature.
75754 </para>
75755 <para>
75756 DKIM support is compiled into Exim by default if TLS support is present.
75757 It can be disabled by setting DISABLE_DKIM=yes in <filename>Local/Makefile</filename>.
75758 </para>
75759 <para>
75760 Exim&#x2019;s DKIM implementation allows for
75761 </para>
75762 <orderedlist numeration="arabic">
75763 <listitem>
75764 <para>
75765 Signing outgoing messages: This function is implemented in the SMTP transport.
75766 It can co-exist with all other Exim features
75767 (including transport filters)
75768 except cutthrough delivery.
75769 </para>
75770 </listitem>
75771 <listitem>
75772 <para>
75773 Verifying signatures in incoming messages: This is implemented by an additional
75774 ACL (acl_smtp_dkim), which can be called several times per message, with
75775 different signature contexts.
75776 </para>
75777 </listitem>
75778 </orderedlist>
75779 <para>
75780 In typical Exim style, the verification implementation does not include any
75781 default "policy". Instead it enables you to build your own policy using
75782 Exim&#x2019;s standard controls.
75783 </para>
75784 <para>
75785 Please note that verification of DKIM signatures in incoming mail is turned
75786 on by default for logging (in the &lt;= line) purposes.
75787 </para>
75788 <para>
75789 Additional log detail can be enabled using the <option>dkim_verbose</option> log_selector.
75790 When set, for each signature in incoming email,
75791 exim will log a line displaying the most important signature details, and the
75792 signature status. Here is an example (with line-breaks added for clarity):
75793 </para>
75794 <literallayout class="monospaced">
75795 2009-09-09 10:22:28 1MlIRf-0003LU-U3 DKIM:
75796     d=facebookmail.com s=q1-2009b
75797     c=relaxed/relaxed a=rsa-sha1
75798     i=@facebookmail.com t=1252484542 [verification succeeded]
75799 </literallayout>
75800 <para>
75801 You might want to turn off DKIM verification processing entirely for internal
75802 or relay mail sources. To do that, set the <option>dkim_disable_verify</option> ACL
75803 control modifier. This should typically be done in the RCPT ACL, at points
75804 where you accept mail from relay sources (internal hosts or authenticated
75805 senders).
75806 </para>
75807 </section>
75808 <section id="SECDKIMSIGN">
75809 <title>Signing outgoing messages</title>
75810 <para>
75811 <indexterm role="concept">
75812 <primary>DKIM</primary>
75813 <secondary>signing</secondary>
75814 </indexterm>
75815 </para>
75816 <para>
75817 For signing to be usable you must have published a DKIM record in DNS.
75818 Note that RFC 8301 (which does not cover EC keys) says:
75819 </para>
75820 <literallayout class="monospaced">
75821 rsa-sha1 MUST NOT be used for signing or verifying.
75822
75823 Signers MUST use RSA keys of at least 1024 bits for all keys.
75824 Signers SHOULD use RSA keys of at least 2048 bits.
75825 </literallayout>
75826 <para>
75827 Note also that the key content (the &#x2019;p=&#x2019; field)
75828 in the DNS record is different between RSA and EC keys;
75829 for the former it is the base64 of the ASN.1 for the RSA public key
75830 (equivalent to the private-key .pem with the header/trailer stripped)
75831 but for EC keys it is the base64 of the pure key; no ASN.1 wrapping.
75832 </para>
75833 <para>
75834 Signing is enabled by setting private options on the SMTP transport.
75835 These options take (expandable) strings as arguments.
75836 </para>
75837 <para>
75838 <indexterm role="option">
75839 <primary><option>dkim_domain</option></primary>
75840 </indexterm>
75841 </para>
75842 <informaltable frame="all">
75843 <tgroup cols="4" colsep="0" rowsep="0">
75844 <colspec colwidth="8*" align="left"/>
75845 <colspec colwidth="6*" align="center"/>
75846 <colspec colwidth="6*" align="center"/>
75847 <colspec colwidth="6*" align="right"/>
75848 <tbody>
75849 <row>
75850 <entry><option>dkim_domain</option></entry>
75851 <entry>Use: <emphasis>smtp</emphasis></entry>
75852 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
75853 <entry>Default: <emphasis>unset</emphasis></entry>
75854 </row>
75855 </tbody>
75856 </tgroup>
75857 </informaltable>
75858 <para>
75859 The domain(s) you want to sign with.
75860 After expansion, this can be a list.
75861 Each element in turn,
75862 lowercased,
75863 <indexterm role="variable">
75864 <primary><varname>$dkim_domain</varname></primary>
75865 </indexterm>
75866 is put into the <option>$dkim_domain</option> expansion variable
75867 while expanding the remaining signing options.
75868 If it is empty after expansion, DKIM signing is not done,
75869 and no error will result even if <option>dkim_strict</option> is set.
75870 </para>
75871 <para>
75872 <indexterm role="option">
75873 <primary><option>dkim_selector</option></primary>
75874 </indexterm>
75875 </para>
75876 <informaltable frame="all">
75877 <tgroup cols="4" colsep="0" rowsep="0">
75878 <colspec colwidth="8*" align="left"/>
75879 <colspec colwidth="6*" align="center"/>
75880 <colspec colwidth="6*" align="center"/>
75881 <colspec colwidth="6*" align="right"/>
75882 <tbody>
75883 <row>
75884 <entry><option>dkim_selector</option></entry>
75885 <entry>Use: <emphasis>smtp</emphasis></entry>
75886 <entry>Type: <emphasis>string list</emphasis>&dagger;<emphasis></emphasis></entry>
75887 <entry>Default: <emphasis>unset</emphasis></entry>
75888 </row>
75889 </tbody>
75890 </tgroup>
75891 </informaltable>
75892 <para>
75893 This sets the key selector string.
75894 After expansion, which can use <varname>$dkim_domain</varname>, this can be a list.
75895 Each element in turn is put in the expansion
75896 <indexterm role="variable">
75897 <primary><varname>$dkim_selector</varname></primary>
75898 </indexterm>
75899 variable <option>$dkim_selector</option> which may be used in the <option>dkim_private_key</option>
75900 option along with <option>$dkim_domain</option>.
75901 If the option is empty after expansion, DKIM signing is not done for this domain,
75902 and no error will result even if <option>dkim_strict</option> is set.
75903 </para>
75904 <para>
75905 To do, for example, dual-signing with RSA and EC keys
75906 this could be be used:
75907 </para>
75908 <literallayout class="monospaced">
75909 dkim_selector = ec_sel : rsa_sel
75910 dkim_private_key = KEYS_DIR/$dkim_selector
75911 </literallayout>
75912 <para>
75913 <indexterm role="option">
75914 <primary><option>dkim_private_key</option></primary>
75915 </indexterm>
75916 </para>
75917 <informaltable frame="all">
75918 <tgroup cols="4" colsep="0" rowsep="0">
75919 <colspec colwidth="8*" align="left"/>
75920 <colspec colwidth="6*" align="center"/>
75921 <colspec colwidth="6*" align="center"/>
75922 <colspec colwidth="6*" align="right"/>
75923 <tbody>
75924 <row>
75925 <entry><option>dkim_private_key</option></entry>
75926 <entry>Use: <emphasis>smtp</emphasis></entry>
75927 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
75928 <entry>Default: <emphasis>unset</emphasis></entry>
75929 </row>
75930 </tbody>
75931 </tgroup>
75932 </informaltable>
75933 <para>
75934 This sets the private key to use.
75935 You can use the <option>$dkim_domain</option> and
75936 <option>$dkim_selector</option> expansion variables to determine the private key to use.
75937 The result can either
75938 </para>
75939 <itemizedlist>
75940 <listitem>
75941 <para>
75942 be a valid RSA private key in ASCII armor (.pem file), including line breaks
75943 </para>
75944 </listitem>
75945 <listitem>
75946 <para>
75947 with GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
75948 be a valid Ed25519 private key (same format as above)
75949 </para>
75950 </listitem>
75951 <listitem>
75952 <para>
75953 start with a slash, in which case it is treated as a file that contains
75954 the private key
75955 </para>
75956 </listitem>
75957 <listitem>
75958 <para>
75959 be "0", "false" or the empty string, in which case the message will not
75960 be signed. This case will not result in an error, even if <option>dkim_strict</option>
75961 is set.
75962 </para>
75963 </listitem>
75964 </itemizedlist>
75965 <para>
75966 To generate keys under OpenSSL:
75967 </para>
75968 <literallayout class="monospaced">
75969 openssl genrsa -out dkim_rsa.private 2048
75970 openssl rsa -in dkim_rsa.private -out /dev/stdout -pubout -outform PEM
75971 </literallayout>
75972 <para>
75973 The result file from the first command should be retained, and
75974 this option set to use it.
75975 Take the base-64 lines from the output of the second command, concatenated,
75976 for the DNS TXT record.
75977 See section 3.6 of RFC6376 for the record specification.
75978 </para>
75979 <para>
75980 Under GnuTLS:
75981 </para>
75982 <literallayout class="monospaced">
75983 certtool --generate-privkey --rsa --bits=2048 --password='' -8 --outfile=dkim_rsa.private
75984 certtool --load-privkey=dkim_rsa.private --pubkey-info
75985 </literallayout>
75986 <para>
75987 Note that RFC 8301 says:
75988 </para>
75989 <literallayout class="monospaced">
75990 Signers MUST use RSA keys of at least 1024 bits for all keys.
75991 Signers SHOULD use RSA keys of at least 2048 bits.
75992 </literallayout>
75993 <para>
75994 EC keys for DKIM are defined by RFC 8463.
75995 They are considerably smaller than RSA keys for equivalent protection.
75996 As they are a recent development, users should consider dual-signing
75997 (by setting a list of selectors, and an expansion for this option)
75998 for some transition period.
75999 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
76000 for EC keys.
76001 </para>
76002 <para>
76003 OpenSSL 1.1.1 and GnuTLS 3.6.0 can create Ed25519 private keys:
76004 </para>
76005 <literallayout class="monospaced">
76006 openssl genpkey -algorithm ed25519 -out dkim_ed25519.private
76007 certtool --generate-privkey --key-type=ed25519 --outfile=dkim_ed25519.private
76008 </literallayout>
76009 <para>
76010 To produce the required public key value for a DNS record:
76011 </para>
76012 <literallayout class="monospaced">
76013 openssl pkey -outform DER -pubout -in dkim_ed25519.private | tail -c +13 | base64
76014 certtool --load_privkey=dkim_ed25519.private --pubkey_info --outder | tail -c +13 | base64
76015 </literallayout>
76016 <para>
76017 Exim also supports an alternate format
76018 of Ed25519 keys in DNS which was a candidate during development
76019 of the standard, but not adopted.
76020 A future release will probably drop that support.
76021 </para>
76022 <para>
76023 <indexterm role="option">
76024 <primary><option>dkim_hash</option></primary>
76025 </indexterm>
76026 </para>
76027 <informaltable frame="all">
76028 <tgroup cols="4" colsep="0" rowsep="0">
76029 <colspec colwidth="8*" align="left"/>
76030 <colspec colwidth="6*" align="center"/>
76031 <colspec colwidth="6*" align="center"/>
76032 <colspec colwidth="6*" align="right"/>
76033 <tbody>
76034 <row>
76035 <entry><option>dkim_hash</option></entry>
76036 <entry>Use: <emphasis>smtp</emphasis></entry>
76037 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76038 <entry>Default: <emphasis>sha256</emphasis></entry>
76039 </row>
76040 </tbody>
76041 </tgroup>
76042 </informaltable>
76043 <para>
76044 Can be set to any one of the supported hash methods, which are:
76045 </para>
76046 <itemizedlist>
76047 <listitem>
76048 <para>
76049 <literal>sha1</literal> &ndash; should not be used, is old and insecure
76050 </para>
76051 </listitem>
76052 <listitem>
76053 <para>
76054 <literal>sha256</literal> &ndash; the default
76055 </para>
76056 </listitem>
76057 <listitem>
76058 <para>
76059 <literal>sha512</literal> &ndash; possibly more secure but less well supported
76060 </para>
76061 </listitem>
76062 </itemizedlist>
76063 <para>
76064 Note that RFC 8301 says:
76065 </para>
76066 <literallayout class="monospaced">
76067 rsa-sha1 MUST NOT be used for signing or verifying.
76068 </literallayout>
76069 <para>
76070 <indexterm role="option">
76071 <primary><option>dkim_identity</option></primary>
76072 </indexterm>
76073 </para>
76074 <informaltable frame="all">
76075 <tgroup cols="4" colsep="0" rowsep="0">
76076 <colspec colwidth="8*" align="left"/>
76077 <colspec colwidth="6*" align="center"/>
76078 <colspec colwidth="6*" align="center"/>
76079 <colspec colwidth="6*" align="right"/>
76080 <tbody>
76081 <row>
76082 <entry><option>dkim_identity</option></entry>
76083 <entry>Use: <emphasis>smtp</emphasis></entry>
76084 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76085 <entry>Default: <emphasis>unset</emphasis></entry>
76086 </row>
76087 </tbody>
76088 </tgroup>
76089 </informaltable>
76090 <para>
76091 If set after expansion, the value is used to set an "i=" tag in
76092 the signing header.  The DKIM standards restrict the permissible
76093 syntax of this optional tag to a mail address, with possibly-empty
76094 local part, an @, and a domain identical to or subdomain of the "d="
76095 tag value.  Note that Exim does not check the value.
76096 </para>
76097 <para>
76098 <indexterm role="option">
76099 <primary><option>dkim_canon</option></primary>
76100 </indexterm>
76101 </para>
76102 <informaltable frame="all">
76103 <tgroup cols="4" colsep="0" rowsep="0">
76104 <colspec colwidth="8*" align="left"/>
76105 <colspec colwidth="6*" align="center"/>
76106 <colspec colwidth="6*" align="center"/>
76107 <colspec colwidth="6*" align="right"/>
76108 <tbody>
76109 <row>
76110 <entry><option>dkim_canon</option></entry>
76111 <entry>Use: <emphasis>smtp</emphasis></entry>
76112 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76113 <entry>Default: <emphasis>unset</emphasis></entry>
76114 </row>
76115 </tbody>
76116 </tgroup>
76117 </informaltable>
76118 <para>
76119 This option sets the canonicalization method used when signing a message.
76120 The DKIM RFC currently supports two methods: "simple" and "relaxed".
76121 The option defaults to "relaxed" when unset. Note: the current implementation
76122 only supports signing with the same canonicalization method for both headers and body.
76123 </para>
76124 <para>
76125 <indexterm role="option">
76126 <primary><option>dkim_strict</option></primary>
76127 </indexterm>
76128 </para>
76129 <informaltable frame="all">
76130 <tgroup cols="4" colsep="0" rowsep="0">
76131 <colspec colwidth="8*" align="left"/>
76132 <colspec colwidth="6*" align="center"/>
76133 <colspec colwidth="6*" align="center"/>
76134 <colspec colwidth="6*" align="right"/>
76135 <tbody>
76136 <row>
76137 <entry><option>dkim_strict</option></entry>
76138 <entry>Use: <emphasis>smtp</emphasis></entry>
76139 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76140 <entry>Default: <emphasis>unset</emphasis></entry>
76141 </row>
76142 </tbody>
76143 </tgroup>
76144 </informaltable>
76145 <para>
76146 This  option  defines  how  Exim  behaves  when  signing a message that
76147 should be signed fails for some reason.  When the expansion evaluates to
76148 either <quote>1</quote> or <quote>true</quote>, Exim will defer. Otherwise Exim will send the message
76149 unsigned. You can use the <option>$dkim_domain</option> and <option>$dkim_selector</option> expansion
76150 variables here.
76151 </para>
76152 <para>
76153 <indexterm role="option">
76154 <primary><option>dkim_sign_headers</option></primary>
76155 </indexterm>
76156 </para>
76157 <informaltable frame="all">
76158 <tgroup cols="4" colsep="0" rowsep="0">
76159 <colspec colwidth="8*" align="left"/>
76160 <colspec colwidth="6*" align="center"/>
76161 <colspec colwidth="6*" align="center"/>
76162 <colspec colwidth="6*" align="right"/>
76163 <tbody>
76164 <row>
76165 <entry><option>dkim_sign_headers</option></entry>
76166 <entry>Use: <emphasis>smtp</emphasis></entry>
76167 <entry>Type: <emphasis>string</emphasis>&dagger;<emphasis></emphasis></entry>
76168 <entry>Default: <emphasis>see below</emphasis></entry>
76169 </row>
76170 </tbody>
76171 </tgroup>
76172 </informaltable>
76173 <para>
76174 If set, this option must expand to a colon-separated
76175 list of header names.
76176 Headers with these names, or the absence or such a header, will be included
76177 in the message signature.
76178 When unspecified, the header names listed in RFC4871 will be used,
76179 whether or not each header is present in the message.
76180 The default list is available for the expansion in the macro
76181 <quote>_DKIM_SIGN_HEADERS</quote>
76182 and an oversigning variant is in <quote>_DKIM_OVERSIGN_HEADERS</quote>.
76183 </para>
76184 <para>
76185 If a name is repeated, multiple headers by that name (or the absence thereof)
76186 will be signed.  The textually later headers in the headers part of the
76187 message are signed first, if there are multiples.
76188 </para>
76189 <para>
76190 A name can be prefixed with either an <quote>=</quote> or a <quote>+</quote> character.
76191 If an <quote>=</quote> prefix is used, all headers that are present with this name
76192 will be signed.
76193 If a <quote>+</quote> prefix if used, all headers that are present with this name
76194 will be signed, and one signature added for a missing header with the
76195 name will be appended.
76196 </para>
76197 <para>
76198 <indexterm role="option">
76199 <primary><option>dkim_timestamps</option></primary>
76200 </indexterm>
76201 </para>
76202 <informaltable frame="all">
76203 <tgroup cols="4" colsep="0" rowsep="0">
76204 <colspec colwidth="8*" align="left"/>
76205 <colspec colwidth="6*" align="center"/>
76206 <colspec colwidth="6*" align="center"/>
76207 <colspec colwidth="6*" align="right"/>
76208 <tbody>
76209 <row>
76210 <entry><option>dkim_timestamps</option></entry>
76211 <entry>Use: <emphasis>smtp</emphasis></entry>
76212 <entry>Type: <emphasis>integer</emphasis>&dagger;<emphasis></emphasis></entry>
76213 <entry>Default: <emphasis>unset</emphasis></entry>
76214 </row>
76215 </tbody>
76216 </tgroup>
76217 </informaltable>
76218 <para>
76219 This option controls the inclusion of timestamp information in the signature.
76220 If not set, no such information will be included.
76221 Otherwise, must be an unsigned number giving an offset in seconds from the current time
76222 for the expiry tag
76223 (eg. 1209600 for two weeks);
76224 both creation (t=) and expiry (x=) tags will be included.
76225 </para>
76226 <para>
76227 RFC 6376 lists these tags as RECOMMENDED.
76228 </para>
76229 </section>
76230 <section id="SECDKIMVFY">
76231 <title>Verifying DKIM signatures in incoming mail</title>
76232 <para>
76233 <indexterm role="concept">
76234 <primary>DKIM</primary>
76235 <secondary>verification</secondary>
76236 </indexterm>
76237 </para>
76238 <para>
76239 Verification of DKIM signatures in SMTP incoming email is done for all
76240 messages for which an ACL control <option>dkim_disable_verify</option> has not been set.
76241 <indexterm role="concept">
76242 <primary>DKIM</primary>
76243 <secondary>selecting signature algorithms</secondary>
76244 </indexterm>
76245 Individual classes of signature algorithm can be ignored by changing
76246 the main options <option>dkim_verify_hashes</option> or <option>dkim_verify_keytypes</option>.
76247 The <option>dkim_verify_minimal</option> option can be set to cease verification
76248 processing for a message once the first passing signature is found.
76249 </para>
76250 <para>
76251 <indexterm role="concept">
76252 <primary>authentication</primary>
76253 <secondary>expansion item</secondary>
76254 </indexterm>
76255 Performing verification sets up information used by the
76256 <option>authresults</option> expansion item.
76257 </para>
76258 <para>
76259 For most purposes the default option settings suffice and the remainder
76260 of this section can be ignored.
76261 </para>
76262 <para>
76263 The results of verification are made available to the
76264 <option>acl_smtp_dkim</option> ACL, which can examine and modify them.
76265 A missing ACL definition defaults to accept.
76266 By default, the ACL is called once for each
76267 syntactically(!) correct signature in the incoming message.
76268 If any ACL call does not accept, the message is not accepted.
76269 If a cutthrough delivery was in progress for the message, that is
76270 summarily dropped (having wasted the transmission effort).
76271 </para>
76272 <para>
76273 To evaluate the verification result in the ACL
76274 a large number of expansion variables
76275 containing the signature status and its details are set up during the
76276 runtime of the ACL.
76277 </para>
76278 <para>
76279 Calling the ACL only for existing signatures is not sufficient to build
76280 more advanced policies. For that reason, the main option
76281 <option>dkim_verify_signers</option>, and an expansion variable
76282 <option>$dkim_signers</option> exist.
76283 </para>
76284 <para>
76285 The main option <option>dkim_verify_signers</option> can be set to a colon-separated
76286 list of DKIM domains or identities for which the ACL <option>acl_smtp_dkim</option> is
76287 called. It is expanded when the message has been received. At this point,
76288 the expansion variable <option>$dkim_signers</option> already contains a colon-separated
76289 list of signer domains and identities for the message. When
76290 <option>dkim_verify_signers</option> is not specified in the main configuration,
76291 it defaults as:
76292 </para>
76293 <literallayout class="monospaced">
76294 dkim_verify_signers = $dkim_signers
76295 </literallayout>
76296 <para>
76297 This leads to the default behaviour of calling <option>acl_smtp_dkim</option> for each
76298 DKIM signature in the message. Current DKIM verifiers may want to explicitly
76299 call the ACL for known domains or identities. This would be achieved as follows:
76300 </para>
76301 <literallayout class="monospaced">
76302 dkim_verify_signers = paypal.com:ebay.com:$dkim_signers
76303 </literallayout>
76304 <para>
76305 This would result in <option>acl_smtp_dkim</option> always being called for "paypal.com"
76306 and "ebay.com", plus all domains and identities that have signatures in the message.
76307 You can also be more creative in constructing your policy. For example:
76308 </para>
76309 <literallayout class="monospaced">
76310 dkim_verify_signers = $sender_address_domain:$dkim_signers
76311 </literallayout>
76312 <para>
76313 If a domain or identity is listed several times in the (expanded) value of
76314 <option>dkim_verify_signers</option>, the ACL is only called once for that domain or identity.
76315 </para>
76316 <para>
76317 Note that if the option is set using untrustworthy data
76318 (such as the From: header)
76319 care should be taken to force lowercase for domains
76320 and for the domain part if identities.
76321 The default setting can be regarded as trustworthy in this respect.
76322 </para>
76323 <para>
76324 If multiple signatures match a domain (or identity), the ACL is called once
76325 for each matching signature.
76326 </para>
76327 <para>
76328 Inside the DKIM ACL, the following expansion variables are
76329 available (from most to least important):
76330 </para>
76331 <variablelist>
76332 <varlistentry>
76333 <term><option>$dkim_cur_signer</option></term>
76334 <listitem>
76335 <para>
76336 The signer that is being evaluated in this ACL run. This can be a domain or
76337 an identity. This is one of the list items from the expanded main option
76338 <option>dkim_verify_signers</option> (see above).
76339 </para>
76340 </listitem></varlistentry>
76341 <varlistentry>
76342 <term><option>$dkim_verify_status</option></term>
76343 <listitem>
76344 <para>
76345 Within the DKIM ACL,
76346 a string describing the general status of the signature. One of
76347 </para>
76348 <itemizedlist>
76349 <listitem>
76350 <para>
76351 <option>none</option>: There is no signature in the message for the current domain or
76352 identity (as reflected by <option>$dkim_cur_signer</option>).
76353 </para>
76354 </listitem>
76355 <listitem>
76356 <para>
76357 <option>invalid</option>: The signature could not be verified due to a processing error.
76358 More detail is available in <option>$dkim_verify_reason</option>.
76359 </para>
76360 </listitem>
76361 <listitem>
76362 <para>
76363 <option>fail</option>: Verification of the signature failed.  More detail is
76364 available in <option>$dkim_verify_reason</option>.
76365 </para>
76366 </listitem>
76367 <listitem>
76368 <para>
76369 <option>pass</option>: The signature passed verification. It is valid.
76370 </para>
76371 </listitem>
76372 </itemizedlist>
76373 <para>
76374 This variable can be overwritten using an ACL &#x2019;set&#x2019; modifier.
76375 This might, for instance, be done to enforce a policy restriction on
76376 hash-method or key-size:
76377 </para>
76378 <literallayout class="monospaced">
76379   warn condition       = ${if eq {$dkim_verify_status}{pass}}
76380        condition       = ${if eq {${length_3:$dkim_algo}}{rsa}}
76381        condition       = ${if or {{eq {$dkim_algo}{rsa-sha1}} \
76382                                   {&lt; {$dkim_key_length}{1024}}}}
76383        logwrite        = NOTE: forcing DKIM verify fail (was pass)
76384        set dkim_verify_status = fail
76385        set dkim_verify_reason = hash too weak or key too short
76386 </literallayout>
76387 <para>
76388 So long as a DKIM ACL is defined (it need do no more than accept),
76389 after all the DKIM ACL runs have completed, the value becomes a
76390 colon-separated list of the values after each run.
76391 This is maintained for the mime, prdr and data ACLs.
76392 </para>
76393 </listitem></varlistentry>
76394 <varlistentry>
76395 <term><option>$dkim_verify_reason</option></term>
76396 <listitem>
76397 <para>
76398 A string giving a little bit more detail when <option>$dkim_verify_status</option> is either
76399 "fail" or "invalid". One of
76400 </para>
76401 <itemizedlist>
76402 <listitem>
76403 <para>
76404 <option>pubkey_unavailable</option> (when <option>$dkim_verify_status</option>="invalid"): The public
76405 key for the domain could not be retrieved. This may be a temporary problem.
76406 </para>
76407 </listitem>
76408 <listitem>
76409 <para>
76410 <option>pubkey_syntax</option> (when <option>$dkim_verify_status</option>="invalid"): The public key
76411 record for the domain is syntactically invalid.
76412 </para>
76413 </listitem>
76414 <listitem>
76415 <para>
76416 <option>bodyhash_mismatch</option> (when <option>$dkim_verify_status</option>="fail"): The calculated
76417 body hash does not match the one specified in the signature header. This
76418 means that the message body was modified in transit.
76419 </para>
76420 </listitem>
76421 <listitem>
76422 <para>
76423 <option>signature_incorrect</option> (when <option>$dkim_verify_status</option>="fail"): The signature
76424 could not be verified. This may mean that headers were modified,
76425 re-written or otherwise changed in a way which is incompatible with
76426 DKIM verification. It may of course also mean that the signature is forged.
76427 </para>
76428 </listitem>
76429 </itemizedlist>
76430 <para>
76431 This variable can be overwritten, with any value, using an ACL &#x2019;set&#x2019; modifier.
76432 </para>
76433 </listitem></varlistentry>
76434 <varlistentry>
76435 <term><option>$dkim_domain</option></term>
76436 <listitem>
76437 <para>
76438 The signing domain. IMPORTANT: This variable is only populated if there is
76439 an actual signature in the message for the current domain or identity (as
76440 reflected by <option>$dkim_cur_signer</option>).
76441 </para>
76442 </listitem></varlistentry>
76443 <varlistentry>
76444 <term><option>$dkim_identity</option></term>
76445 <listitem>
76446 <para>
76447 The signing identity, if present. IMPORTANT: This variable is only populated
76448 if there is an actual signature in the message for the current domain or
76449 identity (as reflected by <option>$dkim_cur_signer</option>).
76450 </para>
76451 </listitem></varlistentry>
76452 <varlistentry>
76453 <term><option>$dkim_selector</option></term>
76454 <listitem>
76455 <para>
76456 The key record selector string.
76457 </para>
76458 </listitem></varlistentry>
76459 <varlistentry>
76460 <term><option>$dkim_algo</option></term>
76461 <listitem>
76462 <para>
76463 The algorithm used. One of &#x2019;rsa-sha1&#x2019; or &#x2019;rsa-sha256&#x2019;.
76464 If running under GnuTLS 3.6.0 or OpenSSL 1.1.1 or later,
76465 may also be &#x2019;ed25519-sha256&#x2019;.
76466 The "_CRYPTO_SIGN_ED25519" macro will be defined if support is present
76467 for EC keys.
76468 </para>
76469 <para>
76470 Note that RFC 8301 says:
76471 </para>
76472 <literallayout class="monospaced">
76473 rsa-sha1 MUST NOT be used for signing or verifying.
76474
76475 DKIM signatures identified as having been signed with historic
76476 algorithms (currently, rsa-sha1) have permanently failed evaluation
76477 </literallayout>
76478 <para>
76479 To enforce this you must either have a DKIM ACL which checks this variable
76480 and overwrites the <varname>$dkim_verify_status</varname> variable as discussed above,
76481 or have set the main option <option>dkim_verify_hashes</option> to exclude
76482 processing of such signatures.
76483 </para>
76484 </listitem></varlistentry>
76485 <varlistentry>
76486 <term><option>$dkim_canon_body</option></term>
76487 <listitem>
76488 <para>
76489 The body canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
76490 </para>
76491 </listitem></varlistentry>
76492 <varlistentry>
76493 <term><option>$dkim_canon_headers</option></term>
76494 <listitem>
76495 <para>
76496 The header canonicalization method. One of &#x2019;relaxed&#x2019; or &#x2019;simple&#x2019;.
76497 </para>
76498 </listitem></varlistentry>
76499 <varlistentry>
76500 <term><option>$dkim_copiedheaders</option></term>
76501 <listitem>
76502 <para>
76503 A transcript of headers and their values which are included in the signature
76504 (copied from the &#x2019;z=&#x2019; tag of the signature).
76505 Note that RFC6376 requires that verification fail if the From: header is
76506 not included in the signature.  Exim does not enforce this; sites wishing
76507 strict enforcement should code the check explicitly.
76508 </para>
76509 </listitem></varlistentry>
76510 <varlistentry>
76511 <term><option>$dkim_bodylength</option></term>
76512 <listitem>
76513 <para>
76514 The number of signed body bytes. If zero ("0"), the body is unsigned. If no
76515 limit was set by the signer, "9999999999999" is returned. This makes sure
76516 that this variable always expands to an integer value.
76517 <emphasis role="bold">Note:</emphasis> The presence of the signature tag specifying a signing body length
76518 is one possible route to spoofing of valid DKIM signatures.
76519 A paranoid implementation might wish to regard signature where this variable
76520 shows less than the "no limit" return as being invalid.
76521 </para>
76522 </listitem></varlistentry>
76523 <varlistentry>
76524 <term><option>$dkim_created</option></term>
76525 <listitem>
76526 <para>
76527 UNIX timestamp reflecting the date and time when the signature was created.
76528 When this was not specified by the signer, "0" is returned.
76529 </para>
76530 </listitem></varlistentry>
76531 <varlistentry>
76532 <term><option>$dkim_expires</option></term>
76533 <listitem>
76534 <para>
76535 UNIX timestamp reflecting the date and time when the signer wants the
76536 signature to be treated as "expired". When this was not specified by the
76537 signer, "9999999999999" is returned. This makes it possible to do useful
76538 integer size comparisons against this value.
76539 Note that Exim does not check this value.
76540 </para>
76541 </listitem></varlistentry>
76542 <varlistentry>
76543 <term><option>$dkim_headernames</option></term>
76544 <listitem>
76545 <para>
76546 A colon-separated list of names of headers included in the signature.
76547 </para>
76548 </listitem></varlistentry>
76549 <varlistentry>
76550 <term><option>$dkim_key_testing</option></term>
76551 <listitem>
76552 <para>
76553 "1" if the key record has the "testing" flag set, "0" if not.
76554 </para>
76555 </listitem></varlistentry>
76556 <varlistentry>
76557 <term><option>$dkim_key_nosubdomains</option></term>
76558 <listitem>
76559 <para>
76560 "1" if the key record forbids subdomaining, "0" otherwise.
76561 </para>
76562 </listitem></varlistentry>
76563 <varlistentry>
76564 <term><option>$dkim_key_srvtype</option></term>
76565 <listitem>
76566 <para>
76567 Service type (tag s=) from the key record. Defaults to "*" if not specified
76568 in the key record.
76569 </para>
76570 </listitem></varlistentry>
76571 <varlistentry>
76572 <term><option>$dkim_key_granularity</option></term>
76573 <listitem>
76574 <para>
76575 Key granularity (tag g=) from the key record. Defaults to "*" if not specified
76576 in the key record.
76577 </para>
76578 </listitem></varlistentry>
76579 <varlistentry>
76580 <term><option>$dkim_key_notes</option></term>
76581 <listitem>
76582 <para>
76583 Notes from the key record (tag n=).
76584 </para>
76585 </listitem></varlistentry>
76586 <varlistentry>
76587 <term><option>$dkim_key_length</option></term>
76588 <listitem>
76589 <para>
76590 Number of bits in the key.
76591 Valid only once the key is loaded, which is at the time the header signature
76592 is verified, which is after the body hash is.
76593 </para>
76594 <para>
76595 Note that RFC 8301 says:
76596 </para>
76597 <literallayout class="monospaced">
76598 Verifiers MUST NOT consider signatures using RSA keys of
76599 less than 1024 bits as valid signatures.
76600 </literallayout>
76601 <para>
76602 This is enforced by the default setting for the <option>dkim_verify_min_keysizes</option>
76603 option.
76604 </para>
76605 </listitem></varlistentry>
76606 </variablelist>
76607 <para>
76608 In addition, two ACL conditions are provided:
76609 </para>
76610 <variablelist>
76611 <varlistentry>
76612 <term><option>dkim_signers</option></term>
76613 <listitem>
76614 <para>
76615 ACL condition that checks a colon-separated list of domains or identities
76616 for a match against the domain or identity that the ACL is currently verifying
76617 (reflected by <option>$dkim_cur_signer</option>). This is typically used to restrict an ACL
76618 verb to a group of domains or identities. For example:
76619 </para>
76620 <literallayout class="monospaced">
76621 # Warn when Mail purportedly from GMail has no gmail signature
76622 warn sender_domains = gmail.com
76623      dkim_signers = gmail.com
76624      dkim_status = none
76625      log_message = GMail sender without gmail.com DKIM signature
76626 </literallayout>
76627 <para>
76628 Note that the above does not check for a total lack of DKIM signing;
76629 for that check for empty <varname>$h_DKIM-Signature:</varname> in the data ACL.
76630 </para>
76631 </listitem></varlistentry>
76632 <varlistentry>
76633 <term><option>dkim_status</option></term>
76634 <listitem>
76635 <para>
76636 ACL condition that checks a colon-separated list of possible DKIM verification
76637 results against the actual result of verification. This is typically used
76638 to restrict an ACL verb to a list of verification outcomes, for example:
76639 </para>
76640 <literallayout class="monospaced">
76641 deny sender_domains = paypal.com:paypal.de
76642      dkim_signers = paypal.com:paypal.de
76643      dkim_status = none:invalid:fail
76644      message = Mail from Paypal with invalid/missing signature
76645 </literallayout>
76646 <para>
76647 The possible status keywords are: &#x2019;none&#x2019;,&#x2019;invalid&#x2019;,&#x2019;fail&#x2019; and &#x2019;pass&#x2019;. Please
76648 see the documentation of the <option>$dkim_verify_status</option> expansion variable above
76649 for more information of what they mean.
76650 </para>
76651 </listitem></varlistentry>
76652 </variablelist>
76653 </section>
76654 <section id="SECSPF">
76655 <title>SPF (Sender Policy Framework)</title>
76656 <para>
76657 <indexterm role="concept">
76658 <primary>SPF</primary>
76659 <secondary>verification</secondary>
76660 </indexterm>
76661 </para>
76662 <para>
76663 SPF is a mechanism whereby a domain may assert which IP addresses may transmit
76664 messages with its domain in the envelope from, documented by RFC 7208.
76665 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
76666 the <emphasis role="bold"><ulink url="http://openspf.org">http://openspf.org</ulink></emphasis>.
76667 </para>
76668 <para>
76669 Messages sent by a system not authorised will fail checking of such assertions.
76670 This includes retransmissions done by traditional forwarders.
76671 </para>
76672 <para>
76673 SPF verification support is built into Exim if SUPPORT_SPF=yes is set in
76674 <filename>Local/Makefile</filename>.  The support uses the <filename>libspf2</filename> library
76675 <emphasis role="bold"><ulink url="https://www.libspf2.org/">https://www.libspf2.org/</ulink></emphasis>.
76676 There is no Exim involvement in the transmission of messages;
76677 publishing certain DNS records is all that is required.
76678 </para>
76679 <para>
76680 For verification, an ACL condition and an expansion lookup are provided.
76681 <indexterm role="concept">
76682 <primary>authentication</primary>
76683 <secondary>expansion item</secondary>
76684 </indexterm>
76685 Performing verification sets up information used by the
76686 <option>authresults</option> expansion item.
76687 </para>
76688 <para>
76689 <indexterm role="concept">
76690 <primary>SPF</primary>
76691 <secondary>ACL condition</secondary>
76692 </indexterm>
76693 <indexterm role="concept">
76694 <primary>ACL</primary>
76695 <secondary>spf condition</secondary>
76696 </indexterm>
76697 The ACL condition "spf" can be used at or after the MAIL ACL.
76698 It takes as an argument a list of strings giving the outcome of the SPF check,
76699 and will succeed for any matching outcome.
76700 Valid strings are:
76701 </para>
76702 <variablelist>
76703 <varlistentry>
76704 <term><option>pass</option></term>
76705 <listitem>
76706 <para>
76707 The SPF check passed, the sending host is positively verified by SPF.
76708 </para>
76709 </listitem></varlistentry>
76710 <varlistentry>
76711 <term><option>fail</option></term>
76712 <listitem>
76713 <para>
76714 The SPF check failed, the sending host is NOT allowed to send mail for the
76715 domain in the envelope-from address.
76716 </para>
76717 </listitem></varlistentry>
76718 <varlistentry>
76719 <term><option>softfail</option></term>
76720 <listitem>
76721 <para>
76722 The SPF check failed, but the queried domain can&#x2019;t absolutely confirm that this
76723 is a forgery.
76724 </para>
76725 </listitem></varlistentry>
76726 <varlistentry>
76727 <term><option>none</option></term>
76728 <listitem>
76729 <para>
76730 The queried domain does not publish SPF records.
76731 </para>
76732 </listitem></varlistentry>
76733 <varlistentry>
76734 <term><option>neutral</option></term>
76735 <listitem>
76736 <para>
76737 The SPF check returned a "neutral" state.  This means the queried domain has
76738 published a SPF record, but wants to allow outside servers to send mail under
76739 its domain as well.  This should be treated like "none".
76740 </para>
76741 </listitem></varlistentry>
76742 <varlistentry>
76743 <term><option>permerror</option></term>
76744 <listitem>
76745 <para>
76746 This indicates a syntax error in the SPF record of the queried domain.
76747 You may deny messages when this occurs.
76748 </para>
76749 </listitem></varlistentry>
76750 <varlistentry>
76751 <term><option>temperror</option></term>
76752 <listitem>
76753 <para>
76754 This indicates a temporary error during all processing, including Exim&#x2019;s
76755 SPF processing.  You may defer messages when this occurs.
76756 </para>
76757 </listitem></varlistentry>
76758 <varlistentry>
76759 <term><option>invalid</option></term>
76760 <listitem>
76761 <para>
76762 There was an error during processing of the SPF lookup
76763 </para>
76764 </listitem></varlistentry>
76765 </variablelist>
76766 <para>
76767 You can prefix each string with an exclamation mark to  invert
76768 its meaning,  for example  "!fail" will  match all  results but
76769 "fail".  The  string  list is  evaluated  left-to-right,  in a
76770 short-circuit fashion.
76771 </para>
76772 <para>
76773 Example:
76774 </para>
76775 <literallayout class="monospaced">
76776 deny spf = fail
76777      message = $sender_host_address is not allowed to send mail from \
76778                ${if def:sender_address_domain \
76779                     {$sender_address_domain}{$sender_helo_name}}.  \
76780                Please see http://www.open-spf.org/Why;\
76781                identity=${if def:sender_address_domain \
76782                              {$sender_address}{$sender_helo_name}};\
76783                ip=$sender_host_address
76784 </literallayout>
76785 <para>
76786 Note: The above mentioned URL may not be as helpful as expected. You are
76787 encouraged to replace the link with a link to a site with more
76788 explanations.
76789 </para>
76790 <para>
76791 When the spf condition has run, it sets up several expansion
76792 variables:
76793 </para>
76794 <para>
76795 <indexterm role="concept">
76796 <primary>SPF</primary>
76797 <secondary>verification variables</secondary>
76798 </indexterm>
76799 </para>
76800 <variablelist>
76801 <varlistentry>
76802 <term><varname>$spf_header_comment</varname></term>
76803 <listitem>
76804 <para>
76805 <indexterm role="variable">
76806 <primary><varname>$spf_header_comment</varname></primary>
76807 </indexterm>
76808   This contains a human-readable string describing the outcome
76809   of the SPF check. You can add it to a custom header or use
76810   it for logging purposes.
76811 </para>
76812 </listitem></varlistentry>
76813 <varlistentry>
76814 <term><varname>$spf_received</varname></term>
76815 <listitem>
76816 <para>
76817 <indexterm role="variable">
76818 <primary><varname>$spf_received</varname></primary>
76819 </indexterm>
76820   This contains a complete Received-SPF: header (name and
76821   content) that can be added to the message. Please note that
76822   according to the SPF draft, this header must be added at the
76823   top of the header list, i.e. with
76824 </para>
76825 <literallayout class="monospaced">
76826 add_header = :at_start:$spf_received
76827 </literallayout>
76828 <para>
76829   See section <xref linkend="SECTaddheadacl"/> for further details.
76830 </para>
76831 <para>
76832   Note: in case of "Best-guess" (see below), the convention is
76833   to put this string in a header called X-SPF-Guess: instead.
76834 </para>
76835 </listitem></varlistentry>
76836 <varlistentry>
76837 <term><varname>$spf_result</varname></term>
76838 <listitem>
76839 <para>
76840 <indexterm role="variable">
76841 <primary><varname>$spf_result</varname></primary>
76842 </indexterm>
76843   This contains the outcome of the SPF check in string form,
76844   currently one of pass, fail, softfail, none, neutral, permerror,
76845   temperror, or <quote>(invalid)</quote>.
76846 </para>
76847 </listitem></varlistentry>
76848 <varlistentry>
76849 <term><varname>$spf_result_guessed</varname></term>
76850 <listitem>
76851 <para>
76852 <indexterm role="variable">
76853 <primary><varname>$spf_result_guessed</varname></primary>
76854 </indexterm>
76855   This boolean is true only if a best-guess operation was used
76856   and required in order to obtain a result.
76857 </para>
76858 </listitem></varlistentry>
76859 <varlistentry>
76860 <term><varname>$spf_smtp_comment</varname></term>
76861 <listitem>
76862 <para>
76863 <indexterm role="variable">
76864 <primary><varname>$spf_smtp_comment</varname></primary>
76865 </indexterm>
76866 <indexterm role="variable">
76867 <primary><option>spf_smtp_comment_template</option></primary>
76868 </indexterm>
76869   This contains a string that can be used in a SMTP response
76870   to the calling party. Useful for "fail".
76871   The string is generated by the SPF library from the template configured in the main config
76872   option <option>spf_smtp_comment_template</option>.
76873 </para>
76874 </listitem></varlistentry>
76875 </variablelist>
76876 <para>
76877 <indexterm role="concept">
76878 <primary>SPF</primary>
76879 <secondary>ACL condition</secondary>
76880 </indexterm>
76881 <indexterm role="concept">
76882 <primary>ACL</primary>
76883 <secondary>spf_guess condition</secondary>
76884 </indexterm>
76885 <indexterm role="concept">
76886 <primary>SPF</primary>
76887 <secondary>best guess</secondary>
76888 </indexterm>
76889 In addition to SPF, you can also perform checks for so-called
76890 "Best-guess".  Strictly speaking, "Best-guess" is not standard
76891 SPF, but it is supported by the same framework that enables SPF
76892 capability.
76893 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>
76894 for a description of what it means.
76895 </para>
76896 <para>
76897 To access this feature, simply use the spf_guess condition in place
76898 of the spf one.  For example:
76899 </para>
76900 <literallayout class="monospaced">
76901 deny spf_guess = fail
76902      message = $sender_host_address doesn't look trustworthy to me
76903 </literallayout>
76904 <para>
76905 In case you decide to reject messages based on this check, you
76906 should note that although it uses the same framework, "Best-guess"
76907 is not SPF, and therefore you should not mention SPF at all in your
76908 reject message.
76909 </para>
76910 <para>
76911 When the spf_guess condition has run, it sets up the same expansion
76912 variables as when spf condition is run, described above.
76913 </para>
76914 <para>
76915 Additionally, since Best-guess is not standardized, you may redefine
76916 what "Best-guess" means to you by redefining the main configuration
76917 <option>spf_guess</option> option.
76918 For example, the following:
76919 </para>
76920 <literallayout class="monospaced">
76921 spf_guess = v=spf1 a/16 mx/16 ptr ?all
76922 </literallayout>
76923 <para>
76924 would relax host matching rules to a broader network range.
76925 </para>
76926 <para>
76927 <indexterm role="concept">
76928 <primary>SPF</primary>
76929 <secondary>lookup expansion</secondary>
76930 </indexterm>
76931 <indexterm role="concept">
76932 <primary>lookup</primary>
76933 <secondary>spf</secondary>
76934 </indexterm>
76935 A lookup expansion is also available. It takes an email
76936 address as the key and an IP address
76937 (v4 or v6)
76938 as the database:
76939 </para>
76940 <literallayout class="monospaced">
76941   ${lookup {username@domain} spf {ip.ip.ip.ip}}
76942 </literallayout>
76943 <para>
76944 The lookup will return the same result strings as can appear in
76945 <varname>$spf_result</varname> (pass,fail,softfail,neutral,none,err_perm,err_temp).
76946 </para>
76947 </section>
76948 <section id="SECTSRS">
76949 <title>SRS (Sender Rewriting Scheme)</title>
76950 <para>
76951 <indexterm role="concept">
76952 <primary>SRS</primary>
76953 <secondary>sender rewriting scheme</secondary>
76954 </indexterm>
76955 </para>
76956 <para>
76957 SRS can be used to modify sender addresses when forwarding so that
76958 SPF verification does not object to them.
76959 It operates by encoding the original envelope sender in a new
76960 sender local part and using a domain run by the forwarding site
76961 as the new domain for the sender.  Any DSN message should be returned
76962 to this new sender at the forwarding site, which can extract the
76963 original sender from the coded local part and forward the DSN to
76964 the originator.
76965 </para>
76966 <para>
76967 This is a way of avoiding the breakage that SPF does to forwarding.
76968 The constructed local-part will be longer than the original,
76969 leading to possible problems with very long addresses.
76970 The changing of the sender address also hinders the tracing of mail
76971 problems.
76972 </para>
76973 <para>
76974 Exim can be built to include native SRS support.  To do this
76975 SUPPORT_SRS=yes must be defined in <filename>Local/Makefile</filename>.
76976 If this has been done, the macros _HAVE_SRS and _HAVE_NATIVE_SRS
76977 will be defined.
76978 The support is limited to SRS0-encoding; SRS1 is not supported.
76979 </para>
76980 <para>
76981 <indexterm role="concept">
76982 <primary>SRS</primary>
76983 <secondary>excoding</secondary>
76984 </indexterm>
76985 To encode an address use this expansion item:
76986 </para>
76987 <variablelist>
76988 <varlistentry>
76989 <term><emphasis role="bold">${srs_encode&nbsp;{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>return&nbsp;path</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>original&nbsp;domain</emphasis>&gt;<emphasis role="bold">}}</emphasis></term>
76990 <listitem>
76991 <para>
76992 <indexterm role="concept">
76993 <primary><option>srs_encode</option> expansion item</primary>
76994 </indexterm>
76995 <indexterm role="concept">
76996 <primary>SRS</primary>
76997 <secondary>expansion item</secondary>
76998 </indexterm>
76999 The first argument should be a secret known and used by all systems
77000 handling the recipient domain for the original message.
77001 There is no need to periodically change this key; a timestamp is also
77002 encoded.
77003 The second argument should be given as the envelope sender address before this
77004 encoding operation.
77005 </para>
77006 <para revisionflag="changed">
77007 If this value is empty the the expansion result will be empty.
77008 </para>
77009 <para>
77010 The third argument should be the recipient domain of the message when
77011 it arrived at this system.
77012 </para>
77013 </listitem></varlistentry>
77014 </variablelist>
77015 <para>
77016 <indexterm role="concept">
77017 <primary>SRS</primary>
77018 <secondary>decoding</secondary>
77019 </indexterm>
77020 To decode an address use this expansion condition:
77021 </para>
77022 <variablelist>
77023 <varlistentry>
77024 <term><emphasis role="bold">inbound_srs&nbsp;{</emphasis>&lt;<emphasis>local&nbsp;part</emphasis>&gt;<emphasis role="bold">}{</emphasis>&lt;<emphasis>secret</emphasis>&gt;<emphasis role="bold">}</emphasis></term>
77025 <listitem>
77026 <para>
77027 The first argument should be the recipient local prt as is was received.
77028 The second argument is the site secret.
77029 </para>
77030 <para>
77031 If the messages is not for an SRS-encoded recipient the condition will
77032 return false.  If it is, the condition will return true and the variable
77033 <varname>$srs_recipient</varname> will be set to the decoded (original) value.
77034 </para>
77035 </listitem></varlistentry>
77036 </variablelist>
77037 <para>
77038 Example usage:
77039 </para>
77040 <literallayout class="monospaced">
77041   #macro
77042   SRS_SECRET = &lt;pick something unique for your site for this. Use on all MXs.&gt;
77043
77044   #routers
77045
77046   outbound:
77047     driver =    dnslookup
77048     # if outbound, and forwarding has been done, use an alternate transport
77049     domains =   ! +my_domains
77050     transport = ${if eq {$local_part@$domain} \
77051                         {$original_local_part@$original_domain} \
77052                      {remote_smtp} {remote_forwarded_smtp}}
77053
77054   inbound_srs:
77055     driver =    redirect
77056     senders =   :
77057     domains =   +my_domains
77058     # detect inbound bounces which are SRS'd, and decode them
77059     condition = ${if inbound_srs {$local_part} {SRS_SECRET}}
77060     data =      $srs_recipient
77061
77062   inbound_srs_failure:
77063     driver =    redirect
77064     senders =   :
77065     domains =   +my_domains
77066     # detect inbound bounces which look SRS'd but are invalid
77067     condition = ${if inbound_srs {$local_part} {}}
77068     allow_fail
77069     data =      :fail: Invalid SRS recipient address
77070
77071   #... further routers here
77072
77073
77074   # transport; should look like the non-forward outbound
77075   # one, plus the max_rcpt and return_path options
77076   remote_forwarded_smtp:
77077     driver =              smtp
77078     # modify the envelope from, for mails that we forward
77079     max_rcpt =            1
77080     return_path =         ${srs_encode {SRS_SECRET} {$return_path} {$original_domain}}
77081 </literallayout>
77082 </section>
77083 <section id="SECDMARC">
77084 <title>DMARC</title>
77085 <para>
77086 <indexterm role="concept">
77087 <primary>DMARC</primary>
77088 <secondary>verification</secondary>
77089 </indexterm>
77090 </para>
77091 <para>
77092 DMARC combines feedback from SPF, DKIM, and header From: in order
77093 to attempt to provide better indicators of the authenticity of an
77094 email.  This document does not explain the fundamentals; you
77095 should read and understand how it works by visiting the website at
77096 <emphasis role="bold"><ulink url="http://www.dmarc.org/">http://www.dmarc.org/</ulink></emphasis>.
77097 </para>
77098 <para>
77099 If Exim is built with DMARC support,
77100 the libopendmarc library is used.
77101 </para>
77102 <para>
77103 For building Exim yourself, obtain the library from
77104 <emphasis role="bold"><ulink url="http://sourceforge.net/projects/opendmarc/">http://sourceforge.net/projects/opendmarc/</ulink></emphasis>
77105 to obtain a copy, or find it in your favorite package
77106 repository.  You will need to attend to the local/Makefile feature
77107 SUPPORT_DMARC and the associated LDFLAGS addition.
77108 This description assumes
77109 that headers will be in /usr/local/include, and that the libraries
77110 are in /usr/local/lib.
77111 </para>
77112 <para>
77113 There are three main-configuration options:
77114 <indexterm role="concept">
77115 <primary>DMARC</primary>
77116 <secondary>configuration options</secondary>
77117 </indexterm>
77118 </para>
77119 <para>
77120 The <option>dmarc_tld_file</option> option
77121 <indexterm role="option">
77122 <primary><option>dmarc_tld_file</option></primary>
77123 </indexterm>
77124 defines the location of a text file of valid
77125 top level domains the opendmarc library uses
77126 during domain parsing. Maintained by Mozilla,
77127 the most current version can be downloaded
77128 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>.
77129 See also the util/renew-opendmarc-tlds.sh script.
77130 The default for the option is unset.
77131 If not set, DMARC processing is disabled.
77132 </para>
77133 <para>
77134 The <option>dmarc_history_file</option> option, if set
77135 <indexterm role="option">
77136 <primary><option>dmarc_history_file</option></primary>
77137 </indexterm>
77138 defines the location of a file to log results
77139 of dmarc verification on inbound emails. The
77140 contents are importable by the opendmarc tools
77141 which will manage the data, send out DMARC
77142 reports, and expire the data. Make sure the
77143 directory of this file is writable by the user
77144 exim runs as.
77145 The default is unset.
77146 </para>
77147 <para>
77148 The <option>dmarc_forensic_sender</option> option
77149 <indexterm role="option">
77150 <primary><option>dmarc_forensic_sender</option></primary>
77151 </indexterm>
77152 defines an alternate email address to use when sending a
77153 forensic report detailing alignment failures
77154 if a sender domain&#x2019;s dmarc record specifies it
77155 and you have configured Exim to send them.
77156 If set, this is expanded and used for the
77157 From: header line; the address is extracted
77158 from it and used for the envelope from.
77159 If not set (the default), the From: header is expanded from
77160 the dsn_from option, and &lt;&gt; is used for the
77161 envelope from.
77162 </para>
77163 <para>
77164 <indexterm role="concept">
77165 <primary>DMARC</primary>
77166 <secondary>controls</secondary>
77167 </indexterm>
77168 By default, the DMARC processing will run for any remote,
77169 non-authenticated user.  It makes sense to only verify DMARC
77170 status of messages coming from remote, untrusted sources.  You can
77171 use standard conditions such as hosts, senders, etc, to decide that
77172 DMARC verification should *not* be performed for them and disable
77173 DMARC with an ACL control modifier:
77174 </para>
77175 <literallayout class="monospaced">
77176   control = dmarc_disable_verify
77177 </literallayout>
77178 <para>
77179 A DMARC record can also specify a "forensic address", which gives
77180 exim an email address to submit reports about failed alignment.
77181 Exim does not do this by default because in certain conditions it
77182 results in unintended information leakage (what lists a user might
77183 be subscribed to, etc).  You must configure exim to submit forensic
77184 reports to the owner of the domain.  If the DMARC record contains a
77185 forensic address and you specify the control statement below, then
77186 exim will send these forensic emails.  It is also advised that you
77187 configure a <option>dmarc_forensic_sender</option> because the default sender address
77188 construction might be inadequate.
77189 </para>
77190 <literallayout class="monospaced">
77191   control = dmarc_enable_forensic
77192 </literallayout>
77193 <para>
77194 (AGAIN: You can choose not to send these forensic reports by simply
77195 not putting the dmarc_enable_forensic control line at any point in
77196 your exim config.  If you don&#x2019;t tell exim to send them, it will not
77197 send them.)
77198 </para>
77199 <para>
77200 There are no options to either control.  Both must appear before
77201 the DATA acl.
77202 </para>
77203 <para>
77204 DMARC checks cam be run on incoming SMTP  messages by using the
77205 <quote>dmarc_status</quote> ACL condition in the DATA ACL.  You are required to
77206 call the <quote>spf</quote> condition first in the ACLs, then the <quote>dmarc_status</quote>
77207 condition.  Putting this condition in the ACLs is required in order
77208 for a DMARC check to actually occur.  All of the variables are set
77209 up before the DATA ACL, but there is no actual DMARC check that
77210 occurs until a <quote>dmarc_status</quote> condition is encountered in the ACLs.
77211 </para>
77212 <para>
77213 The <quote>dmarc_status</quote> condition takes a list of strings on its
77214 right-hand side.  These strings describe recommended action based
77215 on the DMARC check.  To understand what the policy recommendations
77216 mean, refer to the DMARC website above.  Valid strings are:
77217 </para>
77218 <informaltable frame="none">
77219 <tgroup cols="2" colsep="0" rowsep="0">
77220 <colspec colwidth="1pt" align="left"/>
77221 <colspec colwidth="1pt" align="left"/>
77222 <tbody>
77223 <row>
77224 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>accept</emphasis></entry>
77225 <entry>The DMARC check passed and the library recommends accepting the email</entry>
77226 </row>
77227 <row>
77228 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>reject</emphasis></entry>
77229 <entry>The DMARC check failed and the library recommends rejecting the email</entry>
77230 </row>
77231 <row>
77232 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>quarantine</emphasis></entry>
77233 <entry>The DMARC check failed and the library recommends keeping it for further inspection</entry>
77234 </row>
77235 <row>
77236 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>none</emphasis></entry>
77237 <entry>The DMARC check passed and the library recommends no specific action, neutral</entry>
77238 </row>
77239 <row>
77240 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>norecord</emphasis></entry>
77241 <entry>No policy section in the DMARC record for this RFC5322.From field</entry>
77242 </row>
77243 <row>
77244 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>nofrom</emphasis></entry>
77245 <entry>Unable to determine the domain of the sender</entry>
77246 </row>
77247 <row>
77248 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>temperror</emphasis></entry>
77249 <entry>Library error or dns error</entry>
77250 </row>
77251 <row>
77252 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>off</emphasis></entry>
77253 <entry>The DMARC check was disabled for this email</entry>
77254 </row>
77255 </tbody>
77256 </tgroup>
77257 </informaltable>
77258 <para>
77259 You can prefix each string with an exclamation mark to invert its
77260 meaning, for example "!accept" will match all results but
77261 "accept".  The string list is evaluated left-to-right in a
77262 short-circuit fashion.  When a string matches the outcome of the
77263 DMARC check, the condition succeeds.  If none of the listed
77264 strings matches the outcome of the DMARC check, the condition
77265 fails.
77266 </para>
77267 <para>
77268 Of course, you can also use any other lookup method that Exim
77269 supports, including LDAP, Postgres, MySQL, etc, as long as the
77270 result is a list of colon-separated strings.
77271 </para>
77272 <para>
77273 Performing the check sets up information used by the
77274 <option>authresults</option> expansion item.
77275 </para>
77276 <para>
77277 Several expansion variables are set before the DATA ACL is
77278 processed, and you can use them in this ACL.  The following
77279 expansion variables are available:
77280 </para>
77281 <variablelist>
77282 <varlistentry>
77283 <term><varname>$dmarc_status</varname></term>
77284 <listitem>
77285 <para>
77286 <indexterm role="variable">
77287 <primary><varname>$dmarc_status</varname></primary>
77288 </indexterm>
77289 <indexterm role="concept">
77290 <primary>DMARC</primary>
77291 <secondary>result</secondary>
77292 </indexterm>
77293 A one word status indicating what the DMARC library
77294 thinks of the email.  It is a combination of the results of
77295 DMARC record lookup and the SPF/DKIM/DMARC processing results
77296 (if a DMARC record was found).  The actual policy declared
77297 in the DMARC record is in a separate expansion variable.
77298 </para>
77299 </listitem></varlistentry>
77300 <varlistentry>
77301 <term><varname>$dmarc_status_text</varname></term>
77302 <listitem>
77303 <para>
77304 <indexterm role="variable">
77305 <primary><varname>$dmarc_status_text</varname></primary>
77306 </indexterm>
77307 Slightly longer, human readable status.
77308 </para>
77309 </listitem></varlistentry>
77310 <varlistentry>
77311 <term><varname>$dmarc_used_domain</varname></term>
77312 <listitem>
77313 <para>
77314 <indexterm role="variable">
77315 <primary><varname>$dmarc_used_domain</varname></primary>
77316 </indexterm>
77317 The domain which DMARC used to look up the DMARC policy record.
77318 </para>
77319 </listitem></varlistentry>
77320 <varlistentry>
77321 <term><varname>$dmarc_domain_policy</varname></term>
77322 <listitem>
77323 <para>
77324 <indexterm role="variable">
77325 <primary><varname>$dmarc_domain_policy</varname></primary>
77326 </indexterm>
77327 The policy declared in the DMARC record.  Valid values
77328 are "none", "reject" and "quarantine".  It is blank when there
77329 is any error, including no DMARC record.
77330 </para>
77331 </listitem></varlistentry>
77332 </variablelist>
77333 <para>
77334 By default, Exim&#x2019;s DMARC configuration is intended to be
77335 non-intrusive and conservative.  To facilitate this, Exim will not
77336 create any type of logging files without explicit configuration by
77337 you, the admin.  Nor will Exim send out any emails/reports about
77338 DMARC issues without explicit configuration by you, the admin (other
77339 than typical bounce messages that may come about due to ACL
77340 processing or failure delivery issues).
77341 </para>
77342 <para>
77343 In order to log statistics suitable to be imported by the opendmarc
77344 tools, you need to:
77345 </para>
77346 <itemizedlist>
77347 <listitem>
77348 <para>
77349 Configure the global option <option>dmarc_history_file</option>
77350 </para>
77351 </listitem>
77352 <listitem>
77353 <para>
77354 Configure cron jobs to call the appropriate opendmarc history
77355 import scripts and truncating the dmarc_history_file
77356 </para>
77357 </listitem>
77358 </itemizedlist>
77359 <para>
77360 In order to send forensic reports, you need to:
77361 </para>
77362 <itemizedlist>
77363 <listitem>
77364 <para>
77365 Configure the global option <option>dmarc_forensic_sender</option>
77366 </para>
77367 </listitem>
77368 <listitem>
77369 <para>
77370 Configure, somewhere before the DATA ACL, the control option to
77371 enable sending DMARC forensic reports
77372 </para>
77373 </listitem>
77374 </itemizedlist>
77375 <para>
77376 Example usage:
77377 </para>
77378 <literallayout class="monospaced">
77379 (RCPT ACL)
77380   warn    domains        = +local_domains
77381           hosts          = +local_hosts
77382           control        = dmarc_disable_verify
77383
77384   warn    !domains       = +screwed_up_dmarc_records
77385           control        = dmarc_enable_forensic
77386
77387   warn    condition      = (lookup if destined to mailing list)
77388           set acl_m_mailing_list = 1
77389
77390 (DATA ACL)
77391   warn    dmarc_status   = accept : none : off
77392           !authenticated = *
77393           log_message    = DMARC DEBUG: $dmarc_status $dmarc_used_domain
77394
77395   warn    dmarc_status   = !accept
77396           !authenticated = *
77397           log_message    = DMARC DEBUG: '$dmarc_status' for $dmarc_used_domain
77398
77399   warn    dmarc_status   = quarantine
77400           !authenticated = *
77401           set $acl_m_quarantine = 1
77402           # Do something in a transport with this flag variable
77403
77404   deny    condition      = ${if eq{$dmarc_domain_policy}{reject}}
77405           condition      = ${if eq{$acl_m_mailing_list}{1}}
77406           message        = Messages from $dmarc_used_domain break mailing lists
77407
77408   deny    dmarc_status   = reject
77409           !authenticated = *
77410           message        = Message from $dmarc_used_domain failed sender's DMARC policy, REJECT
77411
77412   warn    add_header     = :at_start:${authresults {$primary_hostname}}
77413 </literallayout>
77414 </section>
77415 </chapter>
77416
77417 <chapter id="CHAPproxies">
77418 <title>Proxies</title>
77419 <titleabbrev>Proxy support</titleabbrev>
77420 <para>
77421 <indexterm role="concept">
77422 <primary>proxy support</primary>
77423 </indexterm>
77424 <indexterm role="concept">
77425 <primary>proxy</primary>
77426 <secondary>access via</secondary>
77427 </indexterm>
77428 </para>
77429 <para>
77430 A proxy is an intermediate system through which communication is passed.
77431 Proxies may provide a security, availability or load-distribution function.
77432 </para>
77433 <section id="SECTproxyInbound">
77434 <title>Inbound proxies</title>
77435 <para>
77436 <indexterm role="concept">
77437 <primary>proxy</primary>
77438 <secondary>inbound</secondary>
77439 </indexterm>
77440 <indexterm role="concept">
77441 <primary>proxy</primary>
77442 <secondary>server side</secondary>
77443 </indexterm>
77444 <indexterm role="concept">
77445 <primary>proxy</primary>
77446 <secondary>Proxy protocol</secondary>
77447 </indexterm>
77448 <indexterm role="concept">
77449 <primary>Proxy protocol</primary>
77450 <secondary>proxy</secondary>
77451 </indexterm>
77452 </para>
77453 <para>
77454 Exim has support for receiving inbound SMTP connections via a proxy
77455 that uses <quote>Proxy Protocol</quote> to speak to it.
77456 To include this support, include <quote>SUPPORT_PROXY=yes</quote>
77457 in Local/Makefile.
77458 </para>
77459 <para>
77460 It was built on the HAProxy specification, found at
77461 <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>.
77462 </para>
77463 <para>
77464 The purpose of this facility is so that an application load balancer,
77465 such as HAProxy, can sit in front of several Exim servers
77466 to distribute load.
77467 Exim uses the local protocol communication with the proxy to obtain
77468 the remote SMTP system IP address and port information.
77469 There is no logging if a host passes or
77470 fails Proxy Protocol negotiation, but it can easily be determined and
77471 recorded in an ACL (example is below).
77472 </para>
77473 <para>
77474 Use of a proxy is enabled by setting the <option>hosts_proxy</option>
77475 main configuration option to a hostlist; connections from these
77476 hosts will use Proxy Protocol.
77477 Exim supports both version 1 and version 2 of the Proxy Protocol and
77478 automatically determines which version is in use.
77479 </para>
77480 <para>
77481 The Proxy Protocol header is the first data received on a TCP connection
77482 and is inserted before any TLS-on-connect handshake from the client; Exim
77483 negotiates TLS between Exim-as-server and the remote client, not between
77484 Exim and the proxy server. The Proxy Protocol header must be received
77485 within <option>proxy_protocol_timeout</option>, which defaults to 3s.
77486 </para>
77487 <para>
77488 The following expansion variables are usable
77489 (<quote>internal</quote> and <quote>external</quote> here refer to the interfaces
77490 of the proxy):
77491 </para>
77492 <informaltable frame="none">
77493 <tgroup cols="2" colsep="0" rowsep="0">
77494 <colspec colwidth="1pt" align="left"/>
77495 <colspec colwidth="1pt" align="left"/>
77496 <tbody>
77497 <row>
77498 <entry>&nbsp;&nbsp;&nbsp;&nbsp;$proxy_external_address</entry>
77499 <entry>IP of host being proxied or IP of remote interface of proxy</entry>
77500 </row>
77501 <row>
77502 <entry>&nbsp;&nbsp;&nbsp;&nbsp;$proxy_external_port</entry>
77503 <entry>Port of host being proxied or Port on remote interface of proxy</entry>
77504 </row>
77505 <row>
77506 <entry>&nbsp;&nbsp;&nbsp;&nbsp;$proxy_local_address</entry>
77507 <entry>IP of proxy server inbound or IP of local interface of proxy</entry>
77508 </row>
77509 <row>
77510 <entry>&nbsp;&nbsp;&nbsp;&nbsp;$proxy_local_port</entry>
77511 <entry>Port of proxy server inbound or Port on local interface of proxy</entry>
77512 </row>
77513 <row>
77514 <entry>&nbsp;&nbsp;&nbsp;&nbsp;$proxy_session</entry>
77515 <entry>boolean: SMTP connection via proxy</entry>
77516 </row>
77517 </tbody>
77518 </tgroup>
77519 </informaltable>
77520 <para>
77521 If <varname>$proxy_session</varname> is set but <varname>$proxy_external_address</varname> is empty
77522 there was a protocol error.
77523 The variables <varname>$sender_host_address</varname> and <varname>$sender_host_port</varname>
77524 will have values for the actual client system, not the proxy.
77525 </para>
77526 <para>
77527 Since the real connections are all coming from the proxy, and the
77528 per host connection tracking is done before Proxy Protocol is
77529 evaluated, <option>smtp_accept_max_per_host</option> must be set high enough to
77530 handle all of the parallel volume you expect per inbound proxy.
77531 With the option set so high, you lose the ability
77532 to protect your server from many connections from one IP.
77533 In order to prevent your server from overload, you
77534 need to add a per connection ratelimit to your connect ACL.
77535 A possible solution is:
77536 </para>
77537 <literallayout>
77538   # Set max number of connections per host
77539   LIMIT   = 5
77540   # Or do some kind of IP lookup in a flat file or database
77541   # LIMIT = ${lookup{$sender_host_address}iplsearch{/etc/exim/proxy_limits}}
77542
77543   defer   ratelimit      = LIMIT / 5s / per_conn / strict
77544           message        = Too many connections from this IP right now
77545 </literallayout>
77546 </section>
77547 <section id="SECTproxySOCKS">
77548 <title>Outbound proxies</title>
77549 <para>
77550 <indexterm role="concept">
77551 <primary>proxy</primary>
77552 <secondary>outbound</secondary>
77553 </indexterm>
77554 <indexterm role="concept">
77555 <primary>proxy</primary>
77556 <secondary>client side</secondary>
77557 </indexterm>
77558 <indexterm role="concept">
77559 <primary>proxy</primary>
77560 <secondary>SOCKS</secondary>
77561 </indexterm>
77562 <indexterm role="concept">
77563 <primary>SOCKS</primary>
77564 <secondary>proxy</secondary>
77565 </indexterm>
77566 Exim has support for sending outbound SMTP via a proxy
77567 using a protocol called SOCKS5 (defined by RFC1928).
77568 The support can be optionally included by defining SUPPORT_SOCKS=yes in
77569 Local/Makefile.
77570 </para>
77571 <para>
77572 Use of a proxy is enabled by setting the <option>socks_proxy</option> option
77573 on an smtp transport.
77574 The option value is expanded and should then be a list
77575 (colon-separated by default) of proxy specifiers.
77576 Each proxy specifier is a list
77577 (space-separated by default) where the initial element
77578 is an IP address and any subsequent elements are options.
77579 </para>
77580 <para>
77581 Options are a string &lt;name&gt;=&lt;value&gt;.
77582 The list of options is in the following table:
77583 </para>
77584 <informaltable frame="none">
77585 <tgroup cols="2" colsep="0" rowsep="0">
77586 <colspec colwidth="1pt" align="left"/>
77587 <colspec colwidth="1pt" align="left"/>
77588 <tbody>
77589 <row>
77590 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>auth</emphasis></entry>
77591 <entry>authentication method</entry>
77592 </row>
77593 <row>
77594 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>name</emphasis></entry>
77595 <entry>authentication username</entry>
77596 </row>
77597 <row>
77598 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>pass</emphasis></entry>
77599 <entry>authentication password</entry>
77600 </row>
77601 <row>
77602 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>port</emphasis></entry>
77603 <entry>tcp port</entry>
77604 </row>
77605 <row>
77606 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>tmo</emphasis></entry>
77607 <entry>connection timeout</entry>
77608 </row>
77609 <row>
77610 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>pri</emphasis></entry>
77611 <entry>priority</entry>
77612 </row>
77613 <row>
77614 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<emphasis>weight</emphasis></entry>
77615 <entry>selection bias</entry>
77616 </row>
77617 </tbody>
77618 </tgroup>
77619 </informaltable>
77620 <para>
77621 More details on each of these options follows:
77622 </para>
77623 <itemizedlist>
77624 <listitem>
77625 <para>
77626 <indexterm role="concept">
77627 <primary>authentication</primary>
77628 <secondary>to proxy</secondary>
77629 </indexterm>
77630 <indexterm role="concept">
77631 <primary>proxy</primary>
77632 <secondary>authentication</secondary>
77633 </indexterm>
77634 <option>auth</option>: Either <quote>none</quote> (default) or <quote>name</quote>.
77635 Using <quote>name</quote> selects username/password authentication per RFC 1929
77636 for access to the proxy.
77637 Default is <quote>none</quote>.
77638 </para>
77639 </listitem>
77640 <listitem>
77641 <para>
77642 <option>name</option>: sets the username for the <quote>name</quote> authentication method.
77643 Default is empty.
77644 </para>
77645 </listitem>
77646 <listitem>
77647 <para>
77648 <option>pass</option>: sets the password for the <quote>name</quote> authentication method.
77649 Default is empty.
77650 </para>
77651 </listitem>
77652 <listitem>
77653 <para>
77654 <option>port</option>: the TCP port number to use for the connection to the proxy.
77655 Default is 1080.
77656 </para>
77657 </listitem>
77658 <listitem>
77659 <para>
77660 <option>tmo</option>: sets a connection timeout in seconds for this proxy.
77661 Default is 5.
77662 </para>
77663 </listitem>
77664 <listitem>
77665 <para>
77666 <option>pri</option>: specifies a priority for the proxy within the list,
77667 higher values being tried first.
77668 The default priority is 1.
77669 </para>
77670 </listitem>
77671 <listitem>
77672 <para>
77673 <option>weight</option>: specifies a selection bias.
77674 Within a priority set servers are queried in a random fashion,
77675 weighted by this value.
77676 The default value for selection bias is 1.
77677 </para>
77678 </listitem>
77679 </itemizedlist>
77680 <para>
77681 Proxies from the list are tried according to their priority
77682 and weight settings until one responds.  The timeout for the
77683 overall connection applies to the set of proxied attempts.
77684 </para>
77685 </section>
77686 <section id="SECTproxyLog">
77687 <title>Logging</title>
77688 <para>
77689 To log the (local) IP of a proxy in the incoming or delivery logline,
77690 add <quote>+proxy</quote> to the <option>log_selector</option> option.
77691 This will add a component tagged with <quote>PRX=</quote> to the line.
77692 </para>
77693 </section>
77694 </chapter>
77695
77696 <chapter id="CHAPi18n">
77697 <title>Internationalisation</title>
77698 <titleabbrev>Internationalisation"</titleabbrev>
77699 <para>
77700 <indexterm role="concept">
77701 <primary>internationalisation</primary>
77702 <secondary>email address</secondary>
77703 </indexterm>
77704 <indexterm role="concept">
77705 <primary>EAI</primary>
77706 </indexterm>
77707 <indexterm role="concept">
77708 <primary>i18n</primary>
77709 </indexterm>
77710 <indexterm role="concept">
77711 <primary>utf8</primary>
77712 <secondary>mail name handling</secondary>
77713 </indexterm>
77714 </para>
77715 <para>
77716 Exim has support for Internationalised mail names.
77717 To include this it must be built with SUPPORT_I18N and the libidn library.
77718 Standards supported are RFCs 2060, 5890, 6530 and 6533.
77719 </para>
77720 <para>
77721 If Exim is built with SUPPORT_I18N_2008 (in addition to SUPPORT_I18N, not
77722 instead of it) then IDNA2008 is supported; this adds an extra library
77723 requirement, upon libidn2.
77724 </para>
77725 <section id="SECTi18nMTA">
77726 <title>MTA operations</title>
77727 <para>
77728 <indexterm role="concept">
77729 <primary>SMTPUTF8</primary>
77730 <secondary>ESMTP option</secondary>
77731 </indexterm>
77732 <indexterm role="concept">
77733 <primary>ESMTP extensions</primary>
77734 <secondary>SMTPUTF8</secondary>
77735 </indexterm>
77736 The main configuration option <option>smtputf8_advertise_hosts</option> specifies
77737 a host list.  If this matches the sending host and
77738 accept_8bitmime is true (the default) then the ESMTP option
77739 SMTPUTF8 will be advertised.
77740 </para>
77741 <para>
77742 If the sender specifies the SMTPUTF8 option on a MAIL command
77743 international handling for the message is enabled and
77744 the expansion variable <varname>$message_smtputf8</varname> will have value TRUE.
77745 </para>
77746 <para>
77747 The option <option>allow_utf8_domains</option> is set to true for this
77748 message. All DNS lookups are converted to a-label form
77749 whatever the setting of <option>allow_utf8_domains</option>
77750 when Exim is built with SUPPORT_I18N.
77751 </para>
77752 <para>
77753 Both localparts and domain are maintained as the original
77754 UTF-8 form internally; any comparison or regular-expression use will
77755 require appropriate care.  Filenames created, eg. by
77756 the appendfile transport, will have UTF-8 names.
77757 </para>
77758 <para>
77759 HELO names sent by the smtp transport will have any UTF-8
77760 components expanded to a-label form,
77761 and any certificate name checks will be done using the a-label
77762 form of the name.
77763 </para>
77764 <para>
77765 <indexterm role="concept">
77766 <primary>log</primary>
77767 <secondary>protocol</secondary>
77768 </indexterm>
77769 <indexterm role="concept">
77770 <primary>SMTPUTF8</primary>
77771 <secondary>logging</secondary>
77772 </indexterm>
77773 <indexterm role="concept">
77774 <primary>i18n</primary>
77775 <secondary>logging</secondary>
77776 </indexterm>
77777 Log lines and Received-by: header lines will acquire a "utf8"
77778 prefix on the protocol element, eg. utf8esmtp.
77779 </para>
77780 <para>
77781 The following expansion operators can be used:
77782 </para>
77783 <literallayout class="monospaced">
77784 ${utf8_domain_to_alabel:str}
77785 ${utf8_domain_from_alabel:str}
77786 ${utf8_localpart_to_alabel:str}
77787 ${utf8_localpart_from_alabel:str}
77788 </literallayout>
77789 <para>
77790 <indexterm role="concept">
77791 <primary>utf8</primary>
77792 <secondary>address downconversion</secondary>
77793 </indexterm>
77794 <indexterm role="concept">
77795 <primary>i18n</primary>
77796 <secondary>utf8 address downconversion</secondary>
77797 </indexterm>
77798 The RCPT ACL
77799 may use the following modifier:
77800 </para>
77801 <literallayout>
77802 control = utf8_downconvert
77803 control = utf8_downconvert/&lt;value&gt;
77804 </literallayout>
77805 <para>
77806 This sets a flag requiring that envelope addresses are converted to
77807 a-label form before smtp delivery.
77808 This is usually for use in a Message Submission Agent context,
77809 but could be used for any message.
77810 </para>
77811 <para>
77812 If a value is appended it may be:
77813 </para>
77814 <informaltable frame="none">
77815 <tgroup cols="2" colsep="0" rowsep="0">
77816 <colspec colwidth="1pt" align="right"/>
77817 <colspec colwidth="1pt" align="left"/>
77818 <tbody>
77819 <row>
77820 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>1</literal></entry>
77821 <entry>mandatory downconversion</entry>
77822 </row>
77823 <row>
77824 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>0</literal></entry>
77825 <entry>no downconversion</entry>
77826 </row>
77827 <row>
77828 <entry>&nbsp;&nbsp;&nbsp;&nbsp;<literal>-1</literal></entry>
77829 <entry>if SMTPUTF8 not supported by destination host</entry>
77830 </row>
77831 </tbody>
77832 </tgroup>
77833 </informaltable>
77834 <para>
77835 If no value is given, 1 is used.
77836 </para>
77837 <para>
77838 If mua_wrapper is set, the utf8_downconvert control
77839 is initially set to -1.
77840 </para>
77841 <para>
77842 The smtp transport has an option <option>utf8_downconvert</option>.
77843 If set it must expand to one of the three values described above,
77844 or an empty string.
77845 If non-empty it overrides value previously set
77846 (due to mua_wrapper or by an ACL control).
77847 </para>
77848 <para>
77849 There is no explicit support for VRFY and EXPN.
77850 Configurations supporting these should inspect
77851 <varname>$smtp_command_argument</varname> for an SMTPUTF8 argument.
77852 </para>
77853 <para>
77854 There is no support for LMTP on Unix sockets.
77855 Using the "lmtp" protocol option on an smtp transport,
77856 for LMTP over TCP, should work as expected.
77857 </para>
77858 <para>
77859 There is no support for DSN unitext handling,
77860 and no provision for converting logging from or to UTF-8.
77861 </para>
77862 </section>
77863 <section id="SECTi18nMDA">
77864 <title>MDA operations</title>
77865 <para>
77866 To aid in constructing names suitable for IMAP folders
77867 the following expansion operator can be used:
77868 </para>
77869 <literallayout class="monospaced">
77870 ${imapfolder {&lt;string&gt;} {&lt;sep&gt;} {&lt;specials&gt;}}
77871 </literallayout>
77872 <para>
77873 The string is converted from the charset specified by
77874 the "headers charset" command (in a filter file)
77875 or <option>headers_charset</option> main configuration option (otherwise),
77876 to the
77877 modified UTF-7 encoding specified by RFC 2060,
77878 with the following exception: All occurrences of &lt;sep&gt;
77879 (which has to be a single character)
77880 are replaced with periods ("."), and all periods and slashes that are not
77881 &lt;sep&gt; and are not in the &lt;specials&gt; string are BASE64 encoded.
77882 </para>
77883 <para>
77884 The third argument can be omitted, defaulting to an empty string.
77885 The second argument can be omitted, defaulting to "/".
77886 </para>
77887 <para>
77888 This is the encoding used by Courier for Maildir names on disk, and followed
77889 by many other IMAP servers.
77890 </para>
77891 <para>
77892 Examples:
77893 </para>
77894 <literallayout>
77895 <literal>${imapfolder {Foo/Bar}}       </literal> yields <literal>Foo.Bar</literal>
77896 <literal>${imapfolder {Foo/Bar}{.}{/}} </literal> yields <literal>Foo&amp;AC8-Bar</literal>
77897 <literal>${imapfolder {Räksmörgås}}    </literal> yields <literal>R&amp;AOQ-ksm&amp;APY-rg&amp;AOU-s</literal>
77898 </literallayout>
77899 <para>
77900 Note that the source charset setting is vital, and also that characters
77901 must be representable in UTF-16.
77902 </para>
77903 </section>
77904 </chapter>
77905
77906 <chapter id="CHAPevents">
77907 <title>Events</title>
77908 <titleabbrev>Events</titleabbrev>
77909 <para>
77910 <indexterm role="concept">
77911 <primary>events</primary>
77912 </indexterm>
77913 </para>
77914 <para>
77915 The events mechanism in Exim can be used to intercept processing at a number
77916 of points.  It was originally invented to give a way to do customised logging
77917 actions (for example, to a database) but can also be used to modify some
77918 processing actions.
77919 </para>
77920 <para>
77921 Most installations will never need to use Events.
77922 The support can be left out of a build by defining DISABLE_EVENT=yes
77923 in <filename>Local/Makefile</filename>.
77924 </para>
77925 <para>
77926 There are two major classes of events: main and transport.
77927 The main configuration option <option>event_action</option> controls reception events;
77928 a transport option <option>event_action</option> controls delivery events.
77929 </para>
77930 <para>
77931 Both options are a string which is expanded when the event fires.
77932 An example might look like:
77933 <indexterm role="concept">
77934 <primary>logging</primary>
77935 <secondary>custom</secondary>
77936 </indexterm>
77937 </para>
77938 <literallayout class="monospaced">
77939 event_action = ${if eq {msg:delivery}{$event_name} \
77940 {${lookup pgsql {SELECT * FROM record_Delivery( \
77941     '${quote_pgsql:$sender_address_domain}',\
77942     '${quote_pgsql:${lc:$sender_address_local_part}}', \
77943     '${quote_pgsql:$domain}', \
77944     '${quote_pgsql:${lc:$local_part}}', \
77945     '${quote_pgsql:$host_address}', \
77946     '${quote_pgsql:${lc:$host}}', \
77947     '${quote_pgsql:$message_exim_id}')}} \
77948 } {}}
77949 </literallayout>
77950 <para>
77951 Events have names which correspond to the point in process at which they fire.
77952 The name is placed in the variable <varname>$event_name</varname> and the event action
77953 expansion must check this, as it will be called for every possible event type.
77954 </para>
77955 <para revisionflag="changed">
77956 The current list of events is:
77957 </para>
77958 <informaltable frame="all" revisionflag="changed">
77959 <tgroup cols="4" colsep="0" rowsep="0">
77960 <colspec colwidth="1pt" align="left"/>
77961 <colspec colwidth="1pt" align="center"/>
77962 <colspec colwidth="1pt" align="center"/>
77963 <colspec colwidth="1pt" align="left"/>
77964 <tbody>
77965 <row>
77966 <entry>&nbsp;&nbsp;&nbsp;&nbsp;dane:fail</entry>
77967 <entry>after</entry>
77968 <entry>transport</entry>
77969 <entry>per connection</entry>
77970 </row>
77971 <row>
77972 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:complete</entry>
77973 <entry>after</entry>
77974 <entry>main</entry>
77975 <entry>per message</entry>
77976 </row>
77977 <row>
77978 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:defer</entry>
77979 <entry>after</entry>
77980 <entry>transport</entry>
77981 <entry>per message per delivery try</entry>
77982 </row>
77983 <row>
77984 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:delivery</entry>
77985 <entry>after</entry>
77986 <entry>transport</entry>
77987 <entry>per recipient</entry>
77988 </row>
77989 <row>
77990 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:rcpt:host:defer</entry>
77991 <entry>after</entry>
77992 <entry>transport</entry>
77993 <entry>per recipient per host</entry>
77994 </row>
77995 <row>
77996 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:rcpt:defer</entry>
77997 <entry>after</entry>
77998 <entry>transport</entry>
77999 <entry>per recipient</entry>
78000 </row>
78001 <row>
78002 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:host:defer</entry>
78003 <entry>after</entry>
78004 <entry>transport</entry>
78005 <entry>per host per delivery try; host errors</entry>
78006 </row>
78007 <row>
78008 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:fail:delivery</entry>
78009 <entry>after</entry>
78010 <entry>transport</entry>
78011 <entry>per recipient</entry>
78012 </row>
78013 <row>
78014 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:fail:internal</entry>
78015 <entry>after</entry>
78016 <entry>main</entry>
78017 <entry>per recipient</entry>
78018 </row>
78019 <row>
78020 <entry>&nbsp;&nbsp;&nbsp;&nbsp;tcp:connect</entry>
78021 <entry>before</entry>
78022 <entry>transport</entry>
78023 <entry>per connection</entry>
78024 </row>
78025 <row>
78026 <entry>&nbsp;&nbsp;&nbsp;&nbsp;tcp:close</entry>
78027 <entry>after</entry>
78028 <entry>transport</entry>
78029 <entry>per connection</entry>
78030 </row>
78031 <row>
78032 <entry>&nbsp;&nbsp;&nbsp;&nbsp;tls:cert</entry>
78033 <entry>before</entry>
78034 <entry>both</entry>
78035 <entry>per certificate in verification chain</entry>
78036 </row>
78037 <row>
78038 <entry>&nbsp;&nbsp;&nbsp;&nbsp;tls:fail:connect</entry>
78039 <entry>after</entry>
78040 <entry>main</entry>
78041 <entry>per connection</entry>
78042 </row>
78043 <row>
78044 <entry>&nbsp;&nbsp;&nbsp;&nbsp;smtp:connect</entry>
78045 <entry>after</entry>
78046 <entry>transport</entry>
78047 <entry>per connection</entry>
78048 </row>
78049 <row>
78050 <entry>&nbsp;&nbsp;&nbsp;&nbsp;smtp:ehlo</entry>
78051 <entry>after</entry>
78052 <entry>transport</entry>
78053 <entry>per connection</entry>
78054 </row>
78055 </tbody>
78056 </tgroup>
78057 </informaltable>
78058 <para>
78059 New event types may be added in future.
78060 </para>
78061 <para>
78062 The event name is a colon-separated list, defining the type of
78063 event in a tree of possibilities.  It may be used as a list
78064 or just matched on as a whole.  There will be no spaces in the name.
78065 </para>
78066 <para>
78067 The second column in the table above describes whether the event fires
78068 before or after the action is associates with.  Those which fire before
78069 can be used to affect that action (more on this below).
78070 </para>
78071 <para>
78072 The third column in the table above says what section of the configuration
78073 should define the event action.
78074 </para>
78075 <para>
78076 An additional variable, <varname>$event_data</varname>, is filled with information varying
78077 with the event type:
78078 </para>
78079 <informaltable frame="all">
78080 <tgroup cols="2" colsep="0" rowsep="0">
78081 <colspec colwidth="1pt" align="left"/>
78082 <colspec colwidth="1pt" align="left"/>
78083 <tbody>
78084 <row>
78085 <entry>&nbsp;&nbsp;&nbsp;&nbsp;dane:fail</entry>
78086 <entry>failure reason</entry>
78087 </row>
78088 <row>
78089 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:defer</entry>
78090 <entry>error string</entry>
78091 </row>
78092 <row>
78093 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:delivery</entry>
78094 <entry>smtp confirmation message</entry>
78095 </row>
78096 <row>
78097 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:fail:internal</entry>
78098 <entry>failure reason</entry>
78099 </row>
78100 <row>
78101 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:fail:delivery</entry>
78102 <entry>smtp error message</entry>
78103 </row>
78104 <row>
78105 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:host:defer</entry>
78106 <entry>error string</entry>
78107 </row>
78108 <row>
78109 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:rcpt:host:defer</entry>
78110 <entry>error string</entry>
78111 </row>
78112 <row>
78113 <entry>&nbsp;&nbsp;&nbsp;&nbsp;msg:rcpt:defer</entry>
78114 <entry>error string</entry>
78115 </row>
78116 <row>
78117 <entry>&nbsp;&nbsp;&nbsp;&nbsp;tls:cert</entry>
78118 <entry>verification chain depth</entry>
78119 </row>
78120 <row>
78121 <entry>&nbsp;&nbsp;&nbsp;&nbsp;tls:fail:connect</entry>
78122 <entry>error string</entry>
78123 </row>
78124 <row>
78125 <entry>&nbsp;&nbsp;&nbsp;&nbsp;smtp:connect</entry>
78126 <entry>smtp banner</entry>
78127 </row>
78128 <row>
78129 <entry>&nbsp;&nbsp;&nbsp;&nbsp;smtp:ehlo</entry>
78130 <entry>smtp ehlo response</entry>
78131 </row>
78132 </tbody>
78133 </tgroup>
78134 </informaltable>
78135 <para>
78136 The :defer events populate one extra variable: <varname>$event_defer_errno</varname>.
78137 </para>
78138 <para>
78139 For complex operations an ACL expansion can be used in <option>event_action</option>,
78140 however due to the multiple contexts that Exim operates in during
78141 the course of its processing:
78142 </para>
78143 <itemizedlist>
78144 <listitem>
78145 <para>
78146 variables set in transport events will not be visible outside that
78147 transport call
78148 </para>
78149 </listitem>
78150 <listitem>
78151 <para>
78152 acl_m variables in a server context are lost on a new connection,
78153 and after smtp helo/ehlo/mail/starttls/rset commands
78154 </para>
78155 </listitem>
78156 </itemizedlist>
78157 <para>
78158 Using an ACL expansion with the logwrite modifier can be
78159 a useful way of writing to the main log.
78160 </para>
78161 <para>
78162 The expansion of the event_action option should normally
78163 return an empty string.  Should it return anything else the
78164 following will be forced:
78165 </para>
78166 <informaltable frame="all">
78167 <tgroup cols="2" colsep="0" rowsep="0">
78168 <colspec colwidth="1pt" align="left"/>
78169 <colspec colwidth="1pt" align="left"/>
78170 <tbody>
78171 <row>
78172 <entry>&nbsp;&nbsp;&nbsp;&nbsp;tcp:connect</entry>
78173 <entry>do not connect</entry>
78174 </row>
78175 <row>
78176 <entry>&nbsp;&nbsp;&nbsp;&nbsp;tls:cert</entry>
78177 <entry>refuse verification</entry>
78178 </row>
78179 <row>
78180 <entry>&nbsp;&nbsp;&nbsp;&nbsp;smtp:connect</entry>
78181 <entry>close connection</entry>
78182 </row>
78183 </tbody>
78184 </tgroup>
78185 </informaltable>
78186 <para>
78187 All other message types ignore the result string, and
78188 no other use is made of it.
78189 </para>
78190 <para>
78191 For a tcp:connect event, if the connection is being made to a proxy
78192 then the address and port variables will be that of the proxy and not
78193 the target system.
78194 </para>
78195 <para>
78196 For tls:cert events, if GnuTLS is in use this will trigger only per
78197 chain element received on the connection.
78198 For OpenSSL it will trigger for every chain element including those
78199 loaded locally.
78200 </para>
78201 </chapter>
78202
78203 <chapter id="CHID13">
78204 <title>Adding new drivers or lookup types</title>
78205 <titleabbrev>Adding drivers or lookups</titleabbrev>
78206 <para>
78207 <indexterm role="concept">
78208 <primary>adding drivers</primary>
78209 </indexterm>
78210 <indexterm role="concept">
78211 <primary>new drivers, adding</primary>
78212 </indexterm>
78213 <indexterm role="concept">
78214 <primary>drivers</primary>
78215 <secondary>adding new</secondary>
78216 </indexterm>
78217 The following actions have to be taken in order to add a new router, transport,
78218 authenticator, or lookup type to Exim:
78219 </para>
78220 <orderedlist numeration="arabic">
78221 <listitem>
78222 <para>
78223 Choose a name for the driver or lookup type that does not conflict with any
78224 existing name; I will use <quote>newdriver</quote> in what follows.
78225 </para>
78226 </listitem>
78227 <listitem>
78228 <para>
78229 Add to <filename>src/EDITME</filename> the line:
78230 </para>
78231 <literallayout>
78232 &lt;<emphasis>type</emphasis>&gt;<literal>_NEWDRIVER=yes</literal>
78233 </literallayout>
78234 <para>
78235 where &lt;<emphasis>type</emphasis>&gt; is ROUTER, TRANSPORT, AUTH, or LOOKUP. If the
78236 code is not to be included in the binary by default, comment this line out. You
78237 should also add any relevant comments about the driver or lookup type.
78238 </para>
78239 </listitem>
78240 <listitem>
78241 <para>
78242 Add to <filename>src/config.h.defaults</filename> the line:
78243 </para>
78244 <literallayout class="monospaced">
78245 #define &lt;type&gt;_NEWDRIVER
78246 </literallayout>
78247 </listitem>
78248 <listitem>
78249 <para>
78250 Edit <filename>src/drtables.c</filename>, adding conditional code to pull in the private header
78251 and create a table entry as is done for all the other drivers and lookup types.
78252 </para>
78253 </listitem>
78254 <listitem>
78255 <para>
78256 Edit <filename>scripts/lookups-Makefile</filename> if this is a new lookup; there is a for-loop
78257 near the bottom, ranging the <literal>name_mod</literal> variable over a list of all lookups.
78258 Add your <literal>NEWDRIVER</literal> to that list.
78259 As long as the dynamic module would be named <filename>newdriver.so</filename>, you can use the
78260 simple form that most lookups have.
78261 </para>
78262 </listitem>
78263 <listitem>
78264 <para>
78265 Edit <filename>Makefile</filename> in the appropriate sub-directory (<filename>src/routers</filename>,
78266 <filename>src/transports</filename>, <filename>src/auths</filename>, or <filename>src/lookups</filename>); add a line for the new
78267 driver or lookup type and add it to the definition of OBJ.
78268 </para>
78269 </listitem>
78270 <listitem>
78271 <para>
78272 Edit <filename>OS/Makefile-Base</filename> adding a <filename>.o</filename> file for the predefined-macros, to the
78273 definition of OBJ_MACRO.  Add a set of line to do the compile also.
78274 </para>
78275 </listitem>
78276 <listitem>
78277 <para>
78278 Create <filename>newdriver.h</filename> and <filename>newdriver.c</filename> in the appropriate sub-directory of
78279 <filename>src</filename>.
78280 </para>
78281 </listitem>
78282 <listitem>
78283 <para>
78284 Edit <filename>scripts/MakeLinks</filename> and add commands to link the <filename>.h</filename> and <filename>.c</filename> files
78285 as for other drivers and lookups.
78286 </para>
78287 </listitem>
78288 </orderedlist>
78289 <para>
78290 Then all you need to do is write the code! A good way to start is to make a
78291 proforma by copying an existing module of the same type, globally changing all
78292 occurrences of the name, and cutting out most of the code. Note that any
78293 options you create must be listed in alphabetical order, because the tables are
78294 searched using a binary chop procedure.
78295 </para>
78296 <para>
78297 There is a <filename>README</filename> file in each of the sub-directories of <filename>src</filename> describing
78298 the interface that is expected.
78299 </para>
78300 <?sdop
78301   format="newpage"
78302   foot_right_recto="&chaptertitle;"
78303   foot_right_verso="&chaptertitle;"
78304 ?>
78305 </chapter>
78306
78307 <index role="option">
78308 <title>Options index</title>
78309 </index>
78310
78311 <index role="variable">
78312 <title>Variables index</title>
78313 </index>
78314
78315 <index role="concept">
78316 <title>Concept index</title>
78317 </index>
78318
78319 </book>